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 support for DropDatabase #17

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

Add support for DropDatabase #17

wants to merge 2 commits into from

Conversation

scorixear
Copy link

Checklist

  • I have read the Contributing Guide
  • I have checked to ensure this does not introduce an unintended breaking changes
  • I have considered appropriate testing for my change

Description

Adds three additional extension methods for SupportedDatabasesForDropDatabase allowing MySql to be used
in the same manner as the DbUp.SqlServer package.

DbUp.DropDatabase.For.MySqlDatabase(connectionstring);

Method signatures and implementation are mainly taken from DbUp.SqlServer and the already existent SupportedDatabasesForEnsureDatabase extension methods.

DbUp.SqlServer introduces an additional alter statement before dropping

ALTER DATABASE [{databaseName}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

There is no equivalent in MySql for this.
The possibility to read lock all databases with

FLUSH TABLES WITH READ LOCK;

was considered but not implemented as it affects all databases. The drop command will fail fast, if any connection is still present.

@droyad droyad enabled auto-merge (squash) July 29, 2024 07:05
droyad
droyad previously approved these changes Jul 29, 2024
Copy link
Member

@droyad droyad left a comment

Choose a reason for hiding this comment

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

Very nice, thank you. Going into v5.

@droyad droyad self-assigned this Jul 29, 2024
auto-merge was automatically disabled July 29, 2024 15:29

Head branch was pushed to by a user without write access

@scorixear
Copy link
Author

@droyad Not sure why the test is failing, I have reordered the methods in the ApprovalFiles, maybe that fixes something

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