mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
65 lines
1.4 KiB
Plaintext
65 lines
1.4 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 = "mysql"
|
|
url = env("DATABASE_URL")
|
|
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
google_id String @unique
|
|
email String @unique
|
|
name String?
|
|
image String?
|
|
is_admin Boolean @default(false)
|
|
|
|
categories Category[]
|
|
links Link[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Category {
|
|
id Int @id @default(autoincrement())
|
|
name String @db.VarChar(255)
|
|
links Link[]
|
|
|
|
author User @relation(fields: [authorId], references: [id])
|
|
authorId Int
|
|
|
|
nextId Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("category")
|
|
}
|
|
|
|
model Link {
|
|
id Int @id @default(autoincrement())
|
|
name String @db.VarChar(255)
|
|
description String? @db.VarChar(255)
|
|
url String @db.Text
|
|
|
|
category Category @relation(fields: [categoryId], references: [id])
|
|
categoryId Int
|
|
|
|
author User @relation(fields: [authorId], references: [id])
|
|
authorId Int
|
|
|
|
favorite Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("link")
|
|
}
|