Fix duplicated history (#182)
This commit is contained in:
16
back/prisma/migrations/20230405061222_/migration.sql
Normal file
16
back/prisma/migrations/20230405061222_/migration.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The primary key for the `LessonHistory` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- The primary key for the `SongHistory` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "LessonHistory" DROP CONSTRAINT "LessonHistory_pkey",
|
||||
ADD COLUMN "id" SERIAL NOT NULL,
|
||||
ADD CONSTRAINT "LessonHistory_pkey" PRIMARY KEY ("id");
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SongHistory" DROP CONSTRAINT "SongHistory_pkey",
|
||||
ADD COLUMN "id" SERIAL NOT NULL,
|
||||
ADD CONSTRAINT "SongHistory_pkey" PRIMARY KEY ("id");
|
||||
@@ -45,14 +45,13 @@ model Song {
|
||||
}
|
||||
|
||||
model SongHistory {
|
||||
id Int @id @default(autoincrement())
|
||||
song Song @relation(fields: [songID], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
songID Int
|
||||
user User @relation(fields: [userID], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
||||
userID Int
|
||||
score Int
|
||||
difficulties Json
|
||||
|
||||
@@id([songID, userID])
|
||||
}
|
||||
|
||||
model Genre {
|
||||
@@ -88,12 +87,11 @@ model Lesson {
|
||||
}
|
||||
|
||||
model LessonHistory {
|
||||
id Int @id @default(autoincrement())
|
||||
lesson Lesson @relation(fields: [lessonID], references: [id])
|
||||
lessonID Int
|
||||
user User @relation(fields: [userID], references: [id])
|
||||
userID Int
|
||||
|
||||
@@id([lessonID, userID])
|
||||
}
|
||||
|
||||
enum Skill {
|
||||
|
||||
Reference in New Issue
Block a user