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

Add rollback changeset reference for SQL changelogs #1386

Merged

Conversation

atzawada
Copy link
Contributor

@atzawada atzawada commented Sep 8, 2020


name: Add rollback changeset reference for SQL changelogs
about: Add rollback changeset reference for SQL changelogs
title: ''
labels: Status:Discovery
assignees: ''


Environment

Liquibase Version:

Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>

Liquibase Extension(s) & Version:

Database Vendor & Version:

Operating System Type & Version:

Pull Request Type

Closes #1335.

  • Bug fix (non-breaking change which fixes an issue.)
  • Enhancement/New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Code to introduce referencing another changeset in a rollback statement in a SQL changelog file.

Current Behavior

Liquibase currently doesn't have any behavior to allow for referencing another changeset in a SQL rollback statement.

Desired Behavior

The new code would allow for this functionality, using either;

--rollback changeSetId:create-table-demo changeSetAuthor:atzawada changeSetPath:src/main/resources/testCreate.sql

if the changeset being referenced is in a different changelog file, or:

--rollback changeSetId:create-table-demo changeSetAuthor:atzawada

if the changeset is in the same changelog file.

Fast Track PR Acceptance Checklist:

@molivasdat
Copy link
Contributor

Thanks @atzawada for creating this enhancement request.
Here’s what happens next:

A member of the Liquibase team will take a look at your contribution and may suggest
changes, additional tests, or provide other feedback. The PR will be prioritized
according to our 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.

If you have any unit tests or integration tests to add that would be great.

@awhitford-cip
Copy link

What is the hold up on this PR? Can I help? Because I am interested in this functionality.

@kataggart
Copy link
Contributor

@awhitford-cip The hold up is that we are fortunate to have a high volume of community requests and are continually working on how best to address them. Some folks are also right now on much needed vacation, but we will review.

@kataggart kataggart removed this from To Do in Conditioning++ Aug 10, 2022
@atzawada
Copy link
Contributor Author

Hi @kataggart, @awhitford-cip, completely understand the difficulty getting to this with the high volume of PRs coming in. Still willing to help get this in if there are changes that need to be made.

@liquibase liquibase deleted a comment from codecov bot Aug 22, 2022
@nvoxland nvoxland self-requested a review as a code owner August 29, 2022 16:04
@nvoxland nvoxland changed the base branch from master to 1_9 August 29, 2022 16:05
@nvoxland nvoxland changed the base branch from 1_9 to master August 29, 2022 16:05
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 and test results:

Things to be aware of:

  • Change only impacts formatted sql (other formats already had this feature)
  • Pattern match is case insensitive like it should be
  • I added a unit test and some additional error handling

Things to worry about:

  • Nothing

The changes look good, thanks @atzawada !

@nvoxland nvoxland added the SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions label Aug 29, 2022
@github-actions
Copy link

Unit Test Results

  4 620 files  ±0    4 620 suites  ±0   35m 0s ⏱️ + 1m 59s
  4 615 tests ±0    4 400 ✔️ ±0     215 💤 ±0  0 ±0 
54 552 runs  ±0  49 532 ✔️ ±0  5 020 💤 ±0  0 ±0 

Results for commit 278f0de. ± Comparison against base commit 19a15f5.

@FBurguer FBurguer self-assigned this Sep 1, 2022
@FBurguer
Copy link

FBurguer commented Sep 5, 2022

For this PR, I tested if rollback reference works with a changeset on the same changelog and with one in another changeset. Both work just fine. Theres a couple behaviors that called my atention and think is good to share and be aware about:
-You cant reference a changeset from a changelog that isnt in the same root changelog as the call.
-Liquibase reads the changelogs in order, so if you have a changeset with a rollback changeset reference on changelog1.sql and have the reference changeset on changelog2.sql, liquibase will fail with "changeset doesnt exists"

Test Environment:
Java 8
Windows 10
Postgres 13 conatiner

@nvoxland nvoxland merged commit b01df65 into liquibase:master Sep 6, 2022
@kataggart kataggart added this to the NEXT milestone Sep 6, 2022
@kataggart
Copy link
Contributor

@awhitford-cip @atzawada This is now available in 4.16 that released on Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DBAll featureRollback featureTags formattedSQL ImpactLow IntegrationAny SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-33 TypeEnhancement
Projects
Archived in project
7 participants