feat(migrasi) config migrasi

pull/2/head
ashar 2024-06-03 16:22:13 +07:00
parent f5c1008ece
commit 35b9ffd306
1 changed files with 16 additions and 0 deletions

16
src/database/ormconfig.ts Normal file
View File

@ -0,0 +1,16 @@
import { DataSource } from 'typeorm';
import * as dotenv from 'dotenv';
dotenv.config();
export const connectionSource = new DataSource({
type: 'postgres',
host: process.env.DEFAULT_DB_HOST,
port: parseInt(process.env.DEFAULT_DB_PORT),
username: process.env.DEFAULT_DB_USER,
password: process.env.DEFAULT_DB_PASS,
database: process.env.DEFAULT_DB_NAME,
entities: ['src/modules/user-related/**/data/models/*.ts'],
migrationsTableName: 'migrations',
migrations: ['src/database/migrations/*.ts'],
synchronize: false,
});