diff --git a/package.json b/package.json index 8a3be446..6abb6e10 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,15 @@ "start:dev": "NODE_ENV=dev nest start --config src/bootstrap/nest-cli.json", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", - "prisma-push:local": "dotenv -e env/.env.local -- npx prisma db push", - "prisma-push:dev": "dotenv -e env/.env.dev -- npx prisma db push", - "prisma-pull:local": "dotenv -e env/.env.local -- npx prisma db pull --schema src/prisma/schema.prisma", - "prisma-pull:dev": "dotenv -e env/.env.dev -- npx prisma db pull --schema src/prisma/schema.prisma", - "prisma-migrate-create-dev:local": "dotenv -e env/.env.local -- npx prisma migrate dev --schema src/prisma/schema.prisma --create-only ", - "prisma-migrate-dev:local": "dotenv -e env/.env.local -- npx prisma migrate dev --schema src/prisma/schema.prisma", - "prisma-migrate-dev:dev": "dotenv -e env/.env.dev -- npx prisma migrate dev --schema src/prisma/schema.prisma", - "prisma-generate": "npx prisma generate --schema src/prisma/schema.prisma", - "prisma-status:local": "dotenv -e env/.env.local npx prisma migrate status", - "prisma-status:dev": "dotenv -e env/.env.dev npx prisma migrate status", - "prisma-resolve:local": "dotenv -e env/.env.local npx prisma migrate resolve", - "prisma-resolve:dev": "dotenv -e env/.env.dev npx prisma migrate resolve", + "db:push": "dotenv -e env/.env.local -- npx prisma db push", + "db:pull": "dotenv -e env/.env.local -- npx prisma db pull --schema src/prisma/schema.prisma", + "db:init": "dotenv -e env/.env.local -- npx prisma db execute --file src/prisma/migrations/0_init/migration.sql --schema src/prisma/schema.prisma && dotenv -e env/.env.local npx prisma migrate resolve --applied 0_init", + "migrate:dev-create": "dotenv -e env/.env.local -- npx prisma migrate dev --schema src/prisma/schema.prisma --create-only ", + "migrate:dev": "dotenv -e env/.env.local -- npx prisma migrate dev --schema src/prisma/schema.prisma", + "migrate:deploy": "dotenv -e env/.env.local -- npx prisma migrate deploy --schema src/prisma/schema.prisma", + "migrate:status": "dotenv -e env/.env.local npx prisma migrate status", + "migrate:resolve": "dotenv -e env/.env.local npx prisma migrate resolve '--applied' '0_init'", + "client:generate": "npx prisma generate --schema src/prisma/schema.prisma", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "lint:check": "eslint .", "test": "jest", diff --git a/src/prisma/migrations/0_init/migration.sql b/src/prisma/migrations/0_init/migration.sql index 2486e3f0..09a863f9 100644 --- a/src/prisma/migrations/0_init/migration.sql +++ b/src/prisma/migrations/0_init/migration.sql @@ -1,10 +1,25 @@ +-- CreateTable +create table _prisma_migrations +( + id varchar(36) not null + primary key, + checksum varchar(64) not null, + finished_at datetime(3) null, + migration_name varchar(255) not null, + logs text null, + rolled_back_at datetime(3) null, + started_at datetime(3) default CURRENT_TIMESTAMP(3) not null, + applied_steps_count int unsigned default 0 not null +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + + -- CreateTable CREATE TABLE `auth_group` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `name` VARCHAR(150) NOT NULL, - UNIQUE INDEX `name`(`name` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `name`(`name`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -13,9 +28,9 @@ CREATE TABLE `auth_group_permissions` ( `group_id` INTEGER NOT NULL, `permission_id` INTEGER NOT NULL, - INDEX `auth_group__permission_id_1f49ccbbdc69d2fc_fk_auth_permission_id`(`permission_id` ASC), - UNIQUE INDEX `group_id`(`group_id` ASC, `permission_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `auth_group__permission_id_1f49ccbbdc69d2fc_fk_auth_permission_id`(`permission_id`), + UNIQUE INDEX `group_id`(`group_id`, `permission_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -25,8 +40,8 @@ CREATE TABLE `auth_permission` ( `content_type_id` INTEGER NOT NULL, `codename` VARCHAR(100) NOT NULL, - UNIQUE INDEX `content_type_id`(`content_type_id` ASC, `codename` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `content_type_id`(`content_type_id`, `codename`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -43,8 +58,8 @@ CREATE TABLE `auth_user` ( `is_active` BOOLEAN NOT NULL, `date_joined` DATETIME(0) NOT NULL, - UNIQUE INDEX `username`(`username` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `username`(`username`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -53,9 +68,9 @@ CREATE TABLE `auth_user_groups` ( `user_id` INTEGER NOT NULL, `group_id` INTEGER NOT NULL, - INDEX `auth_user_groups_group_id_33ac548dcf5f8e37_fk_auth_group_id`(`group_id` ASC), - UNIQUE INDEX `user_id`(`user_id` ASC, `group_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `auth_user_groups_group_id_33ac548dcf5f8e37_fk_auth_group_id`(`group_id`), + UNIQUE INDEX `user_id`(`user_id`, `group_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -64,9 +79,9 @@ CREATE TABLE `auth_user_user_permissions` ( `user_id` INTEGER NOT NULL, `permission_id` INTEGER NOT NULL, - INDEX `auth_user_u_permission_id_384b62483d7071f0_fk_auth_permission_id`(`permission_id` ASC), - UNIQUE INDEX `user_id`(`user_id` ASC, `permission_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `auth_user_u_permission_id_384b62483d7071f0_fk_auth_permission_id`(`permission_id`), + UNIQUE INDEX `user_id`(`user_id`, `permission_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -80,9 +95,9 @@ CREATE TABLE `django_admin_log` ( `content_type_id` INTEGER NULL, `user_id` INTEGER NOT NULL, - INDEX `djang_content_type_id_697914295151027a_fk_django_content_type_id`(`content_type_id` ASC), - INDEX `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id`(`user_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `djang_content_type_id_697914295151027a_fk_django_content_type_id`(`content_type_id`), + INDEX `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id`(`user_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -91,8 +106,8 @@ CREATE TABLE `django_content_type` ( `app_label` VARCHAR(100) NOT NULL, `model` VARCHAR(100) NOT NULL, - UNIQUE INDEX `django_content_type_app_label_45f3b1d93ec8c61c_uniq`(`app_label` ASC, `model` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `django_content_type_app_label_45f3b1d93ec8c61c_uniq`(`app_label`, `model`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -102,7 +117,7 @@ CREATE TABLE `django_migrations` ( `name` VARCHAR(255) NOT NULL, `applied` DATETIME(0) NOT NULL, - PRIMARY KEY (`id` ASC) + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -111,70 +126,8 @@ CREATE TABLE `django_session` ( `session_data` LONGTEXT NOT NULL, `expire_date` DATETIME(0) NOT NULL, - INDEX `django_session_de54fa62`(`expire_date` ASC), - PRIMARY KEY (`session_key` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `graduation_additionaltrack` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `start_year` INTEGER NOT NULL, - `end_year` INTEGER NOT NULL, - `type` VARCHAR(32) NOT NULL, - `major_required` INTEGER NOT NULL, - `major_elective` INTEGER NOT NULL, - `department_id` INTEGER NULL, - - INDEX `graduation_additiona_department_id_788c5289_fk_subject_d`(`department_id` ASC), - UNIQUE INDEX `graduation_additionaltra_end_year_type_department_9d873c1b_uniq`(`end_year` ASC, `type` ASC, `department_id` ASC), - UNIQUE INDEX `graduation_additionaltra_start_year_type_departme_763552eb_uniq`(`start_year` ASC, `type` ASC, `department_id` ASC), - INDEX `graduation_additionaltrack_end_year_6af1030b`(`end_year` ASC), - INDEX `graduation_additionaltrack_start_year_7a87318d`(`start_year` ASC), - INDEX `graduation_additionaltrack_type_0fa38fc5`(`type` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `graduation_generaltrack` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `start_year` INTEGER NOT NULL, - `end_year` INTEGER NOT NULL, - `is_foreign` BOOLEAN NOT NULL, - `total_credit` INTEGER NOT NULL, - `total_au` INTEGER NOT NULL, - `basic_required` INTEGER NOT NULL, - `basic_elective` INTEGER NOT NULL, - `thesis_study` INTEGER NOT NULL, - `thesis_study_doublemajor` INTEGER NOT NULL, - `general_required_credit` INTEGER NOT NULL, - `general_required_au` INTEGER NOT NULL, - `humanities` INTEGER NOT NULL, - `humanities_doublemajor` INTEGER NOT NULL, - - INDEX `graduation_generaltrack_end_year_3bba699e`(`end_year` ASC), - UNIQUE INDEX `graduation_generaltrack_end_year_is_foreign_1f062f8b_uniq`(`end_year` ASC, `is_foreign` ASC), - INDEX `graduation_generaltrack_is_foreign_d38919a2`(`is_foreign` ASC), - INDEX `graduation_generaltrack_start_year_00aee782`(`start_year` ASC), - UNIQUE INDEX `graduation_generaltrack_start_year_is_foreign_c1eb425f_uniq`(`start_year` ASC, `is_foreign` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `graduation_majortrack` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `start_year` INTEGER NOT NULL, - `end_year` INTEGER NOT NULL, - `basic_elective_doublemajor` INTEGER NOT NULL, - `major_required` INTEGER NOT NULL, - `major_elective` INTEGER NOT NULL, - `department_id` INTEGER NOT NULL, - - INDEX `graduation_majortrac_department_id_81bfc8fa_fk_subject_d`(`department_id` ASC), - INDEX `graduation_majortrack_end_year_57017559`(`end_year` ASC), - UNIQUE INDEX `graduation_majortrack_end_year_department_id_b3ef1bc8_uniq`(`end_year` ASC, `department_id` ASC), - INDEX `graduation_majortrack_start_year_6281dc28`(`start_year` ASC), - UNIQUE INDEX `graduation_majortrack_start_year_department_id_59122c6d_uniq`(`start_year` ASC, `department_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `django_session_de54fa62`(`expire_date`), + PRIMARY KEY (`session_key`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -184,8 +137,8 @@ CREATE TABLE `main_famoushumanityreviewdailyfeed` ( `priority` DOUBLE NOT NULL, `visible` BOOLEAN NOT NULL, - UNIQUE INDEX `main_famoushumanityreviewdailyfeed_date_0fbb607a_uniq`(`date` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `main_famoushumanityreviewdailyfeed_date_0fbb607a_uniq`(`date`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -194,9 +147,9 @@ CREATE TABLE `main_famoushumanityreviewdailyfeed_reviews` ( `famoushumanityreviewdailyfeed_id` INTEGER NOT NULL, `review_id` INTEGER NOT NULL, - UNIQUE INDEX `main_famoushumani_famoushumanityreviewdailyfeed_id_97def4df_uniq`(`famoushumanityreviewdailyfeed_id` ASC, `review_id` ASC), - INDEX `main_famoushumanityreview_review_id_f305d8aa_fk_review_review_id`(`review_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `main_famoushumanityreview_review_id_f305d8aa_fk_review_review_id`(`review_id`), + UNIQUE INDEX `main_famoushumani_famoushumanityreviewdailyfeed_id_97def4df_uniq`(`famoushumanityreviewdailyfeed_id`, `review_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -207,9 +160,9 @@ CREATE TABLE `main_famousmajorreviewdailyfeed` ( `department_id` INTEGER NOT NULL, `visible` BOOLEAN NOT NULL, - INDEX `main_famousmajorrevi_department_id_a0a5a3a5_fk_subject_d`(`department_id` ASC), - UNIQUE INDEX `main_famousreviewdailyfeed_date_94cf00dd_uniq`(`date` ASC, `department_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `main_famousmajorrevi_department_id_a0a5a3a5_fk_subject_d`(`department_id`), + UNIQUE INDEX `main_famousreviewdailyfeed_date_94cf00dd_uniq`(`date`, `department_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -218,9 +171,9 @@ CREATE TABLE `main_famousmajorreviewdailyfeed_reviews` ( `famousmajorreviewdailyfeed_id` INTEGER NOT NULL, `review_id` INTEGER NOT NULL, - INDEX `main_famousmajorreviewdai_review_id_c0d3bbec_fk_review_review_id`(`review_id` ASC), - UNIQUE INDEX `main_famousreviewdailyfee_famousreviewdailyfeed_id_12d71d0b_uniq`(`famousmajorreviewdailyfeed_id` ASC, `review_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `main_famousmajorreviewdai_review_id_c0d3bbec_fk_review_review_id`(`review_id`), + UNIQUE INDEX `main_famousreviewdailyfee_famousreviewdailyfeed_id_12d71d0b_uniq`(`famousmajorreviewdailyfeed_id`, `review_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -231,9 +184,9 @@ CREATE TABLE `main_rankedreviewdailyfeed` ( `visible` BOOLEAN NOT NULL, `semester_id` INTEGER NULL, - INDEX `main_rankedreviewdai_semester_id_f71e3a66_fk_subject_s`(`semester_id` ASC), - UNIQUE INDEX `main_rankedreviewdailyfeed_date_635bca2a_uniq`(`date` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `main_rankedreviewdailyfeed_date_635bca2a_uniq`(`date`), + INDEX `main_rankedreviewdai_semester_id_f71e3a66_fk_subject_s`(`semester_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -244,9 +197,9 @@ CREATE TABLE `main_ratedailyuserfeed` ( `visible` BOOLEAN NOT NULL, `user_id` INTEGER NOT NULL, - INDEX `main_ratedailyuserfe_user_id_31a534d5_fk_session_u`(`user_id` ASC), - UNIQUE INDEX `main_ratedailyuserfeed_date_user_id_4142794f_uniq`(`date` ASC, `user_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `main_ratedailyuserfe_user_id_31a534d5_fk_session_u`(`user_id`), + UNIQUE INDEX `main_ratedailyuserfeed_date_user_id_4142794f_uniq`(`date`, `user_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -258,10 +211,10 @@ CREATE TABLE `main_relatedcoursedailyuserfeed` ( `user_id` INTEGER NOT NULL, `visible` BOOLEAN NOT NULL, - INDEX `main_relatedcourseda_course_id_129fc5e2_fk_subject_c`(`course_id` ASC), - INDEX `main_relatedcoursedai_user_id_a1be2390_fk_session_userprofile_id`(`user_id` ASC), - UNIQUE INDEX `main_relatedcoursedailyuserfeed_date_6043d8bb_uniq`(`date` ASC, `user_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `main_relatedcourseda_course_id_129fc5e2_fk_subject_c`(`course_id`), + INDEX `main_relatedcoursedai_user_id_a1be2390_fk_session_userprofile_id`(`user_id`), + UNIQUE INDEX `main_relatedcoursedailyuserfeed_date_6043d8bb_uniq`(`date`, `user_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -273,102 +226,24 @@ CREATE TABLE `main_reviewwritedailyuserfeed` ( `user_id` INTEGER NOT NULL, `visible` BOOLEAN NOT NULL, - INDEX `main_reviewwritedail_lecture_id_75ed0f87_fk_subject_l`(`lecture_id` ASC), - INDEX `main_reviewwritedaily_user_id_9ffd0881_fk_session_userprofile_id`(`user_id` ASC), - UNIQUE INDEX `main_reviewwritedailyuserfeed_date_1e7bc6d7_uniq`(`date` ASC, `user_id` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `planner_arbitraryplanneritem` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `is_excluded` BOOLEAN NOT NULL, - `year` INTEGER NOT NULL, - `semester` INTEGER NOT NULL, - `type` VARCHAR(12) NOT NULL, - `type_en` VARCHAR(36) NOT NULL, - `credit` INTEGER NOT NULL, - `credit_au` INTEGER NOT NULL, - `department_id` INTEGER NULL, - `planner_id` INTEGER NOT NULL, - - INDEX `planner_arbitrarypla_department_id_0dc7ce25_fk_subject_d`(`department_id` ASC), - INDEX `planner_arbitrarypla_planner_id_d6069d2c_fk_planner_p`(`planner_id` ASC), - INDEX `planner_arbitraryplanneritem_semester_7508baa5`(`semester` ASC), - INDEX `planner_arbitraryplanneritem_year_5a0c7252`(`year` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `planner_futureplanneritem` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `is_excluded` BOOLEAN NOT NULL, - `year` INTEGER NOT NULL, - `semester` INTEGER NOT NULL, - `course_id` INTEGER NOT NULL, - `planner_id` INTEGER NOT NULL, - - INDEX `planner_futureplanne_course_id_b1a06444_fk_subject_c`(`course_id` ASC), - INDEX `planner_futureplanne_planner_id_dfd70193_fk_planner_p`(`planner_id` ASC), - INDEX `planner_futureplanneritem_semester_cda6512e`(`semester` ASC), - INDEX `planner_futureplanneritem_year_5e3a2d4e`(`year` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `planner_planner` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `start_year` INTEGER NOT NULL, - `end_year` INTEGER NOT NULL, - `arrange_order` SMALLINT NOT NULL, - `general_track_id` INTEGER NOT NULL, - `major_track_id` INTEGER NOT NULL, - `user_id` INTEGER NOT NULL, - - INDEX `planner_planner_arrange_order_e50a3044`(`arrange_order` ASC), - INDEX `planner_planner_end_year_e5fab7f3`(`end_year` ASC), - INDEX `planner_planner_general_track_id_6d607973_fk_graduatio`(`general_track_id` ASC), - INDEX `planner_planner_major_track_id_9f7204bd_fk_graduatio`(`major_track_id` ASC), - INDEX `planner_planner_start_year_463173f3`(`start_year` ASC), - INDEX `planner_planner_user_id_17740247_fk_session_userprofile_id`(`user_id` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `planner_planner_additional_tracks` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `planner_id` INTEGER NOT NULL, - `additionaltrack_id` INTEGER NOT NULL, - - INDEX `planner_planner_addi_additionaltrack_id_c46b8c4e_fk_graduatio`(`additionaltrack_id` ASC), - UNIQUE INDEX `planner_planner_addition_planner_id_additionaltra_2298c5cd_uniq`(`planner_id` ASC, `additionaltrack_id` ASC), - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `planner_takenplanneritem` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `is_excluded` BOOLEAN NOT NULL, - `lecture_id` INTEGER NOT NULL, - `planner_id` INTEGER NOT NULL, - - INDEX `planner_takenplanner_lecture_id_9b2d30d8_fk_subject_l`(`lecture_id` ASC), - UNIQUE INDEX `planner_takenplanneritem_planner_id_lecture_id_4b39b432_uniq`(`planner_id` ASC, `lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `main_reviewwritedail_lecture_id_75ed0f87_fk_subject_l`(`lecture_id`), + INDEX `main_reviewwritedaily_user_id_9ffd0881_fk_session_userprofile_id`(`user_id`), + UNIQUE INDEX `main_reviewwritedailyuserfeed_date_1e7bc6d7_uniq`(`date`, `user_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable CREATE TABLE `review_humanitybestreview` ( `review_id` INTEGER NOT NULL, - PRIMARY KEY (`review_id` ASC) + PRIMARY KEY (`review_id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable CREATE TABLE `review_majorbestreview` ( `review_id` INTEGER NOT NULL, - PRIMARY KEY (`review_id` ASC) + PRIMARY KEY (`review_id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -387,9 +262,9 @@ CREATE TABLE `review_review` ( `is_deleted` INTEGER NOT NULL, `written_datetime` DATETIME(0) NULL, - INDEX `review_comment_e5e30a4a`(`written_datetime` ASC), - UNIQUE INDEX `review_comment_writer_id_af700a5d_uniq`(`writer_id` ASC, `lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `review_comment_e5e30a4a`(`written_datetime`), + UNIQUE INDEX `review_comment_writer_id_af700a5d_uniq`(`writer_id`, `lecture_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -399,9 +274,9 @@ CREATE TABLE `review_reviewvote` ( `userprofile_id` INTEGER NULL, `created_datetime` DATETIME(6) NULL, - UNIQUE INDEX `review_commentvote_comment_id_e4594aea_uniq`(`review_id` ASC, `userprofile_id` ASC), - INDEX `review_reviewvote_created_datetime_450f85e2`(`created_datetime` ASC), - PRIMARY KEY (`id` ASC) + INDEX `review_reviewvote_created_datetime_450f85e2`(`created_datetime`), + UNIQUE INDEX `review_commentvote_comment_id_e4594aea_uniq`(`review_id`, `userprofile_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -415,8 +290,8 @@ CREATE TABLE `session_userprofile` ( `department_id` INTEGER NULL, `email` VARCHAR(255) NULL, - UNIQUE INDEX `session_userprofile_user_id_09dd6af1_uniq`(`user_id` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `session_userprofile_user_id_09dd6af1_uniq`(`user_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -425,8 +300,8 @@ CREATE TABLE `session_userprofile_favorite_departments` ( `userprofile_id` INTEGER NOT NULL, `department_id` INTEGER NOT NULL, - UNIQUE INDEX `userprofile_id`(`userprofile_id` ASC, `department_id` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `userprofile_id`(`userprofile_id`, `department_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -435,9 +310,9 @@ CREATE TABLE `session_userprofile_majors` ( `userprofile_id` INTEGER NOT NULL, `department_id` INTEGER NOT NULL, - INDEX `session_userprof_department_id_db568678_fk_subject_department_id`(`department_id` ASC), - UNIQUE INDEX `session_userprofile_majors_userprofile_id_12b76c49_uniq`(`userprofile_id` ASC, `department_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `session_userprof_department_id_db568678_fk_subject_department_id`(`department_id`), + UNIQUE INDEX `session_userprofile_majors_userprofile_id_12b76c49_uniq`(`userprofile_id`, `department_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -446,9 +321,9 @@ CREATE TABLE `session_userprofile_minors` ( `userprofile_id` INTEGER NOT NULL, `department_id` INTEGER NOT NULL, - INDEX `session_userprof_department_id_7a7ea3ed_fk_subject_department_id`(`department_id` ASC), - UNIQUE INDEX `session_userprofile_minors_userprofile_id_d01e3e38_uniq`(`userprofile_id` ASC, `department_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `session_userprof_department_id_7a7ea3ed_fk_subject_department_id`(`department_id`), + UNIQUE INDEX `session_userprofile_minors_userprofile_id_d01e3e38_uniq`(`userprofile_id`, `department_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -457,9 +332,9 @@ CREATE TABLE `session_userprofile_specialized_major` ( `userprofile_id` INTEGER NOT NULL, `department_id` INTEGER NOT NULL, - INDEX `session_userprof_department_id_919e11be_fk_subject_department_id`(`department_id` ASC), - UNIQUE INDEX `session_userprofile_specialized_maj_userprofile_id_3951a553_uniq`(`userprofile_id` ASC, `department_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `session_userprof_department_id_919e11be_fk_subject_department_id`(`department_id`), + UNIQUE INDEX `session_userprofile_specialized_maj_userprofile_id_3951a553_uniq`(`userprofile_id`, `department_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -468,8 +343,8 @@ CREATE TABLE `session_userprofile_taken_lectures` ( `userprofile_id` INTEGER NOT NULL, `lecture_id` INTEGER NOT NULL, - UNIQUE INDEX `userprofile_id`(`userprofile_id` ASC, `lecture_id` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `userprofile_id`(`userprofile_id`, `lecture_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -486,8 +361,8 @@ CREATE TABLE `subject_classtime` ( `unit_time` SMALLINT NULL, `lecture_id` INTEGER NULL, - INDEX `subject_classtime_72a11f01`(`lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_classtime_72a11f01`(`lecture_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -509,7 +384,7 @@ CREATE TABLE `subject_course` ( `speech` DOUBLE NOT NULL, `latest_written_datetime` DATETIME(0) NULL, - PRIMARY KEY (`id` ASC) + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -518,8 +393,8 @@ CREATE TABLE `subject_course_professors` ( `course_id` INTEGER NOT NULL, `professor_id` INTEGER NOT NULL, - UNIQUE INDEX `course_id`(`course_id` ASC, `professor_id` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `course_id`(`course_id`, `professor_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -528,9 +403,9 @@ CREATE TABLE `subject_course_related_courses_posterior` ( `from_course_id` INTEGER NOT NULL, `to_course_id` INTEGER NOT NULL, - INDEX `subject_course_relat_to_course_id_5fbd4d28_fk_subject_c`(`to_course_id` ASC), - UNIQUE INDEX `subject_course_related_c_from_course_id_to_course_eaec2f22_uniq`(`from_course_id` ASC, `to_course_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_course_relat_to_course_id_5fbd4d28_fk_subject_c`(`to_course_id`), + UNIQUE INDEX `subject_course_related_c_from_course_id_to_course_eaec2f22_uniq`(`from_course_id`, `to_course_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -539,9 +414,9 @@ CREATE TABLE `subject_course_related_courses_prior` ( `from_course_id` INTEGER NOT NULL, `to_course_id` INTEGER NOT NULL, - INDEX `subject_course_relat_to_course_id_52f44705_fk_subject_c`(`to_course_id` ASC), - UNIQUE INDEX `subject_course_related_c_from_course_id_to_course_74e1ae5f_uniq`(`from_course_id` ASC, `to_course_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_course_relat_to_course_id_52f44705_fk_subject_c`(`to_course_id`), + UNIQUE INDEX `subject_course_related_c_from_course_id_to_course_74e1ae5f_uniq`(`from_course_id`, `to_course_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -551,9 +426,9 @@ CREATE TABLE `subject_courseuser` ( `course_id` INTEGER NOT NULL, `user_profile_id` INTEGER NOT NULL, - UNIQUE INDEX `subject_courseuser_course_id_a26ac0b3_uniq`(`course_id` ASC, `user_profile_id` ASC), - INDEX `subject_courseuser_user_profile_id_4d15ef1b_fk_session_u`(`user_profile_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_courseuser_user_profile_id_4d15ef1b_fk_session_u`(`user_profile_id`), + UNIQUE INDEX `subject_courseuser_course_id_a26ac0b3_uniq`(`course_id`, `user_profile_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -565,7 +440,7 @@ CREATE TABLE `subject_department` ( `name_en` VARCHAR(60) NULL, `visible` BOOLEAN NOT NULL, - PRIMARY KEY (`id` ASC) + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -576,8 +451,8 @@ CREATE TABLE `subject_examtime` ( `end` TIME(0) NOT NULL, `lecture_id` INTEGER NOT NULL, - INDEX `subject_examtime_72a11f01`(`lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_examtime_72a11f01`(`lecture_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -615,9 +490,9 @@ CREATE TABLE `subject_lecture` ( `common_title` VARCHAR(100) NULL, `common_title_en` VARCHAR(100) NULL, - INDEX `subject_lecture_deleted_bedc6156_uniq`(`deleted` ASC), - INDEX `subject_lecture_type_en_45ee2d3a_uniq`(`type_en` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_lecture_deleted_bedc6156_uniq`(`deleted`), + INDEX `subject_lecture_type_en_45ee2d3a_uniq`(`type_en`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -626,8 +501,8 @@ CREATE TABLE `subject_lecture_professors` ( `lecture_id` INTEGER NOT NULL, `professor_id` INTEGER NOT NULL, - UNIQUE INDEX `lecture_id`(`lecture_id` ASC, `professor_id` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `lecture_id`(`lecture_id`, `professor_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -645,17 +520,7 @@ CREATE TABLE `subject_professor` ( `load` DOUBLE NOT NULL, `speech` DOUBLE NOT NULL, - PRIMARY KEY (`id` ASC) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `subject_professor_course_list` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `professor_id` INTEGER NOT NULL, - `course_id` INTEGER NOT NULL, - - UNIQUE INDEX `professor_id`(`professor_id` ASC, `course_id` ASC), - PRIMARY KEY (`id` ASC) + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -673,10 +538,10 @@ CREATE TABLE `subject_semester` ( `gradePosting` DATETIME(0) NULL, `courseDesciptionSubmission` DATETIME(0) NULL, - INDEX `subject_semester_1b3810e0`(`semester` ASC), - INDEX `subject_semester_84cdc76c`(`year` ASC), - UNIQUE INDEX `subject_semester_year_680c861f_uniq`(`year` ASC, `semester` ASC), - PRIMARY KEY (`id` ASC) + INDEX `subject_semester_1b3810e0`(`semester`), + INDEX `subject_semester_84cdc76c`(`year`), + UNIQUE INDEX `subject_semester_year_680c861f_uniq`(`year`, `semester`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -687,7 +552,7 @@ CREATE TABLE `support_notice` ( `title` VARCHAR(100) NOT NULL, `content` LONGTEXT NOT NULL, - PRIMARY KEY (`id` ASC) + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -699,9 +564,9 @@ CREATE TABLE `support_rate` ( `user_id` INTEGER NOT NULL, `version` VARCHAR(20) NOT NULL, - INDEX `support_rate_created_datetime_d38a29eb`(`created_datetime` ASC), - UNIQUE INDEX `support_rate_user_id_year_a62fc7f7_uniq`(`user_id` ASC, `year` ASC), - PRIMARY KEY (`id` ASC) + INDEX `support_rate_created_datetime_d38a29eb`(`created_datetime`), + UNIQUE INDEX `support_rate_user_id_year_a62fc7f7_uniq`(`user_id`, `year`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -712,7 +577,7 @@ CREATE TABLE `timetable_oldtimetable` ( `semester` SMALLINT NULL, `table_no` SMALLINT NULL, - PRIMARY KEY (`id` ASC) + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -721,9 +586,9 @@ CREATE TABLE `timetable_oldtimetable_lectures` ( `oldtimetable_id` INTEGER NOT NULL, `lecture_id` INTEGER NOT NULL, - INDEX `timetable_oldtimetable_lecture_id_b19d5300_fk_subject_lecture_id`(`lecture_id` ASC), - UNIQUE INDEX `timetable_oldtimetable_lecture_oldtimetable_id_27bf3d09_uniq`(`oldtimetable_id` ASC, `lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `timetable_oldtimetable_lecture_id_b19d5300_fk_subject_lecture_id`(`lecture_id`), + UNIQUE INDEX `timetable_oldtimetable_lecture_oldtimetable_id_27bf3d09_uniq`(`oldtimetable_id`, `lecture_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -734,11 +599,11 @@ CREATE TABLE `timetable_timetable` ( `user_id` INTEGER NOT NULL, `arrange_order` SMALLINT NOT NULL, - INDEX `timetable_timetable_arrange_order_84c8935c`(`arrange_order` ASC), - INDEX `timetable_timetable_semester_d8ce5d37_uniq`(`semester` ASC), - INDEX `timetable_timetable_user_id_0d214170_fk_session_userprofile_id`(`user_id` ASC), - INDEX `timetable_timetable_year_907cf59a_uniq`(`year` ASC), - PRIMARY KEY (`id` ASC) + INDEX `timetable_timetable_arrange_order_84c8935c`(`arrange_order`), + INDEX `timetable_timetable_semester_d8ce5d37_uniq`(`semester`), + INDEX `timetable_timetable_user_id_0d214170_fk_session_userprofile_id`(`user_id`), + INDEX `timetable_timetable_year_907cf59a_uniq`(`year`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -747,9 +612,9 @@ CREATE TABLE `timetable_timetable_lectures` ( `timetable_id` INTEGER NOT NULL, `lecture_id` INTEGER NOT NULL, - INDEX `timetable_timetable_le_lecture_id_79aa5f2e_fk_subject_lecture_id`(`lecture_id` ASC), - UNIQUE INDEX `timetable_timetable_lecture_timetable_id_57195f56_uniq`(`timetable_id` ASC, `lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `timetable_timetable_le_lecture_id_79aa5f2e_fk_subject_lecture_id`(`lecture_id`), + UNIQUE INDEX `timetable_timetable_lecture_timetable_id_57195f56_uniq`(`timetable_id`, `lecture_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -757,8 +622,8 @@ CREATE TABLE `timetable_wishlist` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `user_id` INTEGER NOT NULL, - UNIQUE INDEX `user_id`(`user_id` ASC), - PRIMARY KEY (`id` ASC) + UNIQUE INDEX `user_id`(`user_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable @@ -767,9 +632,159 @@ CREATE TABLE `timetable_wishlist_lectures` ( `wishlist_id` INTEGER NOT NULL, `lecture_id` INTEGER NOT NULL, - INDEX `timetable_wishlist_lec_lecture_id_1ab5d523_fk_subject_lecture_id`(`lecture_id` ASC), - UNIQUE INDEX `timetable_wishlist_lectures_wishlist_id_e4c47efe_uniq`(`wishlist_id` ASC, `lecture_id` ASC), - PRIMARY KEY (`id` ASC) + INDEX `timetable_wishlist_lec_lecture_id_1ab5d523_fk_subject_lecture_id`(`lecture_id`), + UNIQUE INDEX `timetable_wishlist_lectures_wishlist_id_e4c47efe_uniq`(`wishlist_id`, `lecture_id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `graduation_additionaltrack` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `start_year` INTEGER NOT NULL, + `end_year` INTEGER NOT NULL, + `type` VARCHAR(32) NOT NULL, + `major_required` INTEGER NOT NULL, + `major_elective` INTEGER NOT NULL, + `department_id` INTEGER NULL, + + INDEX `graduation_additiona_department_id_788c5289_fk_subject_d`(`department_id`), + INDEX `graduation_additionaltrack_end_year_6af1030b`(`end_year`), + INDEX `graduation_additionaltrack_start_year_7a87318d`(`start_year`), + INDEX `graduation_additionaltrack_type_0fa38fc5`(`type`), + UNIQUE INDEX `graduation_additionaltra_end_year_type_department_9d873c1b_uniq`(`end_year`, `type`, `department_id`), + UNIQUE INDEX `graduation_additionaltra_start_year_type_departme_763552eb_uniq`(`start_year`, `type`, `department_id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `graduation_generaltrack` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `start_year` INTEGER NOT NULL, + `end_year` INTEGER NOT NULL, + `is_foreign` BOOLEAN NOT NULL, + `total_credit` INTEGER NOT NULL, + `total_au` INTEGER NOT NULL, + `basic_required` INTEGER NOT NULL, + `basic_elective` INTEGER NOT NULL, + `thesis_study` INTEGER NOT NULL, + `thesis_study_doublemajor` INTEGER NOT NULL, + `general_required_credit` INTEGER NOT NULL, + `general_required_au` INTEGER NOT NULL, + `humanities` INTEGER NOT NULL, + `humanities_doublemajor` INTEGER NOT NULL, + + INDEX `graduation_generaltrack_end_year_3bba699e`(`end_year`), + INDEX `graduation_generaltrack_is_foreign_d38919a2`(`is_foreign`), + INDEX `graduation_generaltrack_start_year_00aee782`(`start_year`), + UNIQUE INDEX `graduation_generaltrack_end_year_is_foreign_1f062f8b_uniq`(`end_year`, `is_foreign`), + UNIQUE INDEX `graduation_generaltrack_start_year_is_foreign_c1eb425f_uniq`(`start_year`, `is_foreign`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `graduation_majortrack` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `start_year` INTEGER NOT NULL, + `end_year` INTEGER NOT NULL, + `basic_elective_doublemajor` INTEGER NOT NULL, + `major_required` INTEGER NOT NULL, + `major_elective` INTEGER NOT NULL, + `department_id` INTEGER NOT NULL, + + INDEX `graduation_majortrac_department_id_81bfc8fa_fk_subject_d`(`department_id`), + INDEX `graduation_majortrack_end_year_57017559`(`end_year`), + INDEX `graduation_majortrack_start_year_6281dc28`(`start_year`), + UNIQUE INDEX `graduation_majortrack_end_year_department_id_b3ef1bc8_uniq`(`end_year`, `department_id`), + UNIQUE INDEX `graduation_majortrack_start_year_department_id_59122c6d_uniq`(`start_year`, `department_id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `planner_arbitraryplanneritem` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `is_excluded` BOOLEAN NOT NULL, + `year` INTEGER NOT NULL, + `semester` INTEGER NOT NULL, + `type` VARCHAR(12) NOT NULL, + `type_en` VARCHAR(36) NOT NULL, + `credit` INTEGER NOT NULL, + `credit_au` INTEGER NOT NULL, + `department_id` INTEGER NULL, + `planner_id` INTEGER NOT NULL, + + INDEX `planner_arbitrarypla_department_id_0dc7ce25_fk_subject_d`(`department_id`), + INDEX `planner_arbitrarypla_planner_id_d6069d2c_fk_planner_p`(`planner_id`), + INDEX `planner_arbitraryplanneritem_semester_7508baa5`(`semester`), + INDEX `planner_arbitraryplanneritem_year_5a0c7252`(`year`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `planner_futureplanneritem` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `is_excluded` BOOLEAN NOT NULL, + `year` INTEGER NOT NULL, + `semester` INTEGER NOT NULL, + `course_id` INTEGER NOT NULL, + `planner_id` INTEGER NOT NULL, + + INDEX `planner_futureplanne_course_id_b1a06444_fk_subject_c`(`course_id`), + INDEX `planner_futureplanne_planner_id_dfd70193_fk_planner_p`(`planner_id`), + INDEX `planner_futureplanneritem_semester_cda6512e`(`semester`), + INDEX `planner_futureplanneritem_year_5e3a2d4e`(`year`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `planner_planner` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `start_year` INTEGER NOT NULL, + `end_year` INTEGER NOT NULL, + `arrange_order` SMALLINT NOT NULL, + `general_track_id` INTEGER NOT NULL, + `major_track_id` INTEGER NOT NULL, + `user_id` INTEGER NOT NULL, + + INDEX `planner_planner_arrange_order_e50a3044`(`arrange_order`), + INDEX `planner_planner_end_year_e5fab7f3`(`end_year`), + INDEX `planner_planner_general_track_id_6d607973_fk_graduatio`(`general_track_id`), + INDEX `planner_planner_major_track_id_9f7204bd_fk_graduatio`(`major_track_id`), + INDEX `planner_planner_start_year_463173f3`(`start_year`), + INDEX `planner_planner_user_id_17740247_fk_session_userprofile_id`(`user_id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `planner_planner_additional_tracks` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `planner_id` INTEGER NOT NULL, + `additionaltrack_id` INTEGER NOT NULL, + + INDEX `planner_planner_addi_additionaltrack_id_c46b8c4e_fk_graduatio`(`additionaltrack_id`), + UNIQUE INDEX `planner_planner_addition_planner_id_additionaltra_2298c5cd_uniq`(`planner_id`, `additionaltrack_id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `planner_takenplanneritem` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `is_excluded` BOOLEAN NOT NULL, + `lecture_id` INTEGER NOT NULL, + `planner_id` INTEGER NOT NULL, + + INDEX `planner_takenplanner_lecture_id_9b2d30d8_fk_subject_l`(`lecture_id`), + UNIQUE INDEX `planner_takenplanneritem_planner_id_lecture_id_4b39b432_uniq`(`planner_id`, `lecture_id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `subject_professor_course_list` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `professor_id` INTEGER NOT NULL, + `course_id` INTEGER NOT NULL, + + UNIQUE INDEX `professor_id`(`professor_id`, `course_id`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- AddForeignKey @@ -799,12 +814,6 @@ ALTER TABLE `django_admin_log` ADD CONSTRAINT `djang_content_type_id_69791429515 -- AddForeignKey ALTER TABLE `django_admin_log` ADD CONSTRAINT `django_admin_log_user_id_52fdd58701c5f563_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; --- AddForeignKey -ALTER TABLE `graduation_additionaltrack` ADD CONSTRAINT `graduation_additiona_department_id_788c5289_fk_subject_d` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `graduation_majortrack` ADD CONSTRAINT `graduation_majortrac_department_id_81bfc8fa_fk_subject_d` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - -- AddForeignKey ALTER TABLE `main_famoushumanityreviewdailyfeed_reviews` ADD CONSTRAINT `e567529fdfd543a96610b342fea2bb84` FOREIGN KEY (`famoushumanityreviewdailyfeed_id`) REFERENCES `main_famoushumanityreviewdailyfeed`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; @@ -838,39 +847,6 @@ ALTER TABLE `main_reviewwritedailyuserfeed` ADD CONSTRAINT `main_reviewwritedail -- AddForeignKey ALTER TABLE `main_reviewwritedailyuserfeed` ADD CONSTRAINT `main_reviewwritedaily_user_id_9ffd0881_fk_session_userprofile_id` FOREIGN KEY (`user_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; --- AddForeignKey -ALTER TABLE `planner_arbitraryplanneritem` ADD CONSTRAINT `planner_arbitrarypla_department_id_0dc7ce25_fk_subject_d` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_arbitraryplanneritem` ADD CONSTRAINT `planner_arbitrarypla_planner_id_d6069d2c_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_futureplanneritem` ADD CONSTRAINT `planner_futureplanne_course_id_b1a06444_fk_subject_c` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_futureplanneritem` ADD CONSTRAINT `planner_futureplanne_planner_id_dfd70193_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_planner` ADD CONSTRAINT `planner_planner_general_track_id_6d607973_fk_graduatio` FOREIGN KEY (`general_track_id`) REFERENCES `graduation_generaltrack`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_planner` ADD CONSTRAINT `planner_planner_major_track_id_9f7204bd_fk_graduatio` FOREIGN KEY (`major_track_id`) REFERENCES `graduation_majortrack`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_planner` ADD CONSTRAINT `planner_planner_user_id_17740247_fk_session_userprofile_id` FOREIGN KEY (`user_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_planner_additional_tracks` ADD CONSTRAINT `planner_planner_addi_additionaltrack_id_c46b8c4e_fk_graduatio` FOREIGN KEY (`additionaltrack_id`) REFERENCES `graduation_additionaltrack`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_planner_additional_tracks` ADD CONSTRAINT `planner_planner_addi_planner_id_e439a309_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_takenplanneritem` ADD CONSTRAINT `planner_takenplanner_lecture_id_9b2d30d8_fk_subject_l` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `planner_takenplanneritem` ADD CONSTRAINT `planner_takenplanner_planner_id_b725ff83_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - -- AddForeignKey ALTER TABLE `session_userprofile_majors` ADD CONSTRAINT `session_userpr_userprofile_id_20f3742a_fk_session_userprofile_id` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; @@ -940,3 +916,41 @@ ALTER TABLE `timetable_wishlist_lectures` ADD CONSTRAINT `timetable_wishlist_lec -- AddForeignKey ALTER TABLE `timetable_wishlist_lectures` ADD CONSTRAINT `timetable_wishlist_wishlist_id_efc7ae12_fk_timetable_wishlist_id` FOREIGN KEY (`wishlist_id`) REFERENCES `timetable_wishlist`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; +-- AddForeignKey +ALTER TABLE `graduation_additionaltrack` ADD CONSTRAINT `graduation_additiona_department_id_788c5289_fk_subject_d` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `graduation_majortrack` ADD CONSTRAINT `graduation_majortrac_department_id_81bfc8fa_fk_subject_d` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_arbitraryplanneritem` ADD CONSTRAINT `planner_arbitrarypla_department_id_0dc7ce25_fk_subject_d` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_arbitraryplanneritem` ADD CONSTRAINT `planner_arbitrarypla_planner_id_d6069d2c_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_futureplanneritem` ADD CONSTRAINT `planner_futureplanne_course_id_b1a06444_fk_subject_c` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_futureplanneritem` ADD CONSTRAINT `planner_futureplanne_planner_id_dfd70193_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_planner` ADD CONSTRAINT `planner_planner_general_track_id_6d607973_fk_graduatio` FOREIGN KEY (`general_track_id`) REFERENCES `graduation_generaltrack`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_planner` ADD CONSTRAINT `planner_planner_major_track_id_9f7204bd_fk_graduatio` FOREIGN KEY (`major_track_id`) REFERENCES `graduation_majortrack`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_planner` ADD CONSTRAINT `planner_planner_user_id_17740247_fk_session_userprofile_id` FOREIGN KEY (`user_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_planner_additional_tracks` ADD CONSTRAINT `planner_planner_addi_additionaltrack_id_c46b8c4e_fk_graduatio` FOREIGN KEY (`additionaltrack_id`) REFERENCES `graduation_additionaltrack`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_planner_additional_tracks` ADD CONSTRAINT `planner_planner_addi_planner_id_e439a309_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_takenplanneritem` ADD CONSTRAINT `planner_takenplanner_lecture_id_9b2d30d8_fk_subject_l` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `planner_takenplanneritem` ADD CONSTRAINT `planner_takenplanner_planner_id_b725ff83_fk_planner_p` FOREIGN KEY (`planner_id`) REFERENCES `planner_planner`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230511150955_reconstruct_session_userprofile/migration.sql b/src/prisma/migrations/20230511150955_reconstruct_session_userprofile/migration.sql deleted file mode 100644 index 04878567..00000000 --- a/src/prisma/migrations/20230511150955_reconstruct_session_userprofile/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `language` on the `session_userprofile` table. All the data in the column will be lost. - - You are about to drop the column `portal_check` on the `session_userprofile` table. All the data in the column will be lost. - - Added the required column `date_joined` to the `session_userprofile` table without a default value. This is not possible if the table is not empty. - - Added the required column `first_name` to the `session_userprofile` table without a default value. This is not possible if the table is not empty. - - Added the required column `last_name` to the `session_userprofile` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE `session_userprofile` DROP COLUMN `language`, - DROP COLUMN `portal_check`, - ADD COLUMN `date_joined` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - ADD COLUMN `first_name` VARCHAR(30) NOT NULL, - ADD COLUMN `last_name` VARCHAR(150) NOT NULL; diff --git a/src/prisma/migrations/20230511231222_drop_user_id_in_session_userprofile/migration.sql b/src/prisma/migrations/20230511231222_drop_user_id_in_session_userprofile/migration.sql deleted file mode 100644 index fc7323e4..00000000 --- a/src/prisma/migrations/20230511231222_drop_user_id_in_session_userprofile/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `user_id` on the `session_userprofile` table. All the data in the column will be lost. - -*/ --- DropIndex -DROP INDEX `session_userprofile_user_id_09dd6af1_uniq` ON `session_userprofile`; - --- AlterTable -ALTER TABLE `session_userprofile` DROP COLUMN `user_id`, - ALTER COLUMN `date_joined` DROP DEFAULT; diff --git a/src/prisma/migrations/20230621131500_add_refresh_token_to_session_user_profile/migration.sql b/src/prisma/migrations/20230621131500_add_refresh_token_to_session_user_profile/migration.sql deleted file mode 100644 index 4ec1d499..00000000 --- a/src/prisma/migrations/20230621131500_add_refresh_token_to_session_user_profile/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `session_userprofile` ADD COLUMN `refresh_token` VARCHAR(255) NULL; diff --git a/src/prisma/migrations/20230703113703_create_f_ks/migration.sql b/src/prisma/migrations/20230703113703_create_f_ks/migration.sql deleted file mode 100644 index d49cd192..00000000 --- a/src/prisma/migrations/20230703113703_create_f_ks/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- AddForeignKey -ALTER TABLE `session_userprofile` ADD CONSTRAINT `session_userprofile_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE SET NULL ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `session_userprofile_favorite_departments` ADD CONSTRAINT `session_userprofile_favorite_departments_userprofile_id_fkey` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `session_userprofile_favorite_departments` ADD CONSTRAINT `session_userprofile_favorite_departments_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230703135605_add_fk_writer/migration.sql b/src/prisma/migrations/20230703135605_add_fk_writer/migration.sql deleted file mode 100644 index 1bd255dd..00000000 --- a/src/prisma/migrations/20230703135605_add_fk_writer/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- AddForeignKey -ALTER TABLE `review_review` ADD CONSTRAINT `review_review_writer_id_fkey` FOREIGN KEY (`writer_id`) REFERENCES `session_userprofile`(`id`) ON DELETE SET NULL ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `session_userprofile_taken_lectures` ADD CONSTRAINT `session_userprofile_taken_lectures_userprofile_id_fkey` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `session_userprofile_taken_lectures` ADD CONSTRAINT `session_userprofile_taken_lectures_lecture_id_fkey` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230705113103_add_no_space_columns/migration.sql b/src/prisma/migrations/20230705113103_add_no_space_columns/migration.sql deleted file mode 100644 index 6b20593e..00000000 --- a/src/prisma/migrations/20230705113103_add_no_space_columns/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Added the required column `title_en_no_space` to the `subject_course` table without a default value. This is not possible if the table is not empty. - - Added the required column `title_no_space` to the `subject_course` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE `subject_course` ADD COLUMN `title_en_no_space` VARCHAR(200) NOT NULL, - ADD COLUMN `title_no_space` VARCHAR(100) NOT NULL; diff --git a/src/prisma/migrations/20230711103921_add_fk_between_course_and_department/migration.sql b/src/prisma/migrations/20230711103921_add_fk_between_course_and_department/migration.sql deleted file mode 100644 index 12090a5a..00000000 --- a/src/prisma/migrations/20230711103921_add_fk_between_course_and_department/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- CreateIndex -CREATE INDEX `subject_course_department_id_fkey` ON `subject_course`(`department_id`); - --- AddForeignKey -ALTER TABLE `subject_course` ADD CONSTRAINT `subject_course_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230711104232_drop_subject_professor_course_list/migration.sql b/src/prisma/migrations/20230711104232_drop_subject_professor_course_list/migration.sql deleted file mode 100644 index af5bcd34..00000000 --- a/src/prisma/migrations/20230711104232_drop_subject_professor_course_list/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the `subject_professor_course_list` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropTable -DROP TABLE `subject_professor_course_list`; diff --git a/src/prisma/migrations/20230712094426_add_fk_subject_course_professors/migration.sql b/src/prisma/migrations/20230712094426_add_fk_subject_course_professors/migration.sql deleted file mode 100644 index a8a99711..00000000 --- a/src/prisma/migrations/20230712094426_add_fk_subject_course_professors/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AddForeignKey -ALTER TABLE `subject_course_professors` ADD CONSTRAINT `subject_course_professors_course_id_fkey` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `subject_course_professors` ADD CONSTRAINT `subject_course_professors_professor_id_fkey` FOREIGN KEY (`professor_id`) REFERENCES `subject_professor`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230717112040_add_fk_subject_course_subject_lecture/migration.sql b/src/prisma/migrations/20230717112040_add_fk_subject_course_subject_lecture/migration.sql deleted file mode 100644 index 6d784c8c..00000000 --- a/src/prisma/migrations/20230717112040_add_fk_subject_course_subject_lecture/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AddForeignKey -ALTER TABLE `subject_lecture` ADD CONSTRAINT `subject_lecture_course_id_fkey` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230724120847_add_fk_subject_lecture_subject_department/migration.sql b/src/prisma/migrations/20230724120847_add_fk_subject_lecture_subject_department/migration.sql deleted file mode 100644 index 42675484..00000000 --- a/src/prisma/migrations/20230724120847_add_fk_subject_lecture_subject_department/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AddForeignKey -ALTER TABLE `subject_lecture` ADD CONSTRAINT `subject_lecture_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230724125117_add_fk_subject_lecture_subject_professor/migration.sql b/src/prisma/migrations/20230724125117_add_fk_subject_lecture_subject_professor/migration.sql deleted file mode 100644 index 178af8e5..00000000 --- a/src/prisma/migrations/20230724125117_add_fk_subject_lecture_subject_professor/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AddForeignKey -ALTER TABLE `subject_lecture_professors` ADD CONSTRAINT `subject_lecture_professors_lecture_id_fkey` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; - --- AddForeignKey -ALTER TABLE `subject_lecture_professors` ADD CONSTRAINT `subject_lecture_professors_professor_id_fkey` FOREIGN KEY (`professor_id`) REFERENCES `subject_professor`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/20230724133216_add_fk_review_review_subject_lecture/migration.sql b/src/prisma/migrations/20230724133216_add_fk_review_review_subject_lecture/migration.sql deleted file mode 100644 index b5c807c7..00000000 --- a/src/prisma/migrations/20230724133216_add_fk_review_review_subject_lecture/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AddForeignKey -ALTER TABLE `review_review` ADD CONSTRAINT `review_review_lecture_id_fkey` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/prisma/migrations/20230726101554_add_no_space_column_for_lecture/migration.sql b/src/prisma/migrations/20230726101554_add_no_space_column_for_lecture/migration.sql deleted file mode 100644 index 570c4079..00000000 --- a/src/prisma/migrations/20230726101554_add_no_space_column_for_lecture/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Added the required column `title_en_no_space` to the `subject_lecture` table without a default value. This is not possible if the table is not empty. - - Added the required column `title_no_space` to the `subject_lecture` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE `subject_lecture` ADD COLUMN `title_en_no_space` VARCHAR(200) NOT NULL, - ADD COLUMN `title_no_space` VARCHAR(100) NOT NULL; diff --git a/src/prisma/migrations/20230726130510_add_fk_review_review_subject_course/migration.sql b/src/prisma/migrations/20230726130510_add_fk_review_review_subject_course/migration.sql deleted file mode 100644 index 2731eff2..00000000 --- a/src/prisma/migrations/20230726130510_add_fk_review_review_subject_course/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AddForeignKey -ALTER TABLE `review_review` ADD CONSTRAINT `review_review_course_id_fkey` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/prisma/migrations/20230727223002_add_fk_review_reviewvote_review_review_and_session_userprofile/migration.sql b/src/prisma/migrations/20230727223002_add_fk_review_reviewvote_review_review_and_session_userprofile/migration.sql deleted file mode 100644 index 0fbee3f5..00000000 --- a/src/prisma/migrations/20230727223002_add_fk_review_reviewvote_review_review_and_session_userprofile/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AddForeignKey -ALTER TABLE `review_reviewvote` ADD CONSTRAINT `review_reviewvote_review_id_fkey` FOREIGN KEY (`review_id`) REFERENCES `review_review`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `review_reviewvote` ADD CONSTRAINT `review_reviewvote_userprofile_id_fkey` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/src/prisma/migrations/20230814042655_add_default_value_review_review_is_deleted_like/migration.sql b/src/prisma/migrations/20230814042655_add_default_value_review_review_is_deleted_like/migration.sql deleted file mode 100644 index 5a2bcf1a..00000000 --- a/src/prisma/migrations/20230814042655_add_default_value_review_review_is_deleted_like/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ --- DropForeignKey -ALTER TABLE `review_review` DROP FOREIGN KEY `review_review_writer_id_fkey`; - --- AlterTable -ALTER TABLE `review_review` MODIFY `grade` SMALLINT NOT NULL DEFAULT 0, - MODIFY `load` SMALLINT NOT NULL DEFAULT 0, - MODIFY `speech` SMALLINT NOT NULL DEFAULT 0, - MODIFY `like` INTEGER NOT NULL DEFAULT 0, - MODIFY `is_deleted` INTEGER NOT NULL DEFAULT 0; - --- AddForeignKey -ALTER TABLE `review_review` ADD CONSTRAINT `review_review_writer_id_fkey` FOREIGN KEY (`writer_id`) REFERENCES `session_userprofile`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/src/prisma/migrations/20230511150955_reconstruct_session_userprofile/mergeAuthUserAndSessionUser.ts b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/0_mergeAuthUserAndSessionUser.ts.ts similarity index 91% rename from src/prisma/migrations/20230511150955_reconstruct_session_userprofile/mergeAuthUserAndSessionUser.ts rename to src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/0_mergeAuthUserAndSessionUser.ts.ts index 4997191d..446b4922 100644 --- a/src/prisma/migrations/20230511150955_reconstruct_session_userprofile/mergeAuthUserAndSessionUser.ts +++ b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/0_mergeAuthUserAndSessionUser.ts.ts @@ -1,6 +1,6 @@ -import { normalizeArray } from '../../../common/utils/method.utils'; -import settings from '../../../settings'; -import { PrismaService } from '../../prisma.service'; +import { normalizeArray } from 'src/common/utils/method.utils'; +import { PrismaService } from 'src/prisma/prisma.service'; +import settings from 'src/settings'; async function main() { const ormConfig = settings().ormconfig(); diff --git a/src/prisma/migrations/20230621131500_add_refresh_token_to_session_user_profile/addRefreshToken.ts b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/1_addRefreshToken.ts similarity index 89% rename from src/prisma/migrations/20230621131500_add_refresh_token_to_session_user_profile/addRefreshToken.ts rename to src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/1_addRefreshToken.ts index 55fdcbfb..8594c9a9 100644 --- a/src/prisma/migrations/20230621131500_add_refresh_token_to_session_user_profile/addRefreshToken.ts +++ b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/1_addRefreshToken.ts @@ -1,9 +1,9 @@ import { JwtService } from '@nestjs/jwt'; import * as bcrypt from 'bcrypt'; -import { AuthService } from '../../../modules/auth/auth.service'; -import settings from '../../../settings'; -import { PrismaService } from '../../prisma.service'; -import { UserRepository } from '../../repositories/user.repository'; +import { AuthService } from 'src/modules/auth/auth.service'; +import { PrismaService } from 'src/prisma/prisma.service'; +import { UserRepository } from 'src/prisma/repositories/user.repository'; +import settings from 'src/settings'; async function main() { const ormConfig = settings().ormconfig(); diff --git a/src/prisma/migrations/20230705113103_add_no_space_columns/noSpaceColumns.ts b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/2_noSpaceColumnsCourses.ts similarity index 93% rename from src/prisma/migrations/20230705113103_add_no_space_columns/noSpaceColumns.ts rename to src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/2_noSpaceColumnsCourses.ts index d0909b35..ba1a5a02 100644 --- a/src/prisma/migrations/20230705113103_add_no_space_columns/noSpaceColumns.ts +++ b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/2_noSpaceColumnsCourses.ts @@ -1,5 +1,5 @@ -import settings from '../../../settings'; -import { PrismaService } from '../../prisma.service'; +import { PrismaService } from 'src/prisma/prisma.service'; +import settings from 'src/settings'; async function main() { const ormConfig = settings().ormconfig(); diff --git a/src/prisma/migrations/20230726101554_add_no_space_column_for_lecture/noSpaceColumns.ts b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/3_noSpaceColumnsLectures.ts similarity index 93% rename from src/prisma/migrations/20230726101554_add_no_space_column_for_lecture/noSpaceColumns.ts rename to src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/3_noSpaceColumnsLectures.ts index 9ffa6191..1b419124 100644 --- a/src/prisma/migrations/20230726101554_add_no_space_column_for_lecture/noSpaceColumns.ts +++ b/src/prisma/migrations/20240116150914_django_to_nest/dataMigrations/3_noSpaceColumnsLectures.ts @@ -1,5 +1,5 @@ -import settings from '../../../settings'; -import { PrismaService } from '../../prisma.service'; +import { PrismaService } from 'src/prisma/prisma.service'; +import settings from 'src/settings'; async function main() { const ormConfig = settings().ormconfig(); diff --git a/src/prisma/migrations/20240116150914_django_to_nest/migration.sql b/src/prisma/migrations/20240116150914_django_to_nest/migration.sql new file mode 100644 index 00000000..6571988d --- /dev/null +++ b/src/prisma/migrations/20240116150914_django_to_nest/migration.sql @@ -0,0 +1,108 @@ +/* + Warnings: + + - You are about to drop the column `language` on the `session_userprofile` table. All the data in the column will be lost. + - You are about to drop the column `portal_check` on the `session_userprofile` table. All the data in the column will be lost. + - You are about to drop the column `user_id` on the `session_userprofile` table. All the data in the column will be lost. + - You are about to drop the `subject_professor_course_list` table. If the table is not empty, all the data it contains will be lost. + - Added the required column `date_joined` to the `session_userprofile` table without a default value. This is not possible if the table is not empty. + - Added the required column `first_name` to the `session_userprofile` table without a default value. This is not possible if the table is not empty. + - Added the required column `last_name` to the `session_userprofile` table without a default value. This is not possible if the table is not empty. + - Added the required column `title_en_no_space` to the `subject_course` table without a default value. This is not possible if the table is not empty. + - Added the required column `title_no_space` to the `subject_course` table without a default value. This is not possible if the table is not empty. + - Added the required column `title_en_no_space` to the `subject_lecture` table without a default value. This is not possible if the table is not empty. + - Added the required column `title_no_space` to the `subject_lecture` table without a default value. This is not possible if the table is not empty. + +*/ +-- DropIndex +DROP INDEX `session_userprofile_user_id_09dd6af1_uniq` ON `session_userprofile`; + +-- AlterTable +ALTER TABLE `review_review` MODIFY `grade` SMALLINT NOT NULL DEFAULT 0, + MODIFY `load` SMALLINT NOT NULL DEFAULT 0, + MODIFY `speech` SMALLINT NOT NULL DEFAULT 0, + MODIFY `like` INTEGER NOT NULL DEFAULT 0, + MODIFY `is_deleted` INTEGER NOT NULL DEFAULT 0; + +-- AlterTable +ALTER TABLE `session_userprofile` DROP COLUMN `language`, + DROP COLUMN `portal_check`, + DROP COLUMN `user_id`, + ADD COLUMN `date_joined` DATETIME(0) NOT NULL, + ADD COLUMN `first_name` VARCHAR(30) NOT NULL, + ADD COLUMN `last_name` VARCHAR(150) NOT NULL, + ADD COLUMN `refresh_token` VARCHAR(255) NULL; + +-- AlterTable +ALTER TABLE `subject_course` ADD COLUMN `title_en_no_space` VARCHAR(200) NOT NULL, + ADD COLUMN `title_no_space` VARCHAR(100) NOT NULL; + +-- AlterTable +ALTER TABLE `subject_lecture` ADD COLUMN `title_en_no_space` VARCHAR(200) NOT NULL, + ADD COLUMN `title_no_space` VARCHAR(100) NOT NULL; + +-- DropTable +DROP TABLE `subject_professor_course_list`; + +-- CreateIndex +CREATE INDEX `session_userprofile_department_id_fkey` ON `session_userprofile`(`department_id`); + +-- CreateIndex +CREATE INDEX `session_userprofile_favorite_departments_department_id_fkey` ON `session_userprofile_favorite_departments`(`department_id`); + +-- CreateIndex +CREATE INDEX `session_userprofile_taken_lectures_lecture_id_fkey` ON `session_userprofile_taken_lectures`(`lecture_id`); + +-- CreateIndex +CREATE INDEX `subject_course_department_id_fkey` ON `subject_course`(`department_id`); + +-- AddForeignKey +ALTER TABLE `review_review` ADD CONSTRAINT `review_review_course_id_fkey` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `review_review` ADD CONSTRAINT `review_review_lecture_id_fkey` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `review_review` ADD CONSTRAINT `review_review_writer_id_fkey` FOREIGN KEY (`writer_id`) REFERENCES `session_userprofile`(`id`) ON DELETE SET NULL ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `review_reviewvote` ADD CONSTRAINT `review_reviewvote_review_id_fkey` FOREIGN KEY (`review_id`) REFERENCES `review_review`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `review_reviewvote` ADD CONSTRAINT `review_reviewvote_userprofile_id_fkey` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `session_userprofile` ADD CONSTRAINT `session_userprofile_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE SET NULL ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `session_userprofile_favorite_departments` ADD CONSTRAINT `session_userprofile_favorite_departments_userprofile_id_fkey` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `session_userprofile_favorite_departments` ADD CONSTRAINT `session_userprofile_favorite_departments_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `session_userprofile_taken_lectures` ADD CONSTRAINT `session_userprofile_taken_lectures_userprofile_id_fkey` FOREIGN KEY (`userprofile_id`) REFERENCES `session_userprofile`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `session_userprofile_taken_lectures` ADD CONSTRAINT `session_userprofile_taken_lectures_lecture_id_fkey` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_course` ADD CONSTRAINT `subject_course_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_course_professors` ADD CONSTRAINT `subject_course_professors_course_id_fkey` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_course_professors` ADD CONSTRAINT `subject_course_professors_professor_id_fkey` FOREIGN KEY (`professor_id`) REFERENCES `subject_professor`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_lecture` ADD CONSTRAINT `subject_lecture_department_id_fkey` FOREIGN KEY (`department_id`) REFERENCES `subject_department`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_lecture` ADD CONSTRAINT `subject_lecture_course_id_fkey` FOREIGN KEY (`course_id`) REFERENCES `subject_course`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_lecture_professors` ADD CONSTRAINT `subject_lecture_professors_lecture_id_fkey` FOREIGN KEY (`lecture_id`) REFERENCES `subject_lecture`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- AddForeignKey +ALTER TABLE `subject_lecture_professors` ADD CONSTRAINT `subject_lecture_professors_professor_id_fkey` FOREIGN KEY (`professor_id`) REFERENCES `subject_professor`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; diff --git a/src/prisma/migrations/migration_lock.toml b/src/prisma/migrations/migration_lock.toml index e5a788a7..9bee74de 100644 --- a/src/prisma/migrations/migration_lock.toml +++ b/src/prisma/migrations/migration_lock.toml @@ -1,3 +1,3 @@ # Please do not edit this file manually # It should be added in your version-control system (i.e. Git) -provider = "mysql" \ No newline at end of file +provider = "mysql" diff --git a/src/prisma/prisma.service.ts b/src/prisma/prisma.service.ts index d18ea1a6..908754d5 100644 --- a/src/prisma/prisma.service.ts +++ b/src/prisma/prisma.service.ts @@ -12,10 +12,10 @@ export class PrismaService extends PrismaClient implements OnModuleInit { async onModuleInit() { await this.$connect(); // @ts-ignore - this.$on('query', async (e) => { - // @ts-ignore - console.log(`Query: ${e.query} ${e.params}`); - }); + // this.$on('query', async (e) => { + // // @ts-ignore + // console.log(`Query: ${e.query} ${e.params}`); + // }); } async enableShutdownHooks(app: INestApplication) { diff --git a/src/prisma/schema.prisma b/src/prisma/schema.prisma index 3b5a261e..112f5e97 100644 --- a/src/prisma/schema.prisma +++ b/src/prisma/schema.prisma @@ -224,79 +224,62 @@ model review_majorbestreview { model review_review { id Int @id @default(autoincrement()) course_id Int - course subject_course @relation(fields: [course_id], references: [id], onDelete: Restrict) lecture_id Int - lecture subject_lecture @relation(fields: [lecture_id], references: [id], onDelete: Restrict) content String @db.MediumText - grade Int @default(0) @db.SmallInt - load Int @default(0) @db.SmallInt - speech Int @default(0) @db.SmallInt + grade Int @db.SmallInt + load Int @db.SmallInt + speech Int @db.SmallInt writer_id Int? - writer session_userprofile? @relation(fields: [writer_id], references: [id], onUpdate: Restrict) writer_label String @db.VarChar(200) updated_datetime DateTime @db.DateTime(0) - like Int @default(0) - is_deleted Int @default(0) + like Int + is_deleted Int written_datetime DateTime? @db.DateTime(0) main_famoushumanityreviewdailyfeed_reviews main_famoushumanityreviewdailyfeed_reviews[] main_famousmajorreviewdailyfeed_reviews main_famousmajorreviewdailyfeed_reviews[] - review_reviewvote review_reviewvote[] @@unique([writer_id, lecture_id], map: "review_comment_writer_id_af700a5d_uniq") @@index([written_datetime], map: "review_comment_e5e30a4a") } model review_reviewvote { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) review_id Int - review review_review @relation(fields: [review_id], references: [id], onDelete: Cascade) userprofile_id Int? - userprofile session_userprofile? @relation(fields: [userprofile_id], references: [id], onDelete: SetNull) - created_datetime DateTime? @db.DateTime(6) + created_datetime DateTime? @db.DateTime(6) @@unique([review_id, userprofile_id], map: "review_commentvote_comment_id_e4594aea_uniq") @@index([created_datetime], map: "review_reviewvote_created_datetime_450f85e2") } model session_userprofile { - id Int @id @default(autoincrement()) - student_id String @db.VarChar(10) - sid String @db.VarChar(30) + id Int @id @default(autoincrement()) + user_id Int @unique(map: "session_userprofile_user_id_09dd6af1_uniq") + student_id String @db.VarChar(10) + sid String @db.VarChar(30) + language String @db.VarChar(15) + portal_check Int? @default(0) department_id Int? - email String? @db.VarChar(255) - date_joined DateTime @db.DateTime(0) - first_name String @db.VarChar(30) - last_name String @db.VarChar(150) - refresh_token String? @db.VarChar(255) + email String? @db.VarChar(255) main_ratedailyuserfeed main_ratedailyuserfeed[] main_relatedcoursedailyuserfeed main_relatedcoursedailyuserfeed[] main_reviewwritedailyuserfeed main_reviewwritedailyuserfeed[] planner_planner planner_planner[] - reviews review_review[] - department subject_department? @relation(fields: [department_id], references: [id], onUpdate: Restrict) - favorite_departments session_userprofile_favorite_departments[] session_userprofile_majors session_userprofile_majors[] session_userprofile_minors session_userprofile_minors[] session_userprofile_specialized_major session_userprofile_specialized_major[] - taken_lectures session_userprofile_taken_lectures[] subject_courseuser subject_courseuser[] support_rate support_rate[] timetable_timetable timetable_timetable[] timetable_wishlist timetable_wishlist? - reviewvote review_reviewvote[] - - @@index([department_id], map: "session_userprofile_department_id_fkey") } model session_userprofile_favorite_departments { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) userprofile_id Int - userprofile session_userprofile @relation(fields: [userprofile_id], references: [id], onUpdate: Restrict) department_id Int - department subject_department @relation(fields: [department_id], references: [id], onUpdate: Restrict) @@unique([userprofile_id, department_id], map: "userprofile_id") - @@index([department_id], map: "session_userprofile_favorite_departments_department_id_fkey") } model session_userprofile_majors { @@ -333,14 +316,11 @@ model session_userprofile_specialized_major { } model session_userprofile_taken_lectures { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) userprofile_id Int - userprofile session_userprofile @relation(fields: [userprofile_id], references: [id], onUpdate: Restrict) lecture_id Int - lecture subject_lecture @relation(fields: [lecture_id], references: [id], onUpdate: Restrict) @@unique([userprofile_id, lecture_id], map: "userprofile_id") - @@index([lecture_id], map: "session_userprofile_taken_lectures_lecture_id_fkey") } model subject_classtime { @@ -377,29 +357,19 @@ model subject_course { load Float speech Float latest_written_datetime DateTime? @db.DateTime(0) - title_en_no_space String @db.VarChar(200) - title_no_space String @db.VarChar(100) main_relatedcoursedailyuserfeed main_relatedcoursedailyuserfeed[] planner_futureplanneritem planner_futureplanneritem[] - subject_department subject_department @relation(fields: [department_id], references: [id], onUpdate: Restrict) subject_course_related_courses_posterior_subject_course_related_courses_posterior_from_course_idTosubject_course subject_course_related_courses_posterior[] @relation("subject_course_related_courses_posterior_from_course_idTosubject_course") subject_course_related_courses_posterior_subject_course_related_courses_posterior_to_course_idTosubject_course subject_course_related_courses_posterior[] @relation("subject_course_related_courses_posterior_to_course_idTosubject_course") subject_course_related_courses_prior_subject_course_related_courses_prior_from_course_idTosubject_course subject_course_related_courses_prior[] @relation("subject_course_related_courses_prior_from_course_idTosubject_course") subject_course_related_courses_prior_subject_course_related_courses_prior_to_course_idTosubject_course subject_course_related_courses_prior[] @relation("subject_course_related_courses_prior_to_course_idTosubject_course") subject_courseuser subject_courseuser[] - subject_course_professors subject_course_professors[] - lecture subject_lecture[] - review review_review[] - - @@index([department_id], map: "subject_course_department_id_fkey") } model subject_course_professors { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) course_id Int professor_id Int - course subject_course @relation(fields: [course_id], references: [id], onUpdate: Restrict) - professor subject_professor @relation(fields: [professor_id], references: [id], onUpdate: Restrict) @@unique([course_id, professor_id], map: "course_id") } @@ -439,23 +409,19 @@ model subject_courseuser { } model subject_department { - id Int @id - num_id String @db.VarChar(4) - code String @db.VarChar(5) - name String @db.VarChar(60) - name_en String? @db.VarChar(60) - visible Boolean - graduation_additionaltrack graduation_additionaltrack[] - graduation_majortrack graduation_majortrack[] - main_famousmajorreviewdailyfeed main_famousmajorreviewdailyfeed[] - planner_arbitraryplanneritem planner_arbitraryplanneritem[] - session_userprofile session_userprofile[] - session_userprofile_favorite_departments session_userprofile_favorite_departments[] - session_userprofile_majors session_userprofile_majors[] - session_userprofile_minors session_userprofile_minors[] - session_userprofile_specialized_major session_userprofile_specialized_major[] - subject_course subject_course[] - subject_lecture subject_lecture[] + id Int @id + num_id String @db.VarChar(4) + code String @db.VarChar(5) + name String @db.VarChar(60) + name_en String? @db.VarChar(60) + visible Boolean + graduation_additionaltrack graduation_additionaltrack[] + graduation_majortrack graduation_majortrack[] + main_famousmajorreviewdailyfeed main_famousmajorreviewdailyfeed[] + planner_arbitraryplanneritem planner_arbitraryplanneritem[] + session_userprofile_majors session_userprofile_majors[] + session_userprofile_minors session_userprofile_minors[] + session_userprofile_specialized_major session_userprofile_specialized_major[] } model subject_examtime { @@ -470,22 +436,19 @@ model subject_examtime { } model subject_lecture { - id Int @id @default(autoincrement()) - code String @db.VarChar(10) - old_code String @db.VarChar(10) + id Int @id @default(autoincrement()) + code String @db.VarChar(10) + old_code String @db.VarChar(10) year Int - semester Int @db.SmallInt + semester Int @db.SmallInt department_id Int - subject_department subject_department @relation(fields: [department_id], references: [id], onUpdate: Restrict) - class_no String @db.VarChar(4) - title String @db.VarChar(100) - title_en String @db.VarChar(200) - type String @db.VarChar(12) - type_en String @db.VarChar(36) + class_no String @db.VarChar(4) + title String @db.VarChar(100) + title_en String @db.VarChar(200) + type String @db.VarChar(12) + type_en String @db.VarChar(36) audience Int credit Int - title_en_no_space String @db.VarChar(200) - title_no_space String @db.VarChar(100) num_classes Int num_labs Int credit_au Int @@ -494,7 +457,6 @@ model subject_lecture { is_english Boolean deleted Boolean course_id Int - course subject_course @relation(fields: [course_id], references: [id], onUpdate: Restrict) grade_sum Float load_sum Float speech_sum Float @@ -502,20 +464,17 @@ model subject_lecture { load Float speech Float review_total_weight Float - class_title String? @db.VarChar(100) - class_title_en String? @db.VarChar(100) - common_title String? @db.VarChar(100) - common_title_en String? @db.VarChar(100) + class_title String? @db.VarChar(100) + class_title_en String? @db.VarChar(100) + common_title String? @db.VarChar(100) + common_title_en String? @db.VarChar(100) main_reviewwritedailyuserfeed main_reviewwritedailyuserfeed[] planner_takenplanneritem planner_takenplanneritem[] - students session_userprofile_taken_lectures[] subject_classtime subject_classtime[] subject_examtime subject_examtime[] timetable_oldtimetable_lectures timetable_oldtimetable_lectures[] timetable_timetable_lectures timetable_timetable_lectures[] timetable_wishlist_lectures timetable_wishlist_lectures[] - subject_lecture_professors subject_lecture_professors[] - review review_review[] @@index([deleted], map: "subject_lecture_deleted_bedc6156_uniq") @@index([type_en], map: "subject_lecture_type_en_45ee2d3a_uniq") @@ -526,27 +485,22 @@ model subject_lecture_professors { lecture_id Int professor_id Int - lecture subject_lecture @relation(fields: [lecture_id], references: [id], onUpdate: Restrict) - professor subject_professor @relation(fields: [professor_id], references: [id], onUpdate: Restrict) - @@unique([lecture_id, professor_id], map: "lecture_id") } model subject_professor { - id Int @id @default(autoincrement()) - professor_name String @db.VarChar(100) - professor_name_en String? @db.VarChar(100) - professor_id Int - major String @db.VarChar(30) - grade_sum Float - load_sum Float - speech_sum Float - review_total_weight Float - grade Float - load Float - speech Float - subject_course_professors subject_course_professors[] - subject_lecture_professors subject_lecture_professors[] + id Int @id @default(autoincrement()) + professor_name String @db.VarChar(100) + professor_name_en String? @db.VarChar(100) + professor_id Int + major String @db.VarChar(30) + grade_sum Float + load_sum Float + speech_sum Float + review_total_weight Float + grade Float + load Float + speech Float } model subject_semester { @@ -797,3 +751,11 @@ model planner_takenplanneritem { @@unique([planner_id, lecture_id], map: "planner_takenplanneritem_planner_id_lecture_id_4b39b432_uniq") @@index([lecture_id], map: "planner_takenplanner_lecture_id_9b2d30d8_fk_subject_l") } + +model subject_professor_course_list { + id Int @id @default(autoincrement()) + professor_id Int + course_id Int + + @@unique([professor_id, course_id], map: "professor_id") +} diff --git a/src/settings.ts b/src/settings.ts index 67977005..d04f46c4 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -21,7 +21,7 @@ const getCorsConfig = () => { const { NODE_ENV } = process.env; if (NODE_ENV === 'local') { return { - origin: 'http://localhost:3000', + origin: 'http://localhost:5173', methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', credentials: true, preflightContinue: false,