-
Notifications
You must be signed in to change notification settings - Fork 3
/
ormconfig.ts
51 lines (48 loc) · 1.15 KB
/
ormconfig.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { SnakeNamingStrategy } from 'typeorm-naming-strategies'
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions'
import { DB_DATABASE, DB_HOST, DB_PASSWORD, DB_USERNAME } from './src/config/Env'
/**
* Connection options interface.
*
* @interface
*/
interface IConnectionOptions extends PostgresConnectionOptions {
readonly seeds: string[]
readonly factories: string[]
}
/**
* Orm configuration.
*
* @constant
*/
const ormconfig: IConnectionOptions = {
type: 'postgres',
host: DB_HOST,
username: DB_USERNAME,
password: DB_PASSWORD,
database: DB_DATABASE,
logging: false,
synchronize: false,
entities: [
'src/database/models/**/*.{ts,js}',
],
subscribers: [
'src/database/subscribers/*.{ts,js}',
],
migrations: [
'src/database/migrations/*.{ts,js}',
],
seeds: [
'src/database/seeds/*.{ts,js}',
],
factories: [
'src/database/factories/*.{ts,js}',
],
cli: {
entitiesDir: 'src/database/models',
migrationsDir: 'src/database/migrations',
subscribersDir: 'src/database/models',
},
namingStrategy: new SnakeNamingStrategy(),
}
module.exports = ormconfig