Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Flyway clean doesn't remove partition schemes and functions #2447
Which version and edition of Flyway are you using?
Flyway 5 and Flyway 6 Beta
If this is not the latest version, can you reproduce the issue with the latest one as well?
(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Which database are you using (type & version)?
SQL Server 2017
Which operating system are you using?
What did you do?
(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
What did you expect to see?
Partition scheme and partition functions should not exist anymore in the DB
What did you see instead?
Partition scheme and partition functions were still in the DB. As a workaround I added the following code to afterClean.sql callback to remove them:
CREATE TABLE #Commands (Command VARCHAR(MAX)); INSERT #Commands SELECT 'DROP PARTITION SCHEME ' + QUOTENAME(name) + '; ' FROM sys.partition_schemes; INSERT #Commands SELECT 'DROP PARTITION FUNCTION ' + QUOTENAME(name) + '; ' FROM sys.partition_functions; DECLARE @Command VARCHAR(MAX); DECLARE curCommand CURSOR FOR SELECT Command FROM #Commands; OPEN curCommand; FETCH NEXT FROM curCommand INTO @Command; WHILE @@FETCH_STATUS =0 BEGIN EXEC(@Command); FETCH NEXT FROM curCommand INTO @Command; END; CLOSE curCommand; DEALLOCATE curCommand; DROP TABLE #Commands;