Closed thenbe closed 1 month ago
Current: kysely seed run exits with exit code 0 when the seed operation encounters an error (such as unique constraint violation).
kysely seed run
Expected: kysely seed run exits with exit code 1 when the seed operation encounters an error
Example output where the seed fails, yet the cli command returns with exit code 0:
$ pnpm kysely seed run ⚙ { rawArgs: [], args: { _: [], debug: false }, data: undefined, cmd: { meta: { description: 'Run seed files', name: 'run' }, args: { cwd: [Object], debug: [Object], environment: [Object], 'no-outdated-check': [Object], specific: [Object] }, run: [AsyncFunction: run] } } [] ◐ Starting seed run ⚙ { config: { dialect: PostgresDialect {}, migrations: { migrationFolder: 'src/migrations' }, seeds: { seedFolder: 'src/seeds' } }, ⚙ { error: { error: duplicate key value violates unique constraint "foo_bar_id_key" at node_modules/pg/lib/client.js:526:17 length: 217, severity: 'ERROR', code: '23505', detail: 'Key (bar_id)=(1) already exists.', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'foo', column: undefined, dataType: undefined, constraint: 'foo_bar_id_key', file: 'nbtinsert.c', line: '664', routine: '_bt_check_unique' }, results: [ { seedName: '1719484759291_init', status: 'Error' } ] } ℹ Ran 1 seed: [✗] 1719484759291_init - error: duplicate key value violates unique constraint "foo_bar_id_key"
Hey 👋
Thank you for raising this!
Fixed in https://github.com/kysely-org/kysely-ctl/releases/tag/v0.8.11.
Current:
kysely seed run
exits with exit code 0 when the seed operation encounters an error (such as unique constraint violation).Expected:
kysely seed run
exits with exit code 1 when the seed operation encounters an errorExample output where the seed fails, yet the cli command returns with exit code 0: