feat: add TenantConnectionManager with dynamic pool management
- Adds pg dependency for direct PostgreSQL connections to tenant DBs - TenantConnectionManager: singleton managing Map<tenantId, Pool> - provisionDatabase: creates new DB with tables and indexes - deprovisionDatabase: soft-deletes by renaming DB - Automatic idle pool cleanup every 60s (5min threshold) - Max 3 connections per pool (6/tenant with 2 PM2 workers) - Graceful shutdown support for all pools Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"node-cron": "^4.2.1",
|
||||
"node-forge": "^1.3.3",
|
||||
"pg": "^8.18.0",
|
||||
"zod": "^3.23.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -41,6 +42,7 @@
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/node-cron": "^3.0.11",
|
||||
"@types/node-forge": "^1.3.14",
|
||||
"@types/pg": "^8.18.0",
|
||||
"prisma": "^5.22.0",
|
||||
"tsx": "^4.19.0",
|
||||
"typescript": "^5.3.0"
|
||||
|
||||
Reference in New Issue
Block a user