-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from FranGuam/dev
feat: add table `contest_round` & `contest_map`
- Loading branch information
Showing
25 changed files
with
575 additions
and
28 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
migrations/1711103008359_alter_table_public_contest_room_team_add_column_team_label/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."contest_room_team" add column "team_label" text | ||
-- not null; |
2 changes: 2 additions & 0 deletions
2
migrations/1711103008359_alter_table_public_contest_room_team_add_column_team_label/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room_team" add column "team_label" text | ||
not null; |
2 changes: 2 additions & 0 deletions
2
migrations/1711103267075_alter_table_public_contest_room_team_drop_column_players/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room_team" alter column "players" drop not null; | ||
alter table "public"."contest_room_team" add column "players" text; |
1 change: 1 addition & 0 deletions
1
migrations/1711103267075_alter_table_public_contest_room_team_drop_column_players/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table "public"."contest_room_team" drop column "players" cascade; |
4 changes: 4 additions & 0 deletions
4
...tions/1711103312050_alter_table_public_contest_room_team_add_column_player_roles/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."contest_room_team" add column "player_roles" text | ||
-- null default '{}'; |
2 changes: 2 additions & 0 deletions
2
migrations/1711103312050_alter_table_public_contest_room_team_add_column_player_roles/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room_team" add column "player_roles" text | ||
null default '{}'; |
4 changes: 4 additions & 0 deletions
4
...tions/1711103327035_alter_table_public_contest_room_team_add_column_player_codes/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."contest_room_team" add column "player_codes" text | ||
-- null default '{}'; |
2 changes: 2 additions & 0 deletions
2
migrations/1711103327035_alter_table_public_contest_room_team_add_column_player_codes/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room_team" add column "player_codes" text | ||
null default '{}'; |
2 changes: 2 additions & 0 deletions
2
migrations/1711106526273_alter_table_public_contest_room_alter_column_status/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room" alter column "status" set default 'false'; | ||
ALTER TABLE "public"."contest_room" ALTER COLUMN "status" TYPE boolean; |
2 changes: 2 additions & 0 deletions
2
migrations/1711106526273_alter_table_public_contest_room_alter_column_status/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE "public"."contest_room" ALTER COLUMN "status" TYPE text; | ||
ALTER TABLE "public"."contest_room" ALTER COLUMN "status" drop default; |
1 change: 1 addition & 0 deletions
1
migrations/1711107060943_create_table_public_contest_round/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE "public"."contest_round"; |
2 changes: 2 additions & 0 deletions
2
migrations/1711107060943_create_table_public_contest_round/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE TABLE "public"."contest_round" ("contest_id" uuid NOT NULL, "round_id" uuid NOT NULL DEFAULT gen_random_uuid(), "name" text NOT NULL, "maps" text NOT NULL DEFAULT '[]', PRIMARY KEY ("round_id") , FOREIGN KEY ("contest_id") REFERENCES "public"."contest"("id") ON UPDATE restrict ON DELETE cascade, UNIQUE ("round_id"));COMMENT ON TABLE "public"."contest_round" IS E'正式比赛的每轮(初赛、决赛)信息'; | ||
CREATE EXTENSION IF NOT EXISTS pgcrypto; |
4 changes: 4 additions & 0 deletions
4
migrations/1711107393257_alter_table_public_contest_room_add_column_round_id/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."contest_room" add column "round_id" uuid | ||
-- null; |
2 changes: 2 additions & 0 deletions
2
migrations/1711107393257_alter_table_public_contest_room_add_column_round_id/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room" add column "round_id" uuid | ||
null; |
1 change: 1 addition & 0 deletions
1
migrations/1711107417188_set_fk_public_contest_room_round_id/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table "public"."contest_room" drop constraint "contest_room_round_id_fkey"; |
5 changes: 5 additions & 0 deletions
5
migrations/1711107417188_set_fk_public_contest_room_round_id/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alter table "public"."contest_room" | ||
add constraint "contest_room_round_id_fkey" | ||
foreign key ("round_id") | ||
references "public"."contest_round" | ||
("round_id") on update restrict on delete cascade; |
1 change: 1 addition & 0 deletions
1
migrations/1711107929486_create_table_public_contest_map/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE "public"."contest_map"; |
2 changes: 2 additions & 0 deletions
2
migrations/1711107929486_create_table_public_contest_map/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE TABLE "public"."contest_map" ("contest_id" uuid NOT NULL, "map_id" uuid NOT NULL DEFAULT gen_random_uuid(), "name" text NOT NULL, "filename" text NOT NULL, "team_labels" text NOT NULL DEFAULT '[]', PRIMARY KEY ("map_id") , FOREIGN KEY ("contest_id") REFERENCES "public"."contest"("id") ON UPDATE restrict ON DELETE cascade, UNIQUE ("map_id"));COMMENT ON TABLE "public"."contest_map" IS E'比赛用到的地图(文件)'; | ||
CREATE EXTENSION IF NOT EXISTS pgcrypto; |
4 changes: 4 additions & 0 deletions
4
migrations/1711108223021_alter_table_public_contest_room_add_column_map_id/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."contest_room" add column "map_id" uuid | ||
-- null; |
2 changes: 2 additions & 0 deletions
2
migrations/1711108223021_alter_table_public_contest_room_add_column_map_id/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table "public"."contest_room" add column "map_id" uuid | ||
null; |
1 change: 1 addition & 0 deletions
1
migrations/1711108255704_set_fk_public_contest_room_map_id/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table "public"."contest_room" drop constraint "contest_room_map_id_fkey"; |
5 changes: 5 additions & 0 deletions
5
migrations/1711108255704_set_fk_public_contest_room_map_id/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alter table "public"."contest_room" | ||
add constraint "contest_room_map_id_fkey" | ||
foreign key ("map_id") | ||
references "public"."contest_map" | ||
("map_id") on update restrict on delete cascade; |
21 changes: 21 additions & 0 deletions
21
migrations/1711108378765_alter_table_public_contest_room_add_column_updated_at/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."contest_room" add column "updated_at" timestamptz | ||
-- null default now(); | ||
-- | ||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
-- RETURNS TRIGGER AS $$ | ||
-- DECLARE | ||
-- _new record; | ||
-- BEGIN | ||
-- _new := NEW; | ||
-- _new."updated_at" = NOW(); | ||
-- RETURN _new; | ||
-- END; | ||
-- $$ LANGUAGE plpgsql; | ||
-- CREATE TRIGGER "set_public_contest_room_updated_at" | ||
-- BEFORE UPDATE ON "public"."contest_room" | ||
-- FOR EACH ROW | ||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
-- COMMENT ON TRIGGER "set_public_contest_room_updated_at" ON "public"."contest_room" | ||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |
19 changes: 19 additions & 0 deletions
19
migrations/1711108378765_alter_table_public_contest_room_add_column_updated_at/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
alter table "public"."contest_room" add column "updated_at" timestamptz | ||
null default now(); | ||
|
||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
RETURNS TRIGGER AS $$ | ||
DECLARE | ||
_new record; | ||
BEGIN | ||
_new := NEW; | ||
_new."updated_at" = NOW(); | ||
RETURN _new; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
CREATE TRIGGER "set_public_contest_room_updated_at" | ||
BEFORE UPDATE ON "public"."contest_room" | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
COMMENT ON TRIGGER "set_public_contest_room_updated_at" ON "public"."contest_room" | ||
IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |