feat(database): add pgbouncer support and optimize postgres config

- Add pgbouncer service to handle connection pooling
- Update database connection URIs to support direct and pooled connections
- Optimize postgres configuration with better memory settings
- Update prisma schema to support directUrl connection
This commit is contained in:
guilherme
2025-07-08 17:14:37 -03:00
parent 39606240da
commit 3b920f93c5
3 changed files with 36 additions and 11 deletions

View File

@@ -9,8 +9,9 @@ generator client {
}
datasource db {
provider = "postgresql"
url = env("DATABASE_CONNECTION_URI")
provider = "postgresql"
url = env("DATABASE_CONNECTION_URI")
directUrl = env("DATABASE_DIRECT_CONNECTION_URI")
}
enum InstanceConnectionStatus {
@@ -376,8 +377,8 @@ model TypebotSetting {
debounceTime Int? @db.Integer
typebotIdFallback String? @db.VarChar(100)
ignoreJids Json?
splitMessages Boolean? @default(false) @db.Boolean
timePerChar Int? @default(50) @db.Integer
splitMessages Boolean? @default(false) @db.Boolean
timePerChar Int? @default(50) @db.Integer
createdAt DateTime? @default(now()) @db.Timestamp
updatedAt DateTime @updatedAt @db.Timestamp
Fallback Typebot? @relation(fields: [typebotIdFallback], references: [id])
@@ -748,4 +749,4 @@ model EvoaiSetting {
evoaiIdFallback String? @db.VarChar(100)
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
instanceId String @unique
}
}