-
Notifications
You must be signed in to change notification settings - Fork 52
/
ormconfig.js
42 lines (39 loc) · 1.06 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
35
36
37
38
39
40
41
42
const getPathDependentOptions = () => {
if (process.env.COMPILED_JS) {
return {
entities: [`${__dirname}/dist/node/database/entities/**/*.js`],
migrations: [`${__dirname}/dist/node/database/migrations/*.js`],
migrationsDir: "dist/node/database/migrations",
};
} else {
return {
entities: [`${__dirname}/src/node/database/entities/**/*.ts`],
migrations: [`${__dirname}/src/node/database/migrations/*.ts`],
migrationsDir: "src/node/database/migrations",
};
}
};
const { entities, migrations, migrationsDir } = getPathDependentOptions();
const baseOptions = {
cli: {
migrationsDir,
},
entities,
host: "localhost",
logging: false,
migrations,
password: "admin",
port: 5432,
type: "postgres",
username: "postgres",
autoLoadEntities: true,
};
module.exports = [
Object.assign({}, baseOptions, { name: "defaultdb", database: "defaultdb" }),
Object.assign({}, baseOptions, {
name: "defaultdb_test",
database: "defaultdb_test",
synchronize: true,
logging: process.env.LOG === "1",
}),
];