Skip to content

Fix: 마이그레이션 enum 정리 멱등성 보장 (#327)#329

Merged
IISweetHeartII merged 1 commit intodevfrom
refactor/cleanup-unused-columns-#327
Mar 10, 2026
Merged

Fix: 마이그레이션 enum 정리 멱등성 보장 (#327)#329
IISweetHeartII merged 1 commit intodevfrom
refactor/cleanup-unused-columns-#327

Conversation

@IISweetHeartII
Copy link
Contributor

Summary

#328 에서 누락된 마이그레이션 멱등성 처리를 보완합니다.

Changes

  • enum 교체 로직(ALTER TYPE ... RENAME TO)이 CI/CD에서 재실행 시 실패하는 문제 수정
  • UNDER_REVIEW 값 존재 여부를 확인한 후에만 enum 교체 실행하도록 DO $$ ... END $$ 블록으로 래핑

Type of Change

  • Bug fix (기존 기능을 수정하는 변경)

Target Environment

  • Dev (dev)

Related Issues

Testing

  • 이미 적용된 Dev/Prod DB에서 재실행 시 에러 없음 확인

Checklist

  • 코드 컨벤션을 준수했습니다 (docs/development/CODE_STYLE.md)
  • Git 컨벤션을 준수했습니다 (docs/development/GIT_CONVENTIONS.md)
  • 로컬에서 빌드가 성공합니다 (pnpm run build)
  • 로컬에서 린트가 통과합니다 (pnpm run lint)

Screenshots (Optional)

N/A

Additional Notes

N/A

@IISweetHeartII IISweetHeartII force-pushed the refactor/cleanup-unused-columns-#327 branch from d3771c9 to b08c803 Compare March 10, 2026 15:17
@IISweetHeartII IISweetHeartII merged commit ee37f3e into dev Mar 10, 2026
2 checks passed
IISweetHeartII added a commit that referenced this pull request Mar 10, 2026
* refactor: Admin/Event/Ticket 미사용 컬럼·테이블 정리 (#327) (#328)

* fix: 마이그레이션 enum 정리 멱등성 보장 (#327) (#329)
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 이전 마이그레이션에서 누락되었던 enum 변경 로직의 멱등성을 보완하여, CI/CD 환경에서 마이그레이션이 여러 번 실행될 때 발생할 수 있는 오류를 방지합니다. 이를 통해 데이터베이스 스키마 변경의 안정성과 신뢰성을 향상시킵니다.

Highlights

  • 마이그레이션 멱등성 보장: ALTER TYPE ... RENAME TO를 사용하는 enum 교체 로직이 CI/CD에서 재실행 시 실패하는 문제를 수정했습니다.
  • 조건부 enum 교체: UNDER_REVIEW 값이 존재하는지 확인한 후에만 enum 교체 로직이 실행되도록 DO $$ ... END $$ 블록으로 래핑했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • supabase/migrations/20260311000000_cleanup_unused_columns_and_tables.sql
    • enum 교체 로직에 멱등성 검사(IF EXISTS (SELECT 1 FROM pg_enum WHERE enumlabel = 'UNDER_REVIEW' ...))를 추가했습니다.
    • 전체 enum 교체 과정을 DO $$ ... END $$ 블록으로 감싸 조건부 실행을 가능하게 했습니다.
Activity
  • 이 PR에 대한 추가적인 활동은 아직 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR cleans up unused code and database schema related to event feedback submission and progress tracking, removing unnecessary logic and columns across various modules. However, a significant security regression was identified in the reward claiming logic: the removal of the isCompleted eligibility check in the claimEventReward method allows any authenticated user to claim rewards for active events without meeting the necessary conditions, contradicting API documentation and intended business logic. On a positive note, the idempotent database migration script for enum changes, using DO $$ ... END $$ blocks and IF EXISTS conditions, is well-implemented.

I am having trouble creating individual review comments. Click here to see my feedback.

src/modules/event/application/facades/event-reward-lifecycle.facade.ts (32-34)

security-high high

A critical security regression has been introduced by removing the participation.isCompleted check from the claimEventReward method. This change, while consistent with the isCompleted column being dropped from the EventParticipation entity, allows any authenticated user to claim rewards for active events without meeting the actual completion criteria. Reward eligibility now solely depends on rewardStatus and rewardGrantedAt. This directly contradicts the API documentation and bypasses intended access controls. Please confirm if this functional change is intended and if the isCompleted logic needs to be re-implemented or replaced to maintain proper reward eligibility.

src/modules/admin/application/facades/admin-event-reward.facade.ts (110)

medium

❌ 문제: grantFeedbackRewardByUserId 메서드의 접근 제어자가 async에서 private async로 변경되었습니다. 이 메서드가 현재 AdminEventRewardFacade 내부에서만 호출되는 것을 확인했습니다.
✅ 제안: 이 변경은 메서드의 책임 범위를 명확히 하고 캡슐화를 강화하는 좋은 리팩토링입니다. 내부적으로만 사용되는 메서드는 private으로 선언하여 외부에서의 직접적인 접근을 방지하는 것이 좋습니다.

supabase/migrations/20260311000000_cleanup_unused_columns_and_tables.sql (24-45)

medium

❌ 문제: event_participation_reward_status_enum 타입에서 UNDER_REVIEW 값을 제거하는 마이그레이션 로직이 포함되어 있습니다.
✅ 제안: DO $$ ... END $$ 블록 내에서 IF EXISTS 조건을 사용하여 UNDER_REVIEW 값이 존재할 때만 enum 변경을 수행하도록 구현한 점은 매우 훌륭합니다. 이는 마이그레이션 스크립트의 멱등성을 보장하여 CI/CD 환경에서 여러 번 실행되어도 오류가 발생하지 않도록 합니다. 데이터베이스 스키마 변경 시 발생할 수 있는 잠재적인 문제를 효과적으로 방지합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Admin/Event/Ticket 미사용 컬럼·테이블 정리

1 participant