Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
fix(contest): one player a row in contest_player
Browse files Browse the repository at this point in the history
  • Loading branch information
FranGuam committed Apr 3, 2024
1 parent f951006 commit e72a56a
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 24 deletions.
56 changes: 32 additions & 24 deletions metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -965,38 +965,34 @@
- role: counselor
permission:
columns:
- player_num
- players_label
- contest_id
- player_label
- roles_available
- team_label
- contest_id
filter: {}
- role: student
permission:
columns:
- player_num
- players_label
- contest_id
- player_label
- roles_available
- team_label
- contest_id
filter: {}
- role: teacher
permission:
columns:
- player_num
- players_label
- contest_id
- player_label
- roles_available
- team_label
- contest_id
filter: {}
- role: user
permission:
columns:
- player_num
- players_label
- contest_id
- player_label
- roles_available
- team_label
- contest_id
filter: {}
- table:
name: contest_room
Expand Down Expand Up @@ -2048,9 +2044,10 @@
user_uuid:
_eq: X-Hasura-User-Id
columns:
- team_id
- player
- role
- code_id
- team_id
- role: student
permission:
check:
Expand All @@ -2059,9 +2056,10 @@
user_uuid:
_eq: X-Hasura-User-Id
columns:
- team_id
- player
- role
- code_id
- team_id
- role: teacher
permission:
check:
Expand All @@ -2070,9 +2068,10 @@
user_uuid:
_eq: X-Hasura-User-Id
columns:
- team_id
- player
- role
- code_id
- team_id
- role: user
permission:
check:
Expand All @@ -2081,16 +2080,18 @@
user_uuid:
_eq: X-Hasura-User-Id
columns:
- team_id
- player
- role
- code_id
- team_id
select_permissions:
- role: counselor
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2099,9 +2100,10 @@
- role: student
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2110,9 +2112,10 @@
- role: teacher
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2121,9 +2124,10 @@
- role: user
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2133,9 +2137,10 @@
- role: counselor
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2149,9 +2154,10 @@
- role: student
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2165,9 +2171,10 @@
- role: teacher
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand All @@ -2181,9 +2188,10 @@
- role: user
permission:
columns:
- team_id
- player
- role
- code_id
- team_id
filter:
contest_team:
contest_team_members:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_player" rename column "player_label" to "players_label";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_player" rename column "players_label" to "player_label";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."contest_player"."player_num" is E'记录每个比赛可以允许几队、每队有几个玩家、每个玩家可以选择哪些角色';
alter table "public"."contest_player" alter column "player_num" drop not null;
alter table "public"."contest_player" add column "player_num" int4;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_player" drop column "player_num" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."contest_player" drop constraint "contest_player_pkey";
alter table "public"."contest_player"
add constraint "contest_player_pkey"
primary key ("contest_id", "team_label");
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BEGIN TRANSACTION;
ALTER TABLE "public"."contest_player" DROP CONSTRAINT "contest_player_pkey";

ALTER TABLE "public"."contest_player"
ADD CONSTRAINT "contest_player_pkey" PRIMARY KEY ("contest_id", "team_label", "player_label");
COMMIT TRANSACTION;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."contest_player" ALTER COLUMN "roles_available" drop default;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_player" alter column "roles_available" set default '[]';

0 comments on commit e72a56a

Please sign in to comment.