Should be able to delete repeatable migration scripts

See original GitHub issue
Which version and edition of Flyway are you using?

6.0.6

If this is not the latest version, can you reproduce the issue with the latest one as well?

n/a

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Command-line

Which database are you using (type & version)?

Oracle 18.3

Which operating system are you using?

Windows 10

What did you do?

I created a repeatable migration containing a single stored procedure. At a later date I wanted to delete the stored procedure and the associated repeatable migration.

I tried deleting the repeatable migration script, but this resulted in Flyway considering the repeatable migration to be Missing with no way to indicate that it was deliberately removed. The only other option I could see was to empty the repeatable migration script but keep the file.

Neither of these two options are great solutions because either I have to maintain an empty, redundant repeatable migration script or I constantly get Missing entries in my Flyway info queries.

What did you expect to see?

I would expect to be able to delete repeatable migration scripts completely from my Flyway project. The flyway_schema_history table could either have all entries for that repeatable migration removed, or a new entry could be created marked as something other than Missing (e.g. Deleted) so that history is maintained.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MikielAgutucommented, Feb 24, 2020

We’re thought about this, and our proposal is:

  • Scripts that are deleted should rightfully marked as ‘missing’
    • To alert users of scripts that no longer exist
  • Amend the repair command to mark ‘missing’ scripts as ‘deleted’
  • ‘deleted’ scripts that subsequently re-appear are considered pending

Unfortunately, to implement this feature properly we probably need to update the schema history table. This is a significant change which can only really be made in a major version bump (i.e V7). So it’ll have to wait until then.

2reactions
seb-urbaniakcommented, Oct 23, 2019

+1 (& in a perfect world it would also be able to handle DBobject Renames (ie. DEL+ADD) in a clean fashion)

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the best way to remove repeatable scripts from Flyway ...
To do this I would have a new migration script (V3.1.5.1.01__DropProcedureOne.sql) but I would also remove the repeatable migration script so ...
Read more >
Tutorial: Repeatable Migrations - Flyway
This brief tutorial will teach how to use repeatable migrations. It will take you through the steps on how to create and use...
Read more >
Concepts :: Evolve
The repeatable migration is applied whenever its content changes. It does not have a version and is executed sorted by name after all...
Read more >
Migrations - Flyway - Product Documentation
Undo migrations assume the whole migration succeeded and should now be undone. This does not help with failed versioned migrations on databases ...
Read more >
Flyway Repair With Spring Boot - Baeldung
It's generally recommended never to change successfully applied migrations. But there might be cases where there is no way around it. So, in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found