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

Why flyway cannot execute sql again when last time execution failed? #3892

Open
FloriaLI opened this issue May 10, 2024 · 2 comments
Open

Why flyway cannot execute sql again when last time execution failed? #3892

FloriaLI opened this issue May 10, 2024 · 2 comments

Comments

@FloriaLI
Copy link

We are using flyway 7.0.0 and mysql 8.0.25, when I tried to create sql and reverse sql to be executed by flyway, I did the complete opposite. So first time the execution failed and there's a fail execution history log in database table 'flyway_schema_history'.
image

Then I reversed the content of the two sql files and recommit, expecting to execution again for the last execution log is tagged as fail. However, the sql file did not be executed by flyway just because this version have been executed (even if the execution was actually failed).I seached on Internet and the solutions are just delete the failed history or update the filename to update the version. That's not a good experience.

I agree that we should not repeatedly execution sql when it was executed successfully and should create new sql file to do afterwards operations. However, when flyway check if a sql file was executed, shall we considered if it was executed successfully instead?Yeah , I mean check if the latest execution history log success=1.

ps : I readed the latest source code and I'm suprised to see that if a sql version was executed failed , flyway will return a fail state and immediately throw a FlywayValidateException in Flyway.migrate() method. Is it an operation to force developers to delete the failed history in database or update a new version? I don't think that's a good choice. May be a repeated execution on the failed version should be allowed even it is not marked as repeatable?
RyRG8bot1d

@Barry-RG
Copy link
Contributor

Thank you for your issue. Do you get this same issue with the latest version of Flyway?

@FloriaLI
Copy link
Author

I'm sorry that I can't change the unified version used in our company. However, as I mentioned before, the latest source code shows if a sql version was executed failed , flyway will return a fail state and immediately throw a FlywayValidateException. In other words, there's similar issue with the latest version of Flyway.

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

No branches or pull requests

2 participants