remix-demo

react router (remix) demo

git clone https://9o.is/git/remix-demo.git

schema.prisma

(716B)


      1 datasource db {
      2   provider = "postgresql"
      3   url      = env("DATABASE_URL")
      4 }
      5 
      6 generator client {
      7   provider = "prisma-client-js"
      8 }
      9 
     10 enum Role {
     11   USER
     12   ADMIN
     13 }
     14 
     15 model User {
     16   id          String @id @default(cuid())
     17   name        String
     18   email       String @unique
     19   role        Role @default(USER)
     20   foodEntries FoodEntry[]
     21   threshold   Int
     22 
     23   createdAt DateTime @default(now())
     24   updatedAt DateTime @updatedAt
     25 }
     26 
     27 model FoodEntry {
     28   id       String @id @default(cuid())
     29   name     String
     30   consumed DateTime
     31   calories Int
     32   
     33   createdAt DateTime @default(now())
     34   updatedAt DateTime @updatedAt
     35 
     36   user   User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
     37   userId String
     38 }