Add populate script and artist api
This commit is contained in:
10
back/prisma/migrations/20221023094610_/migration.sql
Normal file
10
back/prisma/migrations/20221023094610_/migration.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `midiPath` to the `Song` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `musicXmlPath` to the `Song` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "Song" ADD COLUMN "midiPath" TEXT NOT NULL,
|
||||
ADD COLUMN "musicXmlPath" TEXT NOT NULL;
|
||||
8
back/prisma/migrations/20221024161556_dev/migration.sql
Normal file
8
back/prisma/migrations/20221024161556_dev/migration.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[name]` on the table `Album` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Album_name_key" ON "Album"("name");
|
||||
12
back/prisma/migrations/20221024170544_/migration.sql
Normal file
12
back/prisma/migrations/20221024170544_/migration.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[name]` on the table `Artist` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[name]` on the table `Genre` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Artist_name_key" ON "Artist"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Genre_name_key" ON "Genre"("name");
|
||||
@@ -1,87 +1,89 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
password String
|
||||
email String
|
||||
LessonHistory LessonHistory[]
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
password String
|
||||
email String
|
||||
LessonHistory LessonHistory[]
|
||||
}
|
||||
|
||||
model Song {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
artistId Int?
|
||||
artist Artist? @relation(fields: [artistId], references: [id])
|
||||
albumId Int?
|
||||
album Album? @relation(fields: [albumId], references: [id])
|
||||
genreId Int?
|
||||
genre Genre? @relation(fields: [genreId], references: [id])
|
||||
difficulties Json
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
midiPath String
|
||||
musicXmlPath String
|
||||
artistId Int?
|
||||
artist Artist? @relation(fields: [artistId], references: [id])
|
||||
albumId Int?
|
||||
album Album? @relation(fields: [albumId], references: [id])
|
||||
genreId Int?
|
||||
genre Genre? @relation(fields: [genreId], references: [id])
|
||||
difficulties Json
|
||||
}
|
||||
|
||||
model Genre {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
|
||||
Song Song[]
|
||||
Song Song[]
|
||||
}
|
||||
|
||||
model Artist {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
|
||||
Song Song[]
|
||||
Song Song[]
|
||||
}
|
||||
|
||||
model Album {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
|
||||
Song Song[]
|
||||
Song Song[]
|
||||
}
|
||||
|
||||
model Lesson {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
description String
|
||||
requiredLevel Int
|
||||
mainSkill Skill
|
||||
LessonHistory LessonHistory[]
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
description String
|
||||
requiredLevel Int
|
||||
mainSkill Skill
|
||||
LessonHistory LessonHistory[]
|
||||
}
|
||||
|
||||
model LessonHistory {
|
||||
lesson Lesson @relation(fields: [lessonID], references: [id])
|
||||
lessonID Int
|
||||
user User @relation(fields: [userID], references: [id])
|
||||
userID Int
|
||||
lesson Lesson @relation(fields: [lessonID], references: [id])
|
||||
lessonID Int
|
||||
user User @relation(fields: [userID], references: [id])
|
||||
userID Int
|
||||
|
||||
@@id([lessonID, userID])
|
||||
@@id([lessonID, userID])
|
||||
}
|
||||
|
||||
enum Skill {
|
||||
TwoHands
|
||||
Rhythm
|
||||
NoteCombo
|
||||
Arpeggio
|
||||
Distance
|
||||
LeftHand
|
||||
RightHand
|
||||
LeadHandChange
|
||||
ChordComplexity
|
||||
ChordTiming
|
||||
Length
|
||||
PedalPoint
|
||||
Precision
|
||||
TwoHands
|
||||
Rhythm
|
||||
NoteCombo
|
||||
Arpeggio
|
||||
Distance
|
||||
LeftHand
|
||||
RightHand
|
||||
LeadHandChange
|
||||
ChordComplexity
|
||||
ChordTiming
|
||||
Length
|
||||
PedalPoint
|
||||
Precision
|
||||
|
||||
@@map("DifficultyPoint")
|
||||
@@map("DifficultyPoint")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user