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

Reverted version of a repeatable script should be reapplied. #1358

davazp opened this issue Jul 9, 2016 · 1 comment

Reverted version of a repeatable script should be reapplied. #1358

davazp opened this issue Jul 9, 2016 · 1 comment


Copy link

davazp commented Jul 9, 2016

What version of Flyway are you using?

Flyway 4.0.3 by Boxfuse

What database are you using (type & version)?

SQL Server 2016 Developer Edition

What operating system are you using?

Microsoft Windows 10

What did you do?
  • I created a repeatable script to create/alter a stored procedure.
  • I migrated the database.
  • I made a change to the migration script
  • I remigrated the database successfully again.
  • I reverted the change to the repeatable script.
  • I tried to remigrate the database but it was not reapplied.
What did you expect to see?

The checksum of the migration changed, so I expected the script would be reapplied.

What did you see instead?

But it wasn't applied. I had a look to the schema_version table and all previous versions are recorded. I guess that Flyway checks if the checksum already exists.

Proposed solution

I think the current scripts' checksum should be compared with the checksums of the latest version of the applied scripts in the database.

That is, if a given checksum is in something like:

select checksum
from <schema>.schema_version sv1
where version is null
  and not exists (
    select 1 from <schema>.schema_version sv2
    where sv1.script = sv2.script and sv1.installed_rank < sv2.installed_rank

this way we would still be able to rename a script without applying it again.

Copy link

Thanks for reporting! Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants