Skip to content

fix: ensure migrate:make respects destroyOnExit config#374

Open
mx1700 wants to merge 1 commit intokysely-org:mainfrom
mx1700:fix/migrate-make-destroy-on-exit
Open

fix: ensure migrate:make respects destroyOnExit config#374
mx1700 wants to merge 1 commit intokysely-org:mainfrom
mx1700:fix/migrate-make-destroy-on-exit

Conversation

@mx1700
Copy link
Copy Markdown

@mx1700 mx1700 commented Mar 19, 2026

Summary

  • When passing a pre-configured Kysely instance via kysely config option, migrate:make command would not destroy the instance after execution
  • This causes the process to hang when connection pool settings like maxIdle create persistent connections
  • Other commands like migrate:up, migrate:down, migrate:list already use usingKysely() wrapper which handles cleanup

Root Cause

The MakeCommand implementation directly called getConfigOrFail() and then proceeded to create the migration file without wrapping execution in usingKysely(). This skipped the destroyOnExit cleanup logic.

Fix

Wrap the migrate:make command execution in usingKysely() to ensure destroyOnExit logic is applied consistently with other commands.

// Before
const config = await getConfigOrFail(args)
// ... create migration file

// After  
await usingKysely(config, async () => {
  // ... create migration file
})

Testing

  • All 67 existing tests pass
  • Build completes successfully

Related

Addresses issue where migrate:make hangs after creating migration file when using connection pool settings like maxIdle=2 in database URL.

When passing a pre-configured Kysely instance via 'kysely' config option,
migrate:make command would not destroy the instance after execution,
causing the process to hang when connection pool settings like
'maxIdle' create persistent connections.

This change wraps the migrate:make command execution in usingKysely()
to ensure destroyOnExit logic is applied consistently with other commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant