calckey/src/ormconfig.ts

24 lines
507 B
TypeScript
Raw Normal View History

2019-05-14 14:54:39 +00:00
import * as fs from 'fs';
import config from './config';
2019-06-29 06:31:54 +00:00
import { entities as charts } from './services/chart/entities';
2019-05-14 14:54:39 +00:00
const json = {
type: 'postgres',
host: config.db.host,
port: config.db.port,
username: config.db.user,
password: config.db.pass,
database: config.db.db,
extra: config.db.extra,
2019-06-29 06:31:54 +00:00
entities: [
'src/models/entities/*.ts',
...charts as any
],
2019-05-14 14:54:39 +00:00
migrations: ['migration/*.ts'],
cli: {
migrationsDir: 'migration'
}
};
fs.writeFileSync('ormconfig.json', JSON.stringify(json));