feat(schema): Account model with AccountStatus enum, optional Group.accountId

Adds Account model (platform, jid, sessionPath, displayName, status) with
AccountStatus enum (ACTIVE/DISCONNECTED/BANNED) and optional accountId FK
on Group for multi-account WhatsApp session tracking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 17:07:39 +05:30
parent 705bd177e8
commit a7aa8bf5a9
2 changed files with 48 additions and 1 deletions
+23 -1
View File
@@ -4,7 +4,7 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
url = env("../../../DATABASE_URL")
}
model Group {
@@ -14,6 +14,8 @@ model Group {
name String
description String?
isActive Boolean @default(true)
accountId String?
account Account? @relation(fields: [accountId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -91,3 +93,23 @@ model ConsentRecord {
@@unique([groupId, memberJid, consentType])
}
enum AccountStatus {
ACTIVE
DISCONNECTED
BANNED
}
model Account {
id String @id @default(cuid())
platform String
jid String
sessionPath String
displayName String?
status AccountStatus @default(ACTIVE)
groups Group[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([platform, jid])
}