goodeats / patn-remix

personal website built with remix run epic stack
0 stars 0 forks source link

Set up database #3

Open goodeats opened 1 year ago

goodeats commented 1 year ago

Set up database using the Prisma schema

chatgpt prompt result

model Page {
  id          Int      @id @default(autoincrement())
  title       String
  description String?
  published   Boolean  @default(false)
  order       Int
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
  contents    Content[]
}

model Content {
  id        Int      @id @default(autoincrement())
  title     String
  subtitle  String?
  body      String
  link      String?
  image     String?
  pageId    Int
  page      Page     @relation(fields: [pageId], references: [id])
  tags      Tag[]
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model Tag {
  id        Int      @id @default(autoincrement())
  name      String
  contentId Int
  content   Content @relation(fields: [contentId], references: [id])
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}