Skip to content

Instantly share code, notes, and snippets.

@mellumeriktest
Created October 20, 2024 01:37
Show Gist options
  • Save mellumeriktest/0ac8c19fe87a7108ff3a2f1b2a8e4b9f to your computer and use it in GitHub Desktop.
Save mellumeriktest/0ac8c19fe87a7108ff3a2f1b2a8e4b9f to your computer and use it in GitHub Desktop.
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
model User {
user_id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
// recipes Recipe[]
}
model Ingredient {
ingredient_id String @id @default(cuid())
name String?
description String?
ingredient_measurements IngredientMeasurement[]
}
model Recipe {
recipe_id String @id @default(cuid())
name String?
description String?
ingredient_measurements IngredientMeasurement[]
// user User @relation(fields: [user_id], references: [user_id])
// user_id String
}
model IngredientMeasurement {
@@id([ingredient_id, recipe_id])
ingredient_id String
ingredient Ingredient @relation(fields: [ingredient_id], references: [ingredient_id])
recipe Recipe @relation(fields: [recipe_id], references: [recipe_id])
recipe_id String
unit String
quantity Int @default(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment