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 map for a round
Browse files Browse the repository at this point in the history
  • Loading branch information
FranGuam committed Apr 3, 2024
1 parent afc0f30 commit f951006
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 28 deletions.
82 changes: 54 additions & 28 deletions metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,13 @@
table:
name: contest_room
schema: public
- name: contest_rounds
using:
foreign_key_constraint_on:
column: map_id
table:
name: contest_round
schema: public
insert_permissions:
- role: counselor
permission:
Expand Down Expand Up @@ -1131,6 +1138,9 @@
- name: contest
using:
foreign_key_constraint_on: contest_id
- name: contest_map
using:
foreign_key_constraint_on: map_id
array_relationships:
- name: contest_round_rooms
using:
Expand All @@ -1149,9 +1159,9 @@
_eq: X-Hasura-User-Id
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
- role: student
permission:
check:
Expand All @@ -1161,9 +1171,9 @@
_eq: X-Hasura-User-Id
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
- role: teacher
permission:
check:
Expand All @@ -1173,9 +1183,9 @@
_eq: X-Hasura-User-Id
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
- role: user
permission:
check:
Expand All @@ -1185,95 +1195,111 @@
_eq: X-Hasura-User-Id
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
select_permissions:
- role: counselor
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter: {}
- role: student
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter: {}
- role: teacher
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter: {}
- role: user
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter: {}
update_permissions:
- role: counselor
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
check: null
check:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
- role: student
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
check: null
check:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
- role: teacher
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
check: null
check:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
- role: user
permission:
columns:
- contest_id
- round_id
- map_id
- name
- maps
- round_id
filter:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
check: null
check:
contest:
contest_managers:
user_uuid:
_eq: X-Hasura-User-Id
delete_permissions:
- role: counselor
permission:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_round" rename column "map_id" to "maps";
alter table "public"."contest_round" alter column "maps" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_round" alter column "maps" drop not null;
alter table "public"."contest_round" rename column "maps" to "map_id";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_round" alter column "map_id" set default '[]'::text;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."contest_round" ALTER COLUMN "map_id" drop default;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_round" rename column "maps" to "map_id";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_round" rename column "map_id" to "maps";
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_round" add column "map_id" uuid
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_round" add column "map_id" uuid
null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_round" drop constraint "contest_round_map_id_fkey";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_round"
add constraint "contest_round_map_id_fkey"
foreign key ("map_id")
references "public"."contest_map"
("map_id") on update restrict on delete set null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."contest_round"."maps" is E'正式比赛的每轮(初赛、决赛)信息';
alter table "public"."contest_round" alter column "maps" drop not null;
alter table "public"."contest_round" add column "maps" text;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_round" drop column "maps" cascade;

0 comments on commit f951006

Please sign in to comment.