Skip to content

Commit

Permalink
allow for typeorm migrations path override (#71)
Browse files Browse the repository at this point in the history
fix(typeorm_setup): provide env override for migrations
  • Loading branch information
deweyjose authored and goldcaddy77 committed Mar 19, 2019
1 parent 0e9d0b8 commit 8a8aaf6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/code-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
host: process.env.TYPEORM_HOST || 'localhost',
logger: 'advanced-console',
logging: process.env.TYPEORM_LOGGING || 'all',
migrations: ['db/migrations/**/*.ts'],
migrations: process.env.TYPEORM_MIGRATIONS ? process.env.TYPEORM_MIGRATIONS.split(',') : ['src/migration/**/*.ts'],
namingStrategy: new SnakeNamingStrategy(),
password: process.env.TYPEORM_PASSWORD,
port: parseInt(process.env.TYPEORM_PORT || '', 10) || 5432,
Expand Down
4 changes: 3 additions & 1 deletion src/torm/createConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ function getBaseConfig() {
host: process.env.TYPEORM_HOST || 'localhost',
logger: 'advanced-console',
logging: process.env.TYPEORM_LOGGING || 'all',
migrations: ['src/migration/**/*.ts'],
migrations: process.env.TYPEORM_MIGRATIONS
? process.env.TYPEORM_MIGRATIONS.split(',')
: ['src/migration/**/*.ts'],
namingStrategy: new SnakeNamingStrategy(),
password: process.env.TYPEORM_PASSWORD,
port: parseInt(process.env.TYPEORM_PORT || '', 10) || 5432,
Expand Down

0 comments on commit 8a8aaf6

Please sign in to comment.