Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
RENAME TABLE university TO host_university;

ALTER TABLE university_info_for_apply
DROP FOREIGN KEY FKd0257hco6uy2utd1xccjh3fal;

ALTER TABLE university_info_for_apply
ADD CONSTRAINT fk_university_info_for_apply_host_university
FOREIGN KEY (university_id) REFERENCES host_university (id) ON DELETE NO ACTION;

CREATE TABLE IF NOT EXISTS home_university
(
id BIGINT AUTO_INCREMENT NOT NULL,
name VARCHAR(100) NOT NULL,
CONSTRAINT `PRIMARY` PRIMARY KEY (id),
CONSTRAINT uk_home_university_name UNIQUE (name)
);
Comment on lines 10 to 18
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

IF NOT EXISTS는 마이그레이션 누락을 조용히 숨길 수 있어요.
기존에 다른 스키마로 테이블이 존재하면 이 단계가 “조용히 통과”해 후속 오류로 번질 수 있으니, Flyway에서는 제거하는 편이 안전합니다.

🛠️ 수정 제안
-CREATE TABLE IF NOT EXISTS home_university
+CREATE TABLE home_university
 (
     id   BIGINT AUTO_INCREMENT NOT NULL,
     name VARCHAR(100)          NOT NULL,
     CONSTRAINT `PRIMARY` PRIMARY KEY (id),
     CONSTRAINT uk_home_university_name UNIQUE (name)
 );
🤖 Prompt for AI Agents
In
`@src/main/resources/db/migration/V42__rename_university_to_host_university_and_create_home_university.sql`
around lines 10 - 16, The migration uses "CREATE TABLE IF NOT EXISTS
home_university" which can silently skip creating the table when a conflicting
table exists in another schema; remove the "IF NOT EXISTS" clause so the CREATE
TABLE for home_university fails loudly on conflict, allowing Flyway to surface
and fail the migration; apply the same removal to any other CREATE TABLE
statements in this migration to ensure missing/duplicate schema issues are not
silently ignored.


ALTER TABLE host_university
ADD COLUMN home_university_id BIGINT NULL;

ALTER TABLE host_university
ADD CONSTRAINT fk_host_university_home_university
FOREIGN KEY (home_university_id) REFERENCES home_university (id) ON DELETE NO ACTION;

CREATE INDEX fk_host_university_home_university_idx ON host_university (home_university_id);
Loading