Ops-dashboard/prisma/schema.prisma
Scrum4Me Agent cce0f25419 feat: Prisma schema, migrations en seed voor auth en audit-log
- Models: User, Session, FlowRun, FlowStep met FlowStatus enum
- prisma.config.ts met DATABASE_URL via @prisma/adapter-pg (Prisma 7 API)
- Initiële migratie applied op ops_dashboard database
- Seed-script voor 1 user via SEED_USER_EMAIL/SEED_USER_PASSWORD env-vars
- lib/prisma.ts als gedeelde singleton client voor Next.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 17:04:27 +02:00

59 lines
1.3 KiB
Text

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
enum FlowStatus {
pending
running
success
failed
cancelled
}
model User {
id String @id @default(cuid())
email String @unique
pwd_hash String
created_at DateTime @default(now())
sessions Session[]
flow_runs FlowRun[]
}
model Session {
id String @id @default(cuid())
user_id String
token_hash String @unique
expires_at DateTime
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
}
model FlowRun {
id String @id @default(cuid())
user_id String
flow_key String
status FlowStatus @default(pending)
dry_run Boolean @default(false)
started_at DateTime @default(now())
ended_at DateTime?
exit_code Int?
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
steps FlowStep[]
}
model FlowStep {
id String @id @default(cuid())
flow_run_id String
step_index Int
command_key String
args_json String?
stdout String?
stderr String?
exit_code Int?
started_at DateTime @default(now())
ended_at DateTime?
flow_run FlowRun @relation(fields: [flow_run_id], references: [id], onDelete: Cascade)
}