Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created April 3, 2021 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuc-arc-f/8ce490b04f5a3f669d9bd59978ee8375 to your computer and use it in GitHub Desktop.
Save kuc-arc-f/8ce490b04f5a3f669d9bd59978ee8375 to your computer and use it in GitHub Desktop.
prisma / mysql schema file
// 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")
}
generator client {
provider = "prisma-client-js"
}
model Post {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String @db.VarChar(255)
content String?
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId Int
}
model Profile {
id Int @default(autoincrement()) @id
bio String?
user User @relation(fields: [userId], references: [id])
userId Int @unique
}
model User {
id Int @default(autoincrement()) @id
email String @unique
name String?
posts Post[]
profile Profile?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment