commit ee27f2a40578cb9726ab093516580e08e842fe4f
parent 3871330edf11b02a8f5bbf8e1352aecdbdc934a4
Author: Yuukin256 <Yuukin256@gmail.com>
Date: Sat, 5 Nov 2022 16:43:32 +0900
DayTimetable を複合キーに変更
Diffstat:
2 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/src/prisma/migrations/20221105081744_day_timetable_change/migration.sql b/src/prisma/migrations/20221105081744_day_timetable_change/migration.sql
@@ -0,0 +1,35 @@
+/*
+ Warnings:
+
+ - The primary key for the `DayTimetable` table will be changed. If it partially fails, the table could be left without primary key constraint.
+ - You are about to drop the column `class1` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `class2` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `class3` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `class4` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `class5` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `class6` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `class7` on the `DayTimetable` table. All the data in the column will be lost.
+ - You are about to drop the column `id` on the `DayTimetable` table. All the data in the column will be lost.
+
+*/
+-- DropIndex
+DROP INDEX "DayTimetable_grade_date_key";
+
+-- AlterTable
+ALTER TABLE "DayTimetable" DROP CONSTRAINT "DayTimetable_pkey",
+DROP COLUMN "class1",
+DROP COLUMN "class2",
+DROP COLUMN "class3",
+DROP COLUMN "class4",
+DROP COLUMN "class5",
+DROP COLUMN "class6",
+DROP COLUMN "class7",
+DROP COLUMN "id",
+ADD COLUMN "period1" "AbstractLessonName",
+ADD COLUMN "period2" "AbstractLessonName",
+ADD COLUMN "period3" "AbstractLessonName",
+ADD COLUMN "period4" "AbstractLessonName",
+ADD COLUMN "period5" "AbstractLessonName",
+ADD COLUMN "period6" "AbstractLessonName",
+ADD COLUMN "period7" "AbstractLessonName",
+ADD CONSTRAINT "DayTimetable_pkey" PRIMARY KEY ("grade", "date");
diff --git a/src/prisma/schema.prisma b/src/prisma/schema.prisma
@@ -67,19 +67,18 @@ model Standard {
}
model DayTimetable {
- id Int @id @default(autoincrement())
SchoolGrade SchoolGrade @relation(fields: [grade], references: [grade])
grade Int
date DateTime @db.Date
- class1 AbstractLessonName?
- class2 AbstractLessonName?
- class3 AbstractLessonName?
- class4 AbstractLessonName?
- class5 AbstractLessonName?
- class6 AbstractLessonName?
- class7 AbstractLessonName?
+ period1 AbstractLessonName?
+ period2 AbstractLessonName?
+ period3 AbstractLessonName?
+ period4 AbstractLessonName?
+ period5 AbstractLessonName?
+ period6 AbstractLessonName?
+ period7 AbstractLessonName?
- @@unique([grade, date])
+ @@id([grade, date])
}
model UnusualChange {