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:
@@ -0,0 +1,4 @@
|
||||
-- Allow multiple hosting servers per sold version (tenant).
|
||||
DROP INDEX IF EXISTS "public"."server_accounts_tenant_id_key";
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "server_accounts_tenant_id_idx" ON "public"."server_accounts"("tenant_id");
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user