feat(db): DATABASE_URL и общий Postgres (Postgres_TG_Bots), БД clinic_tests
Made-with: Cursor
This commit is contained in:
@@ -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...');
|
||||
|
||||
Reference in New Issue
Block a user