From 8e96f2798f665e1b63d368e53fab9f6b1f02c6f6 Mon Sep 17 00:00:00 2001 From: xiangmy21 <2248278431@qq.com> Date: Mon, 4 Mar 2024 01:10:47 +0800 Subject: [PATCH] refact(mentor): mentor info, message. id->uuid --- metadata/tables.yaml | 14 ++++++++++++++ .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 1 + .../up.sql | 1 + .../down.sql | 4 ++++ .../up.sql | 6 ++++++ .../down.sql | 1 + .../up.sql | 1 + 13 files changed, 34 insertions(+) create mode 100644 migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/down.sql create mode 100644 migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/up.sql create mode 100644 migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/down.sql create mode 100644 migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/up.sql create mode 100644 migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/down.sql create mode 100644 migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/up.sql create mode 100644 migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/down.sql create mode 100644 migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/up.sql create mode 100644 migrations/1709485179476_modify_primarykey_public_mentor_info/down.sql create mode 100644 migrations/1709485179476_modify_primarykey_public_mentor_info/up.sql create mode 100644 migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/down.sql create mode 100644 migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/up.sql diff --git a/metadata/tables.yaml b/metadata/tables.yaml index 25850db..63f4624 100644 --- a/metadata/tables.yaml +++ b/metadata/tables.yaml @@ -2796,6 +2796,20 @@ name: mentor_available schema: public array_relationships: + - name: contest_team_members + using: + foreign_key_constraint_on: + column: user_id + table: + name: contest_team_member + schema: public + - name: contest_teams + using: + foreign_key_constraint_on: + column: team_leader + table: + name: contest_team + schema: public - name: mentor_applications_mentor using: foreign_key_constraint_on: diff --git a/migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/down.sql b/migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/down.sql new file mode 100644 index 0000000..647e5fd --- /dev/null +++ b/migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "from_id" set not null; diff --git a/migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/up.sql b/migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/up.sql new file mode 100644 index 0000000..3164ad5 --- /dev/null +++ b/migrations/1709484224781_alter_table_public_mentor_message_alter_column_from_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "from_id" drop not null; diff --git a/migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/down.sql b/migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/down.sql new file mode 100644 index 0000000..e984697 --- /dev/null +++ b/migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "to_id" set not null; diff --git a/migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/up.sql b/migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/up.sql new file mode 100644 index 0000000..d586e97 --- /dev/null +++ b/migrations/1709484231334_alter_table_public_mentor_message_alter_column_to_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_message" alter column "to_id" drop not null; diff --git a/migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/down.sql b/migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/down.sql new file mode 100644 index 0000000..55a0aad --- /dev/null +++ b/migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "mentor_id" set not null; diff --git a/migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/up.sql b/migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/up.sql new file mode 100644 index 0000000..522d86f --- /dev/null +++ b/migrations/1709484444605_alter_table_public_mentor_application_alter_column_mentor_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "mentor_id" drop not null; diff --git a/migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/down.sql b/migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/down.sql new file mode 100644 index 0000000..d2662b0 --- /dev/null +++ b/migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "student_id" set not null; diff --git a/migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/up.sql b/migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/up.sql new file mode 100644 index 0000000..c93019a --- /dev/null +++ b/migrations/1709484449866_alter_table_public_mentor_application_alter_column_student_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_application" alter column "student_id" drop not null; diff --git a/migrations/1709485179476_modify_primarykey_public_mentor_info/down.sql b/migrations/1709485179476_modify_primarykey_public_mentor_info/down.sql new file mode 100644 index 0000000..e152445 --- /dev/null +++ b/migrations/1709485179476_modify_primarykey_public_mentor_info/down.sql @@ -0,0 +1,4 @@ +alter table "public"."mentor_info" drop constraint "mentor_info_pkey"; +alter table "public"."mentor_info" + add constraint "mentor_info_pkey" + primary key ("mentor_id"); diff --git a/migrations/1709485179476_modify_primarykey_public_mentor_info/up.sql b/migrations/1709485179476_modify_primarykey_public_mentor_info/up.sql new file mode 100644 index 0000000..d0234eb --- /dev/null +++ b/migrations/1709485179476_modify_primarykey_public_mentor_info/up.sql @@ -0,0 +1,6 @@ +BEGIN TRANSACTION; +ALTER TABLE "public"."mentor_info" DROP CONSTRAINT "mentor_info_pkey"; + +ALTER TABLE "public"."mentor_info" + ADD CONSTRAINT "mentor_info_pkey" PRIMARY KEY ("mentor_uuid"); +COMMIT TRANSACTION; diff --git a/migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/down.sql b/migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/down.sql new file mode 100644 index 0000000..fdcf6b9 --- /dev/null +++ b/migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/down.sql @@ -0,0 +1 @@ +alter table "public"."mentor_info" alter column "mentor_id" set not null; diff --git a/migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/up.sql b/migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/up.sql new file mode 100644 index 0000000..60883d0 --- /dev/null +++ b/migrations/1709485190641_alter_table_public_mentor_info_alter_column_mentor_id/up.sql @@ -0,0 +1 @@ +alter table "public"."mentor_info" alter column "mentor_id" drop not null;