DbUp / dbup-mysql

MySQL provider for DbUp
MIT License
2 stars 9 forks source link

Add support for DropDatabase #17

Open scorixear opened 1 month ago

scorixear commented 1 month ago

Checklist

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.

scorixear commented 1 month ago

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