Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] refactor: 이전의 review 테이블을 삭제하고, new_review 테이블만을 사용하도록 변경 #1104

Merged
merged 5 commits into from
Feb 13, 2025

Conversation

Kimprodp
Copy link
Contributor


🚀 어떤 기능을 구현했나요 ?

  • 이전 작업에서 new_review가 아닌 review에 스키마 작업을 진행했습니다.
  • 변경 사항을 new_review에 다시 적용합니다.
  • 또한, review 테이블이 두 개라 추후에도 실수의 여지가 있기 때문에 사용되지 않는 review 테이블을 삭제합니다.
  • new_review 테이블의 이름을 review로 변경합니다.

🔥 어떻게 해결했나요 ?

  • 생각보다 변경 사항이 없어서 간단합니다!
  • flyway 문서 참고해주세요.

📝 어떤 부분에 집중해서 리뷰해야 할까요?

  • 혹시 놓치고 있는 부분이 없을지 확인해주세요 🙏

📚 참고 자료, 할 말

Copy link

github-actions bot commented Feb 13, 2025

Test Results

159 tests   156 ✅  5s ⏱️
 60 suites    3 💤
 60 files      0 ❌

Results for commit b9c578d.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

이제보니 ddl-auto: validate가 안돼서 CD 도 실패했었네요 ^^ㅠ
이걸 왜 지금 확인했을까...

-- 이전에 review 테이블 변경 사항 중 new_review가 아닌 review에 적용된 사항을 다시 반영합니다.
ALTER TABLE new_review ADD COLUMN member_id BIGINT NULL;

-- 기존 review 테이블을 삭제하고, ew_review 테이블의 이름을 "review"로 변경합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- 기존 review 테이블을 삭제하고, ew_review 테이블의 이름을 "review"로 변경합니다.
-- 기존 review 테이블을 삭제하고, new_review 테이블의 이름을 "review"로 변경합니다.

Comment on lines 6 to 9
BEGIN
DROP TABLE IF EXISTS review;
ALTER TABLE new_review RENAME TO review;
COMMIT
Copy link
Contributor

@nayonsoso nayonsoso Feb 13, 2025

Choose a reason for hiding this comment

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

Suggested change
BEGIN
DROP TABLE IF EXISTS review;
ALTER TABLE new_review RENAME TO review;
COMMIT
START TRANSACTION;
DROP TABLE IF EXISTS review;
ALTER TABLE new_review RENAME TO review;
COMMIT;

BEGIN은 일부 SQL 모드에서 자동 커밋을 끄지 않을 수도 있으므로,
START TRANSACTION 을 사용하는게 안전하다고 하네요!

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

호오.. 반영했습니다

Copy link
Contributor

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

테드 자꾸 추가해서 미안한데,
flyway는 각 마이그레이션 스크립트가 자체적으로 하나의 트랜잭션으로 실행되어서
별도로 트랜잭션으로 묶을 필요가 없다고 합니다😅

Flyway wraps the execution of each migration script in a single transaction and applies them in order.

https://documentation.red-gate.com/fd/migration-transaction-handling-273973399.html

트랜잭션 부분 없애도 될 것 같아요!

@Kimprodp
Copy link
Contributor Author

flyway는 각 마이그레이션 스크립트가 자체적으로 하나의 트랜잭션으로 실행

이해완👍👍
반영했습니다요.

Copy link
Contributor

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

☺️

@Kimprodp Kimprodp merged commit a23e67c into develop Feb 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BE] Review 사용 테이블을 변경한다.
2 participants