2025-10-08 04:19:15 +00:00
|
|
|
import 'dotenv/config';
|
|
|
|
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
|
|
|
import { Pool } from 'pg';
|
|
|
|
|
import * as schema from './schema';
|
|
|
|
|
|
2025-10-21 02:28:51 +00:00
|
|
|
// PostgreSQL Configuration
|
2025-10-08 04:19:15 +00:00
|
|
|
const pool = new Pool({
|
|
|
|
|
database: process.env.POSTGRES_DB,
|
|
|
|
|
host: process.env.POSTGRES_HOST,
|
|
|
|
|
port: Number(process.env.POSTGRES_PORT),
|
|
|
|
|
user: process.env.POSTGRES_USER,
|
|
|
|
|
password: process.env.POSTGRES_PASSWORD,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const db = drizzle({
|
|
|
|
|
client: pool,
|
|
|
|
|
schema,
|
|
|
|
|
});
|
|
|
|
|
|
2025-10-21 02:28:51 +00:00
|
|
|
// Export both PostgreSQL and Oracle connections
|
2025-10-08 04:19:15 +00:00
|
|
|
export default db;
|
2025-10-21 02:28:51 +00:00
|
|
|
export { executeOracleQuery, getOraclePool, closeOraclePool } from './oracle';
|