mirror of
https://github.com/FranP-code/spooky-spotify-showcase.git
synced 2025-10-13 00:02:36 +00:00
110 lines
3.1 KiB
Plaintext
110 lines
3.1 KiB
Plaintext
// 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"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Post {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([name])
|
|
}
|
|
|
|
model SpookyImage {
|
|
id Int @id @default(autoincrement()) // Auto-incrementing ID
|
|
key String @unique // The key must be unique
|
|
value String // Value associated with the key
|
|
createdAt DateTime @default(now()) // Timestamp for when the entry was created
|
|
updatedAt DateTime @updatedAt // Auto-updating timestamp for when the entry was last updated
|
|
}
|
|
|
|
model GeneratedImage {
|
|
id Int @id @default(autoincrement()) // Auto-incrementing ID
|
|
key String @unique // The key must be unique
|
|
value String // Value associated with the key
|
|
createdAt DateTime @default(now()) // Timestamp for when the entry was created
|
|
updatedAt DateTime @updatedAt // Auto-updating timestamp for when the entry was last updated
|
|
}
|
|
|
|
model ArtistImage {
|
|
id String @id @default(uuid())
|
|
url String
|
|
artistId String
|
|
artist Artist @relation(fields: [artistId], references: [id])
|
|
}
|
|
|
|
model Artist {
|
|
id String @id @default(uuid())
|
|
name String
|
|
images ArtistImage[]
|
|
|
|
UserData UserData[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Album {
|
|
id String @id @default(uuid())
|
|
name String
|
|
images AlbumImage[]
|
|
tracks Track[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// UserData UserData[]
|
|
}
|
|
|
|
model AlbumImage {
|
|
id String @id @default(uuid())
|
|
url String
|
|
albumId String
|
|
album Album @relation(fields: [albumId], references: [id])
|
|
}
|
|
|
|
model SpotifyUserImage {
|
|
id String @id @default(uuid())
|
|
url String
|
|
spotifyUserId String
|
|
spotifyUser SpotifyUser @relation(fields: [spotifyUserId], references: [id])
|
|
}
|
|
|
|
model Track {
|
|
id String @id @default(uuid())
|
|
name String
|
|
albumId String
|
|
album Album @relation(fields: [albumId], references: [id])
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model SpotifyUser {
|
|
id String @id @default(uuid())
|
|
spotifyUserId String @unique
|
|
displayName String?
|
|
images SpotifyUserImage[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
UserData UserData[]
|
|
}
|
|
|
|
model UserData {
|
|
id Int @id @default(autoincrement()) // Auto-incrementing ID
|
|
artists Artist[] // Relation to the Artist model
|
|
// albums Album[] // Relation to the Album model
|
|
tracksByAlbum String
|
|
spotifyUserId String
|
|
spotifyUser SpotifyUser @relation(fields: [spotifyUserId], references: [id])
|
|
} |