From c1f966816a03ef34b4c6e83aa09d3c60cb8e1cff Mon Sep 17 00:00:00 2001 From: FranGuam Date: Mon, 27 May 2024 12:22:33 +0800 Subject: [PATCH] chore: remove id fields for all tables --- metadata/tables.yaml | 134 +++++++----------- .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 2 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 2 + .../up.sql | 1 + .../down.sql | 2 + .../up.sql | 1 + .../down.sql | 2 + .../up.sql | 1 + .../down.sql | 3 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 2 + .../up.sql | 1 + .../down.sql | 2 + .../up.sql | 1 + .../down.sql | 3 + .../up.sql | 1 + 27 files changed, 87 insertions(+), 83 deletions(-) create mode 100644 migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/down.sql create mode 100644 migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/up.sql create mode 100644 migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/down.sql create mode 100644 migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/up.sql create mode 100644 migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/down.sql create mode 100644 migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/up.sql create mode 100644 migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/down.sql create mode 100644 migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/up.sql create mode 100644 migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/down.sql create mode 100644 migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/up.sql create mode 100644 migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/down.sql create mode 100644 migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/up.sql create mode 100644 migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/down.sql create mode 100644 migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/up.sql create mode 100644 migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/down.sql create mode 100644 migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/up.sql create mode 100644 migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/down.sql create mode 100644 migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/up.sql create mode 100644 migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/down.sql create mode 100644 migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/up.sql create mode 100644 migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/down.sql create mode 100644 migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/up.sql create mode 100644 migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/down.sql create mode 100644 migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/up.sql create mode 100644 migrations/1716783150254_alter_table_public_users_drop_column_id/down.sql create mode 100644 migrations/1716783150254_alter_table_public_users_drop_column_id/up.sql diff --git a/metadata/tables.yaml b/metadata/tables.yaml index ef031ea..bde7e4f 100644 --- a/metadata/tables.yaml +++ b/metadata/tables.yaml @@ -3013,7 +3013,7 @@ name: honor_application schema: public object_relationships: - - name: student_byuuid + - name: student using: foreign_key_constraint_on: student_uuid insert_permissions: @@ -3032,7 +3032,6 @@ - honor - statement - status - - student_id - student_uuid select_permissions: - role: counselor @@ -3044,7 +3043,6 @@ - id - statement - status - - student_id - student_uuid - updated_at filter: {} @@ -3057,7 +3055,6 @@ - id - statement - status - - student_id - student_uuid - updated_at filter: @@ -3077,7 +3074,6 @@ - honor - statement - status - - student_id - student_uuid filter: _and: @@ -3175,10 +3171,10 @@ name: mentor_application schema: public object_relationships: - - name: mentor_byuuid + - name: mentor using: foreign_key_constraint_on: mentor_uuid - - name: student_byuuid + - name: student using: foreign_key_constraint_on: student_uuid insert_permissions: @@ -3186,71 +3182,61 @@ permission: check: {} columns: - - id + - chat_status - created_at - - updated_at + - id + - mentor_uuid - statement - - mentor_id - - student_id - status - - chat_status - - mentor_uuid - student_uuid + - updated_at - role: student permission: check: student_uuid: _eq: X-Hasura-User-Id columns: - - mentor_id - mentor_uuid - statement - - student_id - student_uuid select_permissions: - role: counselor permission: columns: - chat_status - - mentor_id - - statement - - student_id - created_at - - updated_at - id - mentor_uuid - - student_uuid + - statement - status + - student_uuid + - updated_at filter: {} allow_aggregations: true - role: student permission: columns: - chat_status - - mentor_id - - statement - - student_id - created_at - - updated_at - id - mentor_uuid - - student_uuid + - statement - status + - student_uuid + - updated_at filter: {} allow_aggregations: true - role: teacher permission: columns: - chat_status - - mentor_id - - statement - - student_id - created_at - - updated_at - id - mentor_uuid - - student_uuid + - statement - status + - student_uuid + - updated_at filter: mentor_uuid: _eq: X-Hasura-User-Id @@ -3259,15 +3245,13 @@ permission: columns: - chat_status - - mentor_id - - statement - - student_id - created_at - - updated_at - id - mentor_uuid - - student_uuid + - statement - status + - student_uuid + - updated_at filter: {} check: {} - role: student @@ -3318,7 +3302,7 @@ name: mentor_available schema: public object_relationships: - - name: mentor_byuuid + - name: mentor using: foreign_key_constraint_on: mentor_uuid insert_permissions: @@ -3329,35 +3313,31 @@ _eq: X-Hasura-User-Id columns: - available - - mentor_id - mentor_uuid select_permissions: - role: counselor permission: columns: - - created_at - - updated_at - - mentor_id - available + - created_at - mentor_uuid + - updated_at filter: {} - role: student permission: columns: - available - - mentor_id - created_at - - updated_at - mentor_uuid + - updated_at filter: {} - role: teacher permission: columns: - available - - mentor_id - created_at - - updated_at - mentor_uuid + - updated_at filter: mentor_uuid: _eq: X-Hasura-User-Id @@ -3376,7 +3356,7 @@ name: mentor_info schema: public object_relationships: - - name: userByMentorUuid + - name: user using: foreign_key_constraint_on: mentor_uuid insert_permissions: @@ -3384,14 +3364,13 @@ permission: check: {} columns: - - mentor_id - - intro - - background - - field - achievement + - background - created_at - - updated_at + - field + - intro - mentor_uuid + - updated_at - role: teacher permission: check: @@ -3403,21 +3382,19 @@ - created_at - field - intro - - mentor_id - mentor_uuid - updated_at select_permissions: - role: counselor permission: columns: - - mentor_id - - created_at - - updated_at - - mentor_uuid - achievement - background + - created_at - field - intro + - mentor_uuid + - updated_at filter: {} allow_aggregations: true - role: student @@ -3427,7 +3404,6 @@ - background - field - intro - - mentor_id - mentor_uuid filter: {} - role: teacher @@ -3438,7 +3414,6 @@ - created_at - field - intro - - mentor_id - mentor_uuid - updated_at filter: @@ -3448,14 +3423,13 @@ - role: counselor permission: columns: - - mentor_id - - created_at - - updated_at - - mentor_uuid - achievement - background + - created_at - field - intro + - mentor_uuid + - updated_at filter: {} check: {} - role: teacher @@ -3481,13 +3455,6 @@ - table: name: mentor_message schema: public - object_relationships: - - name: from_userbyuuid - using: - foreign_key_constraint_on: from_uuid - - name: to_userbyuuid - using: - foreign_key_constraint_on: to_uuid insert_permissions: - role: student permission: @@ -3495,10 +3462,8 @@ from_uuid: _eq: X-Hasura-User-Id columns: - - from_id - from_uuid - payload - - to_id - to_uuid - role: teacher permission: @@ -3506,23 +3471,19 @@ from_uuid: _eq: X-Hasura-User-Id columns: - - from_id - from_uuid - payload - - to_id - to_uuid select_permissions: - role: student permission: columns: - - from_id - - payload - - to_id - created_at - - updated_at - from_uuid - id + - payload - to_uuid + - updated_at filter: _or: - from_uuid: @@ -3533,11 +3494,9 @@ permission: columns: - created_at - - from_id - from_uuid - id - payload - - to_id - to_uuid - updated_at filter: @@ -4060,7 +4019,6 @@ - department - email - github_id - - id - phone - realname - role @@ -4078,7 +4036,6 @@ - department - email - github_id - - id - phone - realname - role @@ -4096,7 +4053,6 @@ - department - email - github_id - - id - phone - realname - role @@ -4114,7 +4070,6 @@ - department - email - github_id - - id - phone - realname - role @@ -4132,7 +4087,6 @@ - department - email - github_id - - id - phone - realname - role @@ -4143,6 +4097,20 @@ - uuid filter: {} update_permissions: + - role: anonymous + permission: + columns: + - class + - department + - github_id + - phone + - realname + - student_no + - username + filter: + uuid: + _eq: X-Hasura-User-Id + check: null - role: counselor permission: columns: diff --git a/migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/down.sql b/migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/down.sql new file mode 100644 index 0000000..5a48354 --- /dev/null +++ b/migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/down.sql @@ -0,0 +1 @@ +alter table "public"."honor_application" alter column "student_uuid" drop not null; diff --git a/migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/up.sql b/migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/up.sql new file mode 100644 index 0000000..d91f131 --- /dev/null +++ b/migrations/1716781029624_alter_table_public_honor_application_alter_column_student_uuid/up.sql @@ -0,0 +1 @@ +alter table "public"."honor_application" alter column "student_uuid" set not null; diff --git a/migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/down.sql b/migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/down.sql new file mode 100644 index 0000000..ad62f5b --- /dev/null +++ b/migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/down.sql @@ -0,0 +1,2 @@ +alter table "public"."honor_application" alter column "student_id" drop not null; +alter table "public"."honor_application" add column "student_id" text; diff --git a/migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/up.sql b/migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/up.sql new file mode 100644 index 0000000..1420a1b --- /dev/null +++ b/migrations/1716781165593_alter_table_public_honor_application_drop_column_student_id/up.sql @@ -0,0 +1 @@ +alter table "public"."honor_application" drop column "student_id" cascade; diff --git a/migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/down.sql b/migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/down.sql new file mode 100644 index 0000000..9b5c797 --- /dev/null +++ b/migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "mentor_uuid" drop not null; diff --git a/migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/up.sql b/migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/up.sql new file mode 100644 index 0000000..6a1b958 --- /dev/null +++ b/migrations/1716781441705_alter_table_public_mentor_application_alter_column_mentor_uuid/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "mentor_uuid" set not null; diff --git a/migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/down.sql b/migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/down.sql new file mode 100644 index 0000000..c153d6a --- /dev/null +++ b/migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "student_uuid" drop not null; diff --git a/migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/up.sql b/migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/up.sql new file mode 100644 index 0000000..792955b --- /dev/null +++ b/migrations/1716781456647_alter_table_public_mentor_application_alter_column_student_uuid/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "student_uuid" set not null; diff --git a/migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/down.sql b/migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/down.sql new file mode 100644 index 0000000..ceec51c --- /dev/null +++ b/migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/down.sql @@ -0,0 +1,2 @@ +alter table "public"."mentor_application" alter column "mentor_id" drop not null; +alter table "public"."mentor_application" add column "mentor_id" text; diff --git a/migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/up.sql b/migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/up.sql new file mode 100644 index 0000000..b6e391a --- /dev/null +++ b/migrations/1716781593880_alter_table_public_mentor_application_drop_column_mentor_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" drop column "mentor_id" cascade; diff --git a/migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/down.sql b/migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/down.sql new file mode 100644 index 0000000..59bb509 --- /dev/null +++ b/migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/down.sql @@ -0,0 +1,2 @@ +alter table "public"."mentor_application" alter column "student_id" drop not null; +alter table "public"."mentor_application" add column "student_id" text; diff --git a/migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/up.sql b/migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/up.sql new file mode 100644 index 0000000..aeaef68 --- /dev/null +++ b/migrations/1716781613783_alter_table_public_mentor_application_drop_column_student_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" drop column "student_id" cascade; diff --git a/migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/down.sql b/migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/down.sql new file mode 100644 index 0000000..58cb5d0 --- /dev/null +++ b/migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/down.sql @@ -0,0 +1,2 @@ +alter table "public"."mentor_available" alter column "mentor_id" drop not null; +alter table "public"."mentor_available" add column "mentor_id" text; diff --git a/migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/up.sql b/migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/up.sql new file mode 100644 index 0000000..c0ae4b8 --- /dev/null +++ b/migrations/1716781905611_alter_table_public_mentor_available_drop_column_mentor_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_available" drop column "mentor_id" cascade; diff --git a/migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/down.sql b/migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/down.sql new file mode 100644 index 0000000..f45f961 --- /dev/null +++ b/migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/down.sql @@ -0,0 +1,3 @@ +comment on column "public"."mentor_info"."mentor_id" is E'新生导师信息'; +alter table "public"."mentor_info" alter column "mentor_id" drop not null; +alter table "public"."mentor_info" add column "mentor_id" text; diff --git a/migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/up.sql b/migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/up.sql new file mode 100644 index 0000000..d101435 --- /dev/null +++ b/migrations/1716782262682_alter_table_public_mentor_info_drop_column_mentor_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_info" drop column "mentor_id" cascade; diff --git a/migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/down.sql b/migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/down.sql new file mode 100644 index 0000000..5e93538 --- /dev/null +++ b/migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "from_uuid" drop not null; diff --git a/migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/up.sql b/migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/up.sql new file mode 100644 index 0000000..2649b0b --- /dev/null +++ b/migrations/1716782305099_alter_table_public_mentor_message_alter_column_from_uuid/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "from_uuid" set not null; diff --git a/migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/down.sql b/migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/down.sql new file mode 100644 index 0000000..6de2df9 --- /dev/null +++ b/migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "to_uuid" drop not null; diff --git a/migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/up.sql b/migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/up.sql new file mode 100644 index 0000000..777da50 --- /dev/null +++ b/migrations/1716782315609_alter_table_public_mentor_message_alter_column_to_uuid/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "to_uuid" set not null; diff --git a/migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/down.sql b/migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/down.sql new file mode 100644 index 0000000..bac9b82 --- /dev/null +++ b/migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/down.sql @@ -0,0 +1,2 @@ +alter table "public"."mentor_message" alter column "from_id" drop not null; +alter table "public"."mentor_message" add column "from_id" text; diff --git a/migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/up.sql b/migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/up.sql new file mode 100644 index 0000000..65778dd --- /dev/null +++ b/migrations/1716782479166_alter_table_public_mentor_message_drop_column_from_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" drop column "from_id" cascade; diff --git a/migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/down.sql b/migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/down.sql new file mode 100644 index 0000000..9dfe708 --- /dev/null +++ b/migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/down.sql @@ -0,0 +1,2 @@ +alter table "public"."mentor_message" alter column "to_id" drop not null; +alter table "public"."mentor_message" add column "to_id" text; diff --git a/migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/up.sql b/migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/up.sql new file mode 100644 index 0000000..859c4d0 --- /dev/null +++ b/migrations/1716782503129_alter_table_public_mentor_message_drop_column_to_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" drop column "to_id" cascade; diff --git a/migrations/1716783150254_alter_table_public_users_drop_column_id/down.sql b/migrations/1716783150254_alter_table_public_users_drop_column_id/down.sql new file mode 100644 index 0000000..415f13a --- /dev/null +++ b/migrations/1716783150254_alter_table_public_users_drop_column_id/down.sql @@ -0,0 +1,3 @@ +alter table "public"."users" add constraint "users_id_key" unique (id); +alter table "public"."users" alter column "id" drop not null; +alter table "public"."users" add column "id" text; diff --git a/migrations/1716783150254_alter_table_public_users_drop_column_id/up.sql b/migrations/1716783150254_alter_table_public_users_drop_column_id/up.sql new file mode 100644 index 0000000..4d4c065 --- /dev/null +++ b/migrations/1716783150254_alter_table_public_users_drop_column_id/up.sql @@ -0,0 +1 @@ +alter table "public"."users" drop column "id" cascade;