Skip to content

Commit

Permalink
Merge pull request #153 from FranGuam/feature/contest-refresh
Browse files Browse the repository at this point in the history
feat(contest): foreign key, permission and a new table
  • Loading branch information
xiangmy21 authored Mar 18, 2024
2 parents 119f5d9 + 8662ca7 commit d7e137d
Show file tree
Hide file tree
Showing 59 changed files with 1,054 additions and 170 deletions.
1,040 changes: 870 additions & 170 deletions metadata/tables.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_notice" rename to "contest_info";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_info" rename to "contest_notice";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_manager" drop constraint "contest_manager_contest_id_fkey",
add constraint "contest_manager_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_manager" drop constraint "contest_manager_contest_id_fkey",
add constraint "contest_manager_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_manager" drop constraint "contest_manager_user_uuid_fkey",
add constraint "contest_manager_user_uuid_fkey"
foreign key ("user_uuid")
references "public"."users"
("uuid") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_manager" drop constraint "contest_manager_user_uuid_fkey",
add constraint "contest_manager_user_uuid_fkey"
foreign key ("user_uuid")
references "public"."users"
("uuid") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."contest_manager"."user_id" is E'比赛管理员映射表';
alter table "public"."contest_manager" alter column "user_id" drop not null;
alter table "public"."contest_manager" add column "user_id" text;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_manager" drop column "user_id" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_notice" drop constraint "contest_notice_contest_id_fkey",
add constraint "contest_info_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_notice" drop constraint "contest_info_contest_id_fkey",
add constraint "contest_notice_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_room" drop constraint "contest_room_contest_id_fkey",
add constraint "contest_room_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_room" drop constraint "contest_room_contest_id_fkey",
add constraint "contest_room_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_room_team" drop constraint "contest_room_team_room_id_fkey",
add constraint "contest_room_team_room_id_fkey"
foreign key ("room_id")
references "public"."contest_room"
("room_id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_room_team" drop constraint "contest_room_team_room_id_fkey",
add constraint "contest_room_team_room_id_fkey"
foreign key ("room_id")
references "public"."contest_room"
("room_id") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_room_team" drop constraint "contest_room_team_team_id_fkey",
add constraint "contest_room_team_team_id_fkey"
foreign key ("team_id")
references "public"."contest_team"
("team_id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_room_team" drop constraint "contest_room_team_team_id_fkey",
add constraint "contest_room_team_team_id_fkey"
foreign key ("team_id")
references "public"."contest_team"
("team_id") on update restrict on delete cascade;
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 "score" integer
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_room_team" add column "score" integer
null;
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 "players" text
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_room_team" add column "players" text
null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team" drop constraint "contest_team_contest_id_fkey",
add constraint "contest_team_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team" drop constraint "contest_team_contest_id_fkey",
add constraint "contest_team_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team" drop constraint "contest_team_team_leader_uuid_fkey",
add constraint "contest_team_team_leader_uuid_fkey"
foreign key ("team_leader_uuid")
references "public"."users"
("uuid") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team" drop constraint "contest_team_team_leader_uuid_fkey",
add constraint "contest_team_team_leader_uuid_fkey"
foreign key ("team_leader_uuid")
references "public"."users"
("uuid") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_team" alter column "team_leader_uuid" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_team" alter column "team_leader_uuid" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."contest_team"."team_leader" is E'比赛队伍';
alter table "public"."contest_team" alter column "team_leader" drop not null;
alter table "public"."contest_team" add column "team_leader" text;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_team" drop column "team_leader" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment on table "public"."contest_notice" is NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment on table "public"."contest_notice" is E'比赛公告';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."contest_team_code" ALTER COLUMN "compile_status" drop default;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_team_code" alter column "compile_status" set default 'Waiting';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team_member" drop constraint "contest_team_member_team_id_fkey",
add constraint "contest_team_member_team_id_fkey"
foreign key ("team_id")
references "public"."contest_team"
("team_id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team_member" drop constraint "contest_team_member_team_id_fkey",
add constraint "contest_team_member_team_id_fkey"
foreign key ("team_id")
references "public"."contest_team"
("team_id") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team_member" drop constraint "contest_team_member_user_uuid_fkey",
add constraint "contest_team_member_user_uuid_fkey"
foreign key ("user_uuid")
references "public"."users"
("uuid") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_team_member" drop constraint "contest_team_member_user_uuid_fkey",
add constraint "contest_team_member_user_uuid_fkey"
foreign key ("user_uuid")
references "public"."users"
("uuid") on update restrict on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."contest_team_member"."user_id" is E'队伍、成员映射表';
alter table "public"."contest_team_member" alter column "user_id" drop not null;
alter table "public"."contest_team_member" add column "user_id" text;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_team_member" drop column "user_id" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "public"."contest_player";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE TABLE "public"."contest_player" ("contest_id" uuid NOT NULL, "team_label" text NOT NULL, "player_num" integer NOT NULL, "players_label" text NOT NULL, "roles_available" text NOT NULL, PRIMARY KEY ("contest_id","team_label") , FOREIGN KEY ("contest_id") REFERENCES "public"."contest"("id") ON UPDATE restrict ON DELETE cascade);COMMENT ON TABLE "public"."contest_player" IS E'记录每个比赛可以允许几队、每队有几个玩家、每个玩家可以选择哪些角色';
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" add column "code_upload_switch" boolean
-- not null default 'False';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest" add column "code_upload_switch" boolean
not null default 'False';
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" add column "arena_switch" boolean
-- not null default 'False';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest" add column "arena_switch" boolean
not null default 'False';
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" add column "playground_switch" boolean
-- not null default 'False';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest" add column "playground_switch" boolean
not null default 'False';
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" add column "stream_switch" boolean
-- not null default 'False';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest" add column "stream_switch" boolean
not null default 'False';
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" add column "playback_switch" boolean
-- not null default 'False';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest" add column "playback_switch" boolean
not null default 'False';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest" alter column "name" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest" alter column "name" set not null;
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_team_player" add column "role" text
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_team_player" add column "role" text
null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_code"
add constraint "contest_code_contest_id_fkey"
foreign key ("contest_id")
references "public"."contest"
("id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_code" drop constraint "contest_code_contest_id_fkey";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_code"
add constraint "contest_code_team_id_fkey"
foreign key ("team_id")
references "public"."contest_team"
("team_id") on update cascade on delete cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_code" drop constraint "contest_code_team_id_fkey";

0 comments on commit d7e137d

Please sign in to comment.