feat(db): DATABASE_URL и общий Postgres (Postgres_TG_Bots), БД clinic_tests

Made-with: Cursor
This commit is contained in:
Константин Лебединский
2026-04-24 20:16:22 +05:00
parent c381283ee4
commit 675555531f
8 changed files with 199 additions and 13 deletions
+2 -10
View File
@@ -6,18 +6,10 @@
import { readFileSync, readdirSync } from 'fs';
import { join } from 'path';
import pg from 'pg';
import { getPoolConfig } from './poolConfig.js';
const { Pool } = pg;
// Database configuration
const dbConfig = {
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT || '5433', 10),
database: process.env.DB_NAME || 'clinic_tests',
user: process.env.DB_USER || 'developer',
password: process.env.DB_PASSWORD || 'dev_password',
};
const MIGRATIONS_DIR = join(process.cwd(), 'src', 'db', 'migrations');
/**
@@ -81,7 +73,7 @@ async function executeMigration(pool, filename) {
* Main migration function
*/
async function migrate() {
const pool = new Pool(dbConfig);
const pool = new Pool(getPoolConfig());
try {
console.log('Connecting to database...');