ab4db641b0
Adds the Prisma schema (Request/Job models, RequestStatus/JobState enums), a Prisma client singleton at web/src/lib/db.ts, and the init_request_job migration, applied and verified against Postgres. Also publishes the db service's port (5432:5432) in docker-compose.yml so host-run Prisma commands can reach localhost:5432 for local dev.
47 lines
937 B
Plaintext
47 lines
937 B
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum RequestStatus {
|
|
pending
|
|
completed
|
|
needs_attention
|
|
}
|
|
|
|
enum JobState {
|
|
requested
|
|
matching
|
|
matched
|
|
downloading
|
|
tagging
|
|
imported
|
|
needs_attention
|
|
}
|
|
|
|
model Request {
|
|
id String @id @default(cuid())
|
|
artist String
|
|
album String
|
|
status RequestStatus @default(pending)
|
|
createdAt DateTime @default(now())
|
|
job Job?
|
|
}
|
|
|
|
model Job {
|
|
id String @id @default(cuid())
|
|
request Request @relation(fields: [requestId], references: [id], onDelete: Cascade)
|
|
requestId String @unique
|
|
state JobState @default(requested)
|
|
currentStage String @default("intake")
|
|
attempts Int @default(0)
|
|
error String?
|
|
claimedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|