-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.js
34 lines (33 loc) · 1.15 KB
/
ormconfig.js
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
var dbConfig = {
synchronize: false,
};
switch (process.env.NODE_ENV) {
case 'development':
Object.assign(dbConfig, {
type: 'sqlite',
database: 'db.sqlite',
entities: ['**/*.entity.js'],
migrationsRun: true, //to make sure that migrations are ran before every single test we execute (this property is going to make sure that all of our different migrations get ran when we are starting up our db for each individual test)
});
break;
case 'test':
Object.assign(dbConfig, {
type: 'sqlite',
database: 'test.sqlite',
entities: ['**/*.entity.ts']
});
break;
case 'production':
Object.assign(dbConfig, {
type: 'postgres',
url: process.env.DATABASE_URL, //DATABASE_URL will be provided by Heroku
migrationsRun: true,
entities: ['**/*.entity.js'], //telling typeorm where our different entities are
ssl: {
rejectUnauthorized: false, //for Heroku
}
});
break;
default:
throw new Error('unknown enviroment');
}