The schema is the source of truth
Each model in schema.prisma becomes a table; each field a column. Attributes like @id, @default and @unique become primary keys, defaults and constraints — and the generated TypeScript types follow automatically.
Field types and attributes
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum Role {
CUSTOMER
STAFF
ADMIN
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
role Role @default(CUSTOMER)
points Int @default(0)
bio String? @map("biography")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([name])
}After changing the schema: npx prisma migrate dev --name add-points creates a migration file and updates the database.