From 56498b94ec36d2e5e5703c3c86b50979277bcc88 Mon Sep 17 00:00:00 2001 From: final_deterrence Date: Tue, 8 Sep 2026 00:57:15 +0800 Subject: [PATCH 1/4] honor-new type --- metadata/tables.yaml | 4 ++++ .../down.sql | 1 + .../up.sql | 2 ++ .../down.sql | 2 ++ .../up.sql | 7 +++++++ .../down.sql | 11 +++++++++++ .../up.sql | 11 +++++++++++ 7 files changed, 38 insertions(+) create mode 100644 migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/down.sql create mode 100644 migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/up.sql create mode 100644 migrations/1788695507259_add_global_competence_honor_type/down.sql create mode 100644 migrations/1788695507259_add_global_competence_honor_type/up.sql create mode 100644 migrations/1788695507260_rename_global_competence_honor_type/down.sql create mode 100644 migrations/1788695507260_rename_global_competence_honor_type/up.sql diff --git a/metadata/tables.yaml b/metadata/tables.yaml index 28dd58c..4f92319 100644 --- a/metadata/tables.yaml +++ b/metadata/tables.yaml @@ -3062,6 +3062,7 @@ - statement - status - student_uuid + - transcript_url - year select_permissions: - role: counselor @@ -3074,6 +3075,7 @@ - statement - status - student_uuid + - transcript_url - updated_at - year filter: {} @@ -3087,6 +3089,7 @@ - statement - status - student_uuid + - transcript_url - updated_at - year filter: @@ -3108,6 +3111,7 @@ - statement - status - student_uuid + - transcript_url - year filter: student_uuid: diff --git a/migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/down.sql b/migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/down.sql new file mode 100644 index 0000000..1073cb6 --- /dev/null +++ b/migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/down.sql @@ -0,0 +1 @@ +alter table "public"."honor_application" drop column "transcript_url"; \ No newline at end of file diff --git a/migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/up.sql b/migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/up.sql new file mode 100644 index 0000000..1d86861 --- /dev/null +++ b/migrations/1788695507258_alter_table_public_honor_application_add_column_transcript_url/up.sql @@ -0,0 +1,2 @@ +alter table "public"."honor_application" add column "transcript_url" text + null; diff --git a/migrations/1788695507259_add_global_competence_honor_type/down.sql b/migrations/1788695507259_add_global_competence_honor_type/down.sql new file mode 100644 index 0000000..d851cc2 --- /dev/null +++ b/migrations/1788695507259_add_global_competence_honor_type/down.sql @@ -0,0 +1,2 @@ +DELETE FROM public.honor_type +WHERE type_name = '全球胜任力优秀奖'; diff --git a/migrations/1788695507259_add_global_competence_honor_type/up.sql b/migrations/1788695507259_add_global_competence_honor_type/up.sql new file mode 100644 index 0000000..2d868f4 --- /dev/null +++ b/migrations/1788695507259_add_global_competence_honor_type/up.sql @@ -0,0 +1,7 @@ +INSERT INTO public.honor_type (type_name) +SELECT '全球胜任力优秀奖' +WHERE NOT EXISTS ( + SELECT 1 + FROM public.honor_type + WHERE type_name IN ('全球胜任力优秀奖', '全球胜任力优秀奖学金/荣誉') +); diff --git a/migrations/1788695507260_rename_global_competence_honor_type/down.sql b/migrations/1788695507260_rename_global_competence_honor_type/down.sql new file mode 100644 index 0000000..fb42f13 --- /dev/null +++ b/migrations/1788695507260_rename_global_competence_honor_type/down.sql @@ -0,0 +1,11 @@ +DELETE FROM public.honor_type +WHERE type_name = '全球胜任力优秀奖' + AND EXISTS ( + SELECT 1 + FROM public.honor_type + WHERE type_name = '全球胜任力优秀奖学金/荣誉' + ); + +UPDATE public.honor_type +SET type_name = '全球胜任力优秀奖学金/荣誉' +WHERE type_name = '全球胜任力优秀奖'; diff --git a/migrations/1788695507260_rename_global_competence_honor_type/up.sql b/migrations/1788695507260_rename_global_competence_honor_type/up.sql new file mode 100644 index 0000000..54a25c2 --- /dev/null +++ b/migrations/1788695507260_rename_global_competence_honor_type/up.sql @@ -0,0 +1,11 @@ +DELETE FROM public.honor_type +WHERE type_name = '全球胜任力优秀奖学金/荣誉' + AND EXISTS ( + SELECT 1 + FROM public.honor_type + WHERE type_name = '全球胜任力优秀奖' + ); + +UPDATE public.honor_type +SET type_name = '全球胜任力优秀奖' +WHERE type_name = '全球胜任力优秀奖学金/荣誉'; From 78ba9299c2bd014e3800ae4356d66343cadc72b3 Mon Sep 17 00:00:00 2001 From: final_deterrence Date: Mon, 14 Sep 2026 15:56:47 +0800 Subject: [PATCH 2/4] honor-fix --- metadata/tables.yaml | 4 ++++ .../down.sql | 7 +++++++ .../up.sql | 9 +++++++++ .../1789368152503_remove_no_school_honor_type/down.sql | 3 +++ .../1789368152503_remove_no_school_honor_type/up.sql | 2 ++ 5 files changed, 25 insertions(+) create mode 100644 migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/down.sql create mode 100644 migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/up.sql create mode 100644 migrations/1789368152503_remove_no_school_honor_type/down.sql create mode 100644 migrations/1789368152503_remove_no_school_honor_type/up.sql diff --git a/metadata/tables.yaml b/metadata/tables.yaml index 4f92319..9b21c9f 100644 --- a/metadata/tables.yaml +++ b/metadata/tables.yaml @@ -3057,6 +3057,7 @@ student_uuid: _eq: X-Hasura-User-Id columns: + - application_form_url - attachment_url - honor - statement @@ -3068,6 +3069,7 @@ - role: counselor permission: columns: + - application_form_url - attachment_url - created_at - honor @@ -3082,6 +3084,7 @@ - role: student permission: columns: + - application_form_url - attachment_url - created_at - honor @@ -3106,6 +3109,7 @@ - role: student permission: columns: + - application_form_url - attachment_url - honor - statement diff --git a/migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/down.sql b/migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/down.sql new file mode 100644 index 0000000..5788c50 --- /dev/null +++ b/migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/down.sql @@ -0,0 +1,7 @@ +UPDATE "public"."honor_application" +SET "attachment_url" = "application_form_url" +WHERE "attachment_url" IS NULL + AND "application_form_url" IS NOT NULL; + +ALTER TABLE "public"."honor_application" +DROP COLUMN "application_form_url"; diff --git a/migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/up.sql b/migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/up.sql new file mode 100644 index 0000000..8c48ec8 --- /dev/null +++ b/migrations/1789368152502_alter_table_public_honor_application_add_column_application_form_url/up.sql @@ -0,0 +1,9 @@ +ALTER TABLE "public"."honor_application" +ADD COLUMN "application_form_url" text NULL; + +UPDATE "public"."honor_application" +SET + "application_form_url" = "attachment_url", + "attachment_url" = NULL +WHERE "application_form_url" IS NULL + AND "attachment_url" ~ '^honor_application/[^/]+/[0-9]{4}/application_form/'; diff --git a/migrations/1789368152503_remove_no_school_honor_type/down.sql b/migrations/1789368152503_remove_no_school_honor_type/down.sql new file mode 100644 index 0000000..5242dce --- /dev/null +++ b/migrations/1789368152503_remove_no_school_honor_type/down.sql @@ -0,0 +1,3 @@ +INSERT INTO "public"."honor_type" ("type_name") +VALUES ('无校级荣誉') +ON CONFLICT ("type_name") DO NOTHING; diff --git a/migrations/1789368152503_remove_no_school_honor_type/up.sql b/migrations/1789368152503_remove_no_school_honor_type/up.sql new file mode 100644 index 0000000..836bb85 --- /dev/null +++ b/migrations/1789368152503_remove_no_school_honor_type/up.sql @@ -0,0 +1,2 @@ +DELETE FROM "public"."honor_type" +WHERE "type_name" = '无校级荣誉'; From 4ea8034d7317fd05a6a623b4df410bc1f8b7cada Mon Sep 17 00:00:00 2001 From: final_deterrence Date: Mon, 14 Sep 2026 16:34:48 +0800 Subject: [PATCH 3/4] feat: add good reading honor type --- migrations/1789374472550_add_good_reading_honor_type/down.sql | 2 ++ migrations/1789374472550_add_good_reading_honor_type/up.sql | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 migrations/1789374472550_add_good_reading_honor_type/down.sql create mode 100644 migrations/1789374472550_add_good_reading_honor_type/up.sql diff --git a/migrations/1789374472550_add_good_reading_honor_type/down.sql b/migrations/1789374472550_add_good_reading_honor_type/down.sql new file mode 100644 index 0000000..a8e3588 --- /dev/null +++ b/migrations/1789374472550_add_good_reading_honor_type/down.sql @@ -0,0 +1,2 @@ +DELETE FROM public.honor_type +WHERE type_name = '好读书奖'; diff --git a/migrations/1789374472550_add_good_reading_honor_type/up.sql b/migrations/1789374472550_add_good_reading_honor_type/up.sql new file mode 100644 index 0000000..ef358a9 --- /dev/null +++ b/migrations/1789374472550_add_good_reading_honor_type/up.sql @@ -0,0 +1,3 @@ +INSERT INTO public.honor_type (type_name) +VALUES ('好读书奖') +ON CONFLICT (type_name) DO NOTHING; From 0bba9a9df2411455110bdc19d658462a413ebd5e Mon Sep 17 00:00:00 2001 From: final_deterrence Date: Wed, 16 Sep 2026 23:15:24 +0800 Subject: [PATCH 4/4] delete haodushu honor --- .../1789571455939_remove_good_reading_honor_type/down.sql | 3 +++ migrations/1789571455939_remove_good_reading_honor_type/up.sql | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 migrations/1789571455939_remove_good_reading_honor_type/down.sql create mode 100644 migrations/1789571455939_remove_good_reading_honor_type/up.sql diff --git a/migrations/1789571455939_remove_good_reading_honor_type/down.sql b/migrations/1789571455939_remove_good_reading_honor_type/down.sql new file mode 100644 index 0000000..ef358a9 --- /dev/null +++ b/migrations/1789571455939_remove_good_reading_honor_type/down.sql @@ -0,0 +1,3 @@ +INSERT INTO public.honor_type (type_name) +VALUES ('好读书奖') +ON CONFLICT (type_name) DO NOTHING; diff --git a/migrations/1789571455939_remove_good_reading_honor_type/up.sql b/migrations/1789571455939_remove_good_reading_honor_type/up.sql new file mode 100644 index 0000000..a8e3588 --- /dev/null +++ b/migrations/1789571455939_remove_good_reading_honor_type/up.sql @@ -0,0 +1,2 @@ +DELETE FROM public.honor_type +WHERE type_name = '好读书奖';