Allow multiple hosting servers per sold version.

Drop unique tenant_id on server_accounts and add create/update/delete/renew APIs per server account, with list/expiring using the worst status.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 19:23:37 +03:30
co-authored by Cursor
parent c6d90ea262
commit f61d10e07b
5 changed files with 316 additions and 100 deletions
+4 -2
View File
@@ -71,7 +71,8 @@ model Tenant {
updatedAt DateTime @updatedAt @map("updated_at")
auditLogs AuditLog[]
smsAccount SmsAccount?
serverAccount ServerAccount?
/// 0..N hosting/billing servers per sold version (not the same as nodeServer API URL)
serverAccounts ServerAccount[]
pluginSubscriptions PluginSubscription[]
@@index([product])
@@ -187,7 +188,7 @@ model AuditLog {
/// isDedicated=false → we manage charge/renewal/expiry alerts.
model ServerAccount {
id String @id @default(cuid())
tenantId String @unique @map("tenant_id")
tenantId String @map("tenant_id")
isDedicated Boolean @default(false) @map("is_dedicated")
serverName String? @map("server_name")
specs String?
@@ -209,6 +210,7 @@ model ServerAccount {
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
charges ServerCharge[]
@@index([tenantId])
@@index([expiresAt])
@@index([isDedicated])
@@map("server_accounts")