Files
sp/apps/web/prisma/sase/schema.prisma
Semih f72dcc05ba feat(phase1b): sase.tr read-only connection
- prisma/sase/schema.prisma with User + UserSubscription (partial view)
- lib/db-sase.ts exports typed RO client
- /projects/sase shows live metrics (users count, new users 7d, active subs)
- seed marks sase as active

DATABASE_URL_SASE_RO wired to super_panel_reader (SELECT-only)
2026-05-13 10:38:03 +00:00

43 lines
1.6 KiB
Plaintext

// Partial view of Sase.tr public schema.
// Owned by the spoke; panel reads with super_panel_reader (SELECT only).
// Add models here only as panel features need them — keep the surface narrow.
generator client {
provider = "prisma-client-js"
output = "../../node_modules/.prisma/client-sase"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL_SASE_RO")
}
model User {
id String @id @default(uuid()) @db.Uuid
name String @db.VarChar(255)
email String @unique @db.VarChar(255)
emailVerified Boolean @default(false) @map("email_verified")
role String @default("user") @db.VarChar(20)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz(6)
@@map("users")
}
model UserSubscription {
id String @id @default(uuid()) @db.Uuid
userId String @map("user_id") @db.Uuid
planId String @map("plan_id") @db.Uuid
status String @default("pending") @db.VarChar(20)
billingPeriod String @default("monthly") @map("billing_period") @db.VarChar(10)
startDate DateTime? @map("start_date") @db.Timestamptz(6)
endDate DateTime? @map("end_date") @db.Timestamptz(6)
cancelledAt DateTime? @map("cancelled_at") @db.Timestamptz(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz(6)
@@index([status])
@@index([userId])
@@map("user_subscriptions")
}