Skip to content

Commit

Permalink
feat: exit on error in load
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Mar 29, 2020
1 parent 255a39d commit 8940352
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ async function load(options) {
preventEnv('production', options.env)

const env = getCommandEnv(options)
const command = `${getCommand(options, 'psql')} < ${structurePath}`
const command = `${getCommand(
options,
'psql',
)} -v ON_ERROR_STOP=1 -f ${structurePath}`

return exec(wrapDockerCommand(options, command), { env })
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function getInsertsFromMigrations(migrationsPath) {
if (!(await exists(migrationsPath))) return []
const migrations = await glob('*.js', { cwd: migrationsPath })
return migrations.map(
migration =>
(migration) =>
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('${migration}', 1, NOW());`,
)
}
Expand Down

0 comments on commit 8940352

Please sign in to comment.