first commit
This commit is contained in:
90
packages/api/prisma/schema.prisma
Normal file
90
packages/api/prisma/schema.prisma
Normal file
@@ -0,0 +1,90 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Recipe {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
description String?
|
||||
prepTime Int? // minutes
|
||||
cookTime Int? // minutes
|
||||
totalTime Int? // minutes
|
||||
servings Int?
|
||||
imageUrl String?
|
||||
sourceUrl String? // For imported recipes
|
||||
author String?
|
||||
cuisine String?
|
||||
category String?
|
||||
rating Float?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
ingredients Ingredient[]
|
||||
instructions Instruction[]
|
||||
images RecipeImage[]
|
||||
tags RecipeTag[]
|
||||
|
||||
@@index([title])
|
||||
@@index([cuisine])
|
||||
@@index([category])
|
||||
}
|
||||
|
||||
model Ingredient {
|
||||
id String @id @default(cuid())
|
||||
recipeId String
|
||||
name String
|
||||
amount String?
|
||||
unit String?
|
||||
notes String?
|
||||
order Int
|
||||
|
||||
recipe Recipe @relation(fields: [recipeId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([recipeId])
|
||||
}
|
||||
|
||||
model Instruction {
|
||||
id String @id @default(cuid())
|
||||
recipeId String
|
||||
step Int
|
||||
text String @db.Text
|
||||
imageUrl String?
|
||||
|
||||
recipe Recipe @relation(fields: [recipeId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([recipeId])
|
||||
}
|
||||
|
||||
model RecipeImage {
|
||||
id String @id @default(cuid())
|
||||
recipeId String
|
||||
url String
|
||||
order Int
|
||||
|
||||
recipe Recipe @relation(fields: [recipeId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([recipeId])
|
||||
}
|
||||
|
||||
model Tag {
|
||||
id String @id @default(cuid())
|
||||
name String @unique
|
||||
recipes RecipeTag[]
|
||||
}
|
||||
|
||||
model RecipeTag {
|
||||
recipeId String
|
||||
tagId String
|
||||
|
||||
recipe Recipe @relation(fields: [recipeId], references: [id], onDelete: Cascade)
|
||||
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([recipeId, tagId])
|
||||
@@index([recipeId])
|
||||
@@index([tagId])
|
||||
}
|
||||
Reference in New Issue
Block a user