From bef8fef881c6b8434a8e1b4e8203f190f7ec1b1d Mon Sep 17 00:00:00 2001 From: Jin409 Date: Thu, 8 Feb 2024 20:53:53 +0000 Subject: [PATCH] =?UTF-8?q?[ADD]=20=EC=99=B8=EB=9E=98=ED=82=A4=20=EC=A0=9C?= =?UTF-8?q?=EC=95=BD=20=EC=B6=94=EA=B0=80=20#103?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/V6__update-timeline-lineup.sql | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/resources/db/migration/V6__update-timeline-lineup.sql b/src/main/resources/db/migration/V6__update-timeline-lineup.sql index 111767da..eb2fb0f8 100644 --- a/src/main/resources/db/migration/V6__update-timeline-lineup.sql +++ b/src/main/resources/db/migration/V6__update-timeline-lineup.sql @@ -12,22 +12,39 @@ CREATE TABLE score_records id BIGINT AUTO_INCREMENT NOT NULL, record_id BIGINT NOT NULL, lineup_player_id BIGINT NOT NULL, - score INT NOT NULL + score INT NOT NULL, + PRIMARY KEY (id) ); +ALTER TABLE score_records + ADD CONSTRAINT FK_RECORDS_IN_SCORE_RECORDS FOREIGN KEY (record_id) REFERENCES records (id); + +ALTER TABLE score_records + ADD CONSTRAINT FK_LINEUP_PLAYER_ID FOREIGN KEY (lineup_player_id) REFERENCES lineup_players (id); + CREATE TABLE replacement_records ( id BIGINT AUTO_INCREMENT NOT NULL, record_id BIGINT NOT NULL, origin_lineup_player_id BIGINT NOT NULL, - replaced_lineup_player_id BIGINT NOT NULL + replaced_lineup_player_id BIGINT NOT NULL, + PRIMARY KEY (id) ); +ALTER TABLE replacement_records + ADD CONSTRAINT FK_RECORDS_IN_REPLACEMENT_RECORDS FOREIGN KEY (record_id) REFERENCES records (id); + +ALTER TABLE replacement_records + ADD CONSTRAINT FK_ORIGIN_LINEUP_PLAYER FOREIGN KEY (origin_lineup_player_id) REFERENCES lineup_players (id); + +ALTER TABLE replacement_records + ADD CONSTRAINT FK_REPLACED_LINEUP_PLAYER FOREIGN KEY (replaced_lineup_player_id) REFERENCES lineup_players (id); + ALTER TABLE league_team_players - ADD COLUMN number INT; + ADD COLUMN number INT NULL; ALTER TABLE lineup_players ADD COLUMN number INT; ALTER TABLE lineup_players - ADD COLUMN is_captain BOOLEAN; \ No newline at end of file + ADD COLUMN is_captain BOOLEAN;