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

CORE-1127: Filter by context when doing a rollback. #898

Conversation

berryh
Copy link
Contributor

@berryh berryh commented Jul 12, 2019

[X] BUG

When a changelog file contains two changesets with same author and id but with different contexts, only the first changeset has its rollback block applied when rolling back. Liquibase will always choose the first changeset without taking the context into account. See the issue for an example of this behaviour. This pull request is an option to fix this, by filtering on context before actually doing the rollback.

It adds unit tests to make sure it run correctly.

JIRA Issue: CORE-1127

@datical-jenkins datical-jenkins changed the title CORE-1127: Filter by context when doing a rollback. LB-66 ⁃ CORE-1127: Filter by context when doing a rollback. Mar 4, 2020
@datical-jenkins datical-jenkins changed the title LB-66 ⁃ CORE-1127: Filter by context when doing a rollback. CORE-1127: Filter by context when doing a rollback. Mar 5, 2020
@ro-rah
Copy link

ro-rah commented May 12, 2020

Hi @berryh , Sorry for the wait. There appears to be conflicts that need to be resolved, would you mind doing that.

After which I can pull this into Conditioning targeting a 4.0 Beta 2 release.

@ro-rah
Copy link

ro-rah commented May 12, 2020

@berryh while you are working on the conflict, we could use your help in writing tests, which in turn would help get this PR merged in faster.

Here is the canned response I have been sending out now that our PR process has been jump started, it contains some good guidance on tests:Thanks for your pull request!

Here’s what happens next:

A member of the Liquibase team will take a look at your contribution and may suggest:

The PR will be prioritized according to our internal development and testing capacity.

We’ll let you know when it’s ready to move to the next step or if any changes are needed.

@filipelautert filipelautert self-requested a review November 7, 2022 14:16
…ontext

# Conflicts:
#	liquibase-core/src/main/java/liquibase/changelog/AbstractChangeLogHistoryService.java
#	liquibase-core/src/main/java/liquibase/changelog/ChangeLogIterator.java
#	liquibase-core/src/main/java/liquibase/changelog/ChangeSet.java
#	liquibase-core/src/main/java/liquibase/changelog/DatabaseChangeLog.java
@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Nov 7, 2022
@github-actions
Copy link

github-actions bot commented Nov 7, 2022

Unit Test Results

  4 740 files  ±  0    4 740 suites  ±0   36m 36s ⏱️ + 3m 29s
  4 710 tests +20    4 477 ✔️ +23     233 💤  - 3  0 ±0 
55 536 runs  +36  50 219 ✔️ +27  5 317 💤 +9  0 ±0 

Results for commit 0b4834d. ± Comparison against base commit c865c6d.

♻️ This comment has been updated with latest results.

@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Nov 8, 2022
@berryh
Copy link
Contributor Author

berryh commented Nov 8, 2022

Hi all, sorry for the long silence! Nice to see this PR progressing, if there's still anything you need from me, please let me know!

@filipelautert
Copy link
Collaborator

Hi @berryh , after ro-rah comment in 2020 I thought you went MIA. I merged master to your branch and added some integration tests, if you want to take a look and see if it's all fine for you let me know.

@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Nov 8, 2022
@berryh
Copy link
Contributor Author

berryh commented Nov 8, 2022

Fair enough, nice work! I remember seeing the comment and saying that I'd have to take a look at it later, but never got around to it. Nice to see this being picked up!

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.

This PR addresses a long-standing bug where Liquibase rollback commands ignore some <rollback> changes because Liquibase was not applying contexts during rollback.

  • New integration test added to validate rollback by count uses contexts when contexts matching changeset-specified context are provided.
  • New integration test added to validate rollback by count is successful when no contexts are provided and the changesets themselves do not specify a context.
  • Functional and test harness automation suites passing.
  • No additional testing required.

APPROVED

@filipelautert filipelautert merged commit 344f471 into liquibase:master Nov 18, 2022
@filipelautert filipelautert added this to the 4.18.0 milestone Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DBAll featureContext featureRollback ImpactHigh IntegrationMaven RiskHigh Items that require more extensive testing, change an existing API, or add new features. SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions ThemeChangeTypes TypeEnhancement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

8 participants