Skip to content

Commit 8940352

Browse files
committed
feat: exit on error in load
1 parent 255a39d commit 8940352

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/load.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ async function load(options) {
1212
preventEnv('production', options.env)
1313

1414
const env = getCommandEnv(options)
15-
const command = `${getCommand(options, 'psql')} < ${structurePath}`
15+
const command = `${getCommand(
16+
options,
17+
'psql',
18+
)} -v ON_ERROR_STOP=1 -f ${structurePath}`
1619

1720
return exec(wrapDockerCommand(options, command), { env })
1821
}

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export async function getInsertsFromMigrations(migrationsPath) {
55
if (!(await exists(migrationsPath))) return []
66
const migrations = await glob('*.js', { cwd: migrationsPath })
77
return migrations.map(
8-
migration =>
8+
(migration) =>
99
`INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('${migration}', 1, NOW());`,
1010
)
1111
}

0 commit comments

Comments
 (0)