Skip to content

Commit

Permalink
fix: Flyway 스크립트 DDL 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
donghoony committed Jan 22, 2025
1 parent cc8557f commit 45562c8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ALTER TABLE question ADD COLUMN section_id BIGINT;
ALTER TABLE question ADD COLUMN option_group_id BIGINT;

-- 기존 테이블의 데이터를 새로운 테이블로 이동
UPDATE question q SET section_id = sq.section_id FROM section_question sq WHERE q.id = sq.question_id;
UPDATE section s SET template_id = st.template_id FROM template_section st WHERE s.id = st.section_id;
UPDATE question q SET option_group_id = og.id FROM option_group og WHERE q.id = og.question_id;
UPDATE question q JOIN section_question sq ON q.id = sq.question_id SET q.section_id = sq.section_id;
UPDATE section s JOIN template_section st ON s.id = st.section_id SET s.template_id = st.template_id;
UPDATE question q JOIN option_group og ON q.id = og.question_id SET q.option_group_id = og.id;

-- FK 관계 설정
ALTER TABLE section ADD CONSTRAINT section_fk_template_id FOREIGN KEY (template_id) REFERENCES template (id);
Expand Down

0 comments on commit 45562c8

Please sign in to comment.