8000 Disconnect database connections before attempting to drop database by rolftimmermans · Pull Request #204 · TalentBox/sequel-rails · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Disconnect database connections before attempting to drop database #204

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

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

rolftimmermans
Copy link

Disconnecting all connections before attempting to drop the database solves a very common and annoying issue for me, where open connections created by the Rails application are still present when attempting to drop the test database.

It manifests itself as:

dropdb: error: database removal failed: ERROR:  database "rails-app-test" is being accessed by other users
DETAIL:  There is 1 other session using the database.
Couldn't drop database for environment test
createdb: error: database creation failed: ERROR:  database "rails-app-test" already exists
Could not create database for test.

This change fixes the problem.

Disconnecting all connections before attempting to drop the database solves a very common and annoying issue for me, where open connections created by the Rails application are still present when attempting to drop the test database.

It manifests itself as:
```
dropdb: error: database removal failed: ERROR:  database "rails-app-test" is being accessed by other users
DETAIL:  There is 1 other session using the database.
Couldn't drop database for environment test
createdb: error: database creation failed: ERROR:  database "rails-app-test" already exists
Could not create database for test.
```

This change fixes the problem.
@JonathanTron
Copy link
Member

Hi @rolftimmermans, thanks for the PR, it's a good idea. I'll merge it and see why the tests are failing.

@JonathanTron JonathanTron merged commit 56e0019 into TalentBox:master Mar 6, 2025
11 of 21 checks passed
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
0