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

Defines "-- rollback empty" as the way to specify "no rollback needed". #3324

Merged

Conversation

filipelautert
Copy link
Collaborator

@filipelautert filipelautert commented Sep 29, 2022

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

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

…eeded". Also add verbose output in cases it may have been missed.
@github-actions
Copy link

github-actions bot commented Sep 29, 2022

Unit Test Results

  4 668 files  ±    0    4 668 suites  ±0   32m 29s ⏱️ - 3m 37s
  4 624 tests  -     3    4 388 ✔️  - 13     236 💤 +  10  0 ±0 
54 696 runs  +168  49 468 ✔️ +  3  5 228 💤 +165  0 ±0 

Results for commit a94c850. ± Comparison against base commit 59ca536.

♻️ This comment has been updated with latest results.

@filipelautert filipelautert force-pushed the 3069-how-to-specify-an-empty-rollback-using-sql-dialect branch from 055b960 to 3371590 Compare September 30, 2022 19:04
Copy link
Contributor

@nvoxland nvoxland left a 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?)");
Copy link
Contributor

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!

Copy link
Contributor

@XDelphiGrl XDelphiGrl left a 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

@filipelautert
Copy link
Collaborator Author

Hi @XDelphiGrl - duplicated code removed! Thanks

Copy link
Contributor

@XDelphiGrl XDelphiGrl left a 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

@nvoxland nvoxland merged commit 3db588d into master Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

How to specify an Empty Rollback using SQL Dialect
5 participants