Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to terminate all existing connections to the database when resetting a database #239

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AustinShelby
Copy link

Description

This PR introduces a new --force option for the graphile-migrate reset command, which allows terminating existing connections to the database when dropping it.

I often face a case during end-to-end testing when before each test case I want to reset the database. Unfortunately due to some lingering connections from previous tests, the graphile-migrate reset command sometimes throws an error as expected. This change allows to bypass that limitation.

Performance impact

Unknown.

Security impact

Unknown.

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

);
if (force) {
await pgClient.query(
`DROP DATABASE IF EXISTS ${escapeIdentifier(databaseName)} WITH (FORCE);`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in PG13, so this is technically supported by all supported versions of PostgreSQL now. Interesting.

@benjie
Copy link
Member

benjie commented Mar 14, 2025

Thanks for the PR... I shall search my feelings 🤔

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.

2 participants