forked from energywebfoundation/origin-247-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ormconfig-dev.ts
34 lines (31 loc) · 1001 Bytes
/
ormconfig-dev.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { ConnectionOptions } from 'typeorm';
const getDBConnectionOptions = (): ConnectionOptions => {
return process.env.DATABASE_URL
? {
type: 'postgres',
url: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false
}
}
: {
type: 'postgres',
host: process.env.DB_HOST ?? 'localhost',
port: Number(process.env.DB_PORT) ?? 5432,
username: process.env.DB_USERNAME ?? 'postgres',
password: process.env.DB_PASSWORD ?? 'postgres',
database: process.env.DB_DATABASE ?? 'origin'
};
};
const config: ConnectionOptions = {
...getDBConnectionOptions(),
entities: ['src/**/*.entity.ts'],
synchronize: false,
migrationsRun: true,
migrations: ['migrations/*.ts'],
migrationsTableName: 'migrations_247_transfer',
cli: {
migrationsDir: 'migrations'
}
};
export = config;