datasource DS { provider = ["sqlite", "postgresql"] url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" binaryTargets = "native" } // sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode // enum Role { // USER // ADMIN // } // enum PartType { // CASCADESTUDIO // JSCAD // } model User { userName String @id email String @unique // role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev // maybe let netlify handle roles for now. // role String @default("user") createdAt DateTime @default(now()) updatedAt DateTime @updatedAt image String? // url maybe id or file storage service? cloudinary? bio String? //mark down Part Part[] Reaction PartReaction[] Comment Comment[] } model Part { id String @unique @default(uuid()) title String description String? // markdown string code String? mainImage String? // link to cloudinary createdAt DateTime @default(now()) updatedAt DateTime @updatedAt author User @relation(fields: [authorUserName], references: [userName]) authorUserName String Comment Comment[] Reaction PartReaction[] @@id([title, authorUserName]) @@unique([title, authorUserName]) } model PartReaction { emote String // an emoji userId String user User @relation(fields: [userId], references: [userName]) partId String part Part @relation(fields: [partId], references: [id]) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@unique([emote, userId, partId]) } model Comment { id String @id @default(uuid()) text String // the comment, should I allow mark down? user User @relation(fields: [id], references: [userName]) part Part @relation(fields: [id], references: [id]) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }