-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Defines "-- rollback empty" as the way to specify "no rollback needed". #3324
Defines "-- rollback empty" as the way to specify "no rollback needed". #3324
Conversation
…eeded". Also add verbose output in cases it may have been missed.
…eeded". Also add verbose output in cases it may have been missed.
055b960
to
3371590
Compare
…' of https://github.com/liquibase/liquibase into 3069-how-to-specify-an-empty-rollback-using-sql-dialect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review:
Things to be aware of:
- Adds "empty" as a keyword meaning "no rollback". It is checked case insensitively
- Added an integration test for rollback in general for formatted sql
- Test harness failures are unrelated
Things to worry about:
- Nothing
@@ -827,6 +827,10 @@ public void rollback(Database database, ChangeExecListener listener) throws Roll | |||
List<Change> changes = getChanges(); | |||
for (int i = changes.size() - 1; i >= 0; i--) { | |||
Change change = changes.get(i); | |||
if (change instanceof RawSQLChange) { | |||
throw new RollbackFailedException("Liquibase does not support automatic rollback generation for raw " + | |||
"sql changes (did you mean to specify keyword \"empty\" to ignore rolling back this change?)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message! Is great!
liquibase-integration-tests/src/test/java/liquibase/dbtest/AbstractIntegrationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, @filipelautert! Can you please take a look at my comment in the test class? If I am misunderstanding something, let me know; otherwise, please remove the duplication. The rest of the code looks good.
CHANGES REQUESTED
Hi @XDelphiGrl - duplicated code removed! Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are instances where you may not need to define a rollback for a specific change in a formatted SQL changelog. However, without defining one, commands such as rollback-count
fail due to missing rollback SQL for a raw SQL change. This PR allows users to specify changesets that do not require a rollback statement by adding --rollback empty
to the changeset.
- New integration test added.
- No additional testing necessary.
APPROVED
Impact
Description
Things to be aware of
Things to worry about
Documentation needs to be updated to add the new magic word:
I found those 2 pages, but any other pages having the expression "" may be a candidate.
Additional Context
Documentation update to reflect this new feature: liquibase/liquibase-docs#164