every entity represent table
Int
, Float
, String
, Blob
, Json
, Unsupported("")
, other model like Article
, or enum (in next slide)types can appended by
?
which mean optional, or[]
for arrays
model User {
id Int @id @default(autoincrement()) // @id mean primary_key
email String @unique
name String?
articles Article[]
}
model Article {
id Int @id @default(autoincrement())
titleString
body String?
author User @relation(fields: [authorId], refrences: [id]) // used to connect article to user
authorId Int // register which user rigesterd to
}
enums represented as simple tables
model User {
name String
role Role @default(BAISC)
}
enum Role {
BAISC
EDITOR
ADMIN
}