Skip to content

Commit

Permalink
refact(uuid): add many ..._uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangmy21 committed Dec 17, 2023
1 parent f1e1c0d commit 9f785bb
Show file tree
Hide file tree
Showing 33 changed files with 169 additions and 39 deletions.
116 changes: 77 additions & 39 deletions metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@
- name: student
using:
foreign_key_constraint_on: student_id
- name: user
using:
foreign_key_constraint_on: student_uuid
insert_permissions:
- role: counselor
permission:
check: {}
columns:
- id
- created_at
- updated_at
- aid
- amount
- code
- created_at
- form_url
- id
- status
- student_id
- student_uuid
- thank_letter
- code
- form_url
- updated_at
- role: root
permission:
check: {}
Expand Down Expand Up @@ -54,16 +58,17 @@
- role: counselor
permission:
columns:
- amount
- aid
- amount
- code
- created_at
- form_url
- id
- status
- student_id
- student_uuid
- thank_letter
- created_at
- updated_at
- id
filter: {}
- role: root
permission:
Expand All @@ -83,16 +88,17 @@
- role: student
permission:
columns:
- id
- created_at
- updated_at
- aid
- amount
- code
- created_at
- form_url
- id
- status
- student_id
- student_uuid
- thank_letter
- code
- form_url
- updated_at
filter:
student_id:
_eq: X-Hasura-User-Id
Expand Down Expand Up @@ -533,13 +539,17 @@
- name: user
using:
foreign_key_constraint_on: user_id
- name: userByUserUuid
using:
foreign_key_constraint_on: user_uuid
insert_permissions:
- role: counselor
permission:
check: {}
columns:
- user_id
- contest_id
- user_id
- user_uuid
- role: root
permission:
check: {}
Expand All @@ -550,8 +560,9 @@
- role: counselor
permission:
columns:
- user_id
- contest_id
- user_id
- user_uuid
filter: {}
- role: root
permission:
Expand All @@ -564,13 +575,15 @@
columns:
- contest_id
- user_id
- user_uuid
filter: {}
update_permissions:
- role: counselor
permission:
columns:
- user_id
- contest_id
- user_id
- user_uuid
filter: {}
check: {}
- role: root
Expand Down Expand Up @@ -703,6 +716,9 @@
- name: team_contest_id
using:
foreign_key_constraint_on: contest_id
- name: team_leader_byuuid
using:
foreign_key_constraint_on: team_leader_uuid
- name: team_leader_id
using:
foreign_key_constraint_on: team_leader
Expand Down Expand Up @@ -732,17 +748,18 @@
check: {}
columns:
- contest_id
- contest_score
- created_at
- invited_code
- member_num
- score
- status
- status2
- contest_score
- submitted_code_num
- team_id
- team_intro
- team_leader
- team_leader_uuid
- team_name
- updated_at
- role: root
Expand Down Expand Up @@ -775,6 +792,7 @@
- team_id
- team_intro
- team_leader
- team_leader_uuid
- team_name
- updated_at
select_permissions:
Expand All @@ -799,20 +817,21 @@
- role: counselor
permission:
columns:
- submitted_code_num
- contest_id
- contest_score
- created_at
- invited_code
- member_num
- score
- status
- status2
- contest_score
- submitted_code_num
- team_id
- team_intro
- team_leader
- team_leader_uuid
- team_name
- created_at
- updated_at
- contest_id
- team_id
- member_num
filter: {}
- role: root
permission:
Expand All @@ -836,17 +855,18 @@
permission:
columns:
- contest_id
- contest_score
- created_at
- invited_code
- member_num
- score
- status
- status2
- contest_score
- submitted_code_num
- team_id
- team_intro
- team_leader
- team_leader_uuid
- team_name
- updated_at
filter: {}
Expand All @@ -867,17 +887,18 @@
- role: counselor
permission:
columns:
- contest_score
- created_at
- invited_code
- member_num
- score
- status
- status2
- contest_score
- submitted_code_num
- team_id
- team_intro
- team_leader
- team_leader_uuid
- team_name
- updated_at
filter: {}
Expand Down Expand Up @@ -906,6 +927,7 @@
- team_id
- team_intro
- team_leader
- team_leader_uuid
- team_name
- updated_at
filter: {}
Expand Down Expand Up @@ -934,6 +956,9 @@
- name: team_as_contest_team_member
using:
foreign_key_constraint_on: team_id
- name: user
using:
foreign_key_constraint_on: user_uuid
- name: user_as_contest_team_member
using:
foreign_key_constraint_on: user_id
Expand All @@ -944,6 +969,7 @@
columns:
- team_id
- user_id
- user_uuid
- role: root
permission:
check: {}
Expand All @@ -956,12 +982,14 @@
columns:
- team_id
- user_id
- user_uuid
select_permissions:
- role: counselor
permission:
columns:
- user_id
- team_id
- user_id
- user_uuid
filter: {}
- role: root
permission:
Expand All @@ -972,15 +1000,17 @@
- role: student
permission:
columns:
- user_id
- team_id
- user_id
- user_uuid
filter: {}
update_permissions:
- role: counselor
permission:
columns:
- user_id
- team_id
- user_id
- user_uuid
filter: {}
check: null
- role: root
Expand All @@ -993,8 +1023,9 @@
- role: student
permission:
columns:
- user_id
- team_id
- user_id
- user_uuid
filter: {}
check: null
delete_permissions:
Expand All @@ -1017,6 +1048,9 @@
- name: student
using:
foreign_key_constraint_on: student_id
- name: user
using:
foreign_key_constraint_on: student_uuid
insert_permissions:
- role: EEsenior
permission:
Expand Down Expand Up @@ -1060,6 +1094,7 @@
- statement
- status
- student_id
- student_uuid
select_permissions:
- role: EEsenior
permission:
Expand All @@ -1078,14 +1113,15 @@
- role: counselor
permission:
columns:
- id
- created_at
- updated_at
- student_id
- statement
- attachment_url
- created_at
- honor
- id
- statement
- status
- student_id
- student_uuid
- updated_at
filter: {}
- role: root
permission:
Expand All @@ -1103,14 +1139,15 @@
- role: student
permission:
columns:
- id
- created_at
- updated_at
- student_id
- statement
- attachment_url
- created_at
- honor
- id
- statement
- status
- student_id
- student_uuid
- updated_at
filter:
student_id:
_eq: X-Hasura-User-Id
Expand Down Expand Up @@ -1162,6 +1199,7 @@
- statement
- status
- student_id
- student_uuid
filter:
_and:
- student_id:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."aid_application" alter column "student_uuid" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."aid_application" alter column "student_uuid" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."aid_application" drop constraint "aid_application_student_uuid_fkey";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."aid_application"
add constraint "aid_application_student_uuid_fkey"
foreign key ("student_uuid")
references "public"."users"
("uuid") on update restrict on delete restrict;
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_manager" add column "user_uuid" uuid
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."contest_manager" add column "user_uuid" uuid
null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."contest_manager" drop constraint "contest_manager_user_uuid_fkey";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."contest_manager"
add constraint "contest_manager_user_uuid_fkey"
foreign key ("user_uuid")
references "public"."users"
("uuid") on update restrict on delete restrict;
Loading

0 comments on commit 9f785bb

Please sign in to comment.