liquibase/liquibase

tagDatabase tag allows for duplicate tag values

Open

#3,763 opened on Feb 1, 2023

View on GitHub
 (4 comments) (2 reactions) (0 assignees)Java (1,759 forks)batch import
TypeEnhancementfeatureTagsgood first issueneeds_response

Repository metrics

Stars
 (4,212 stars)
PR merge metrics
 (Avg merge 9d 11h) (19 merged PRs in 30d)

Description

Environment

Liquibase Version: 4.19.0

Liquibase Integration & Version: Gradle

Liquibase Extension(s) & Version: N/A

Database Vendor & Version: PostgreSQL 12

Operating System Type & Version: Mac OSX 13.1

Infrastructure Type/Provider: N/A

Description

The <tagDatabase> tag allows the same tag value to be created with different authors. We use <tagDatabase> at the start of a release. If two developers are concurrently making schema changes it's easy enough for both to inadvertently include their <tagDatabase> tags at commit/merge, resulting in multiple tags of the same version in databasechangelog. This muddies the waters around rollback via tag.

Steps To Reproduce

Example XML:

    <changeSet id="TAG-12.0" author="dev1">
        <tagDatabase tag="release/12.0"/>
    </changeSet>
    <changeSet id="TAG-12.0" author="dev2">
        <tagDatabase tag="release/12.0"/>
    </changeSet>

Actual Behavior

In this simple example LB creates the tag twice.

Running Changeset: db.changelog-v12.0.xml::TAG-12.0::dev1 [2023-02-01 11:12:35] INFO [liquibase.changelog] Tag 'release/12.0' applied to database [2023-02-01 11:12:35] INFO [liquibase.changelog] ChangeSet db.changelog-v12.0.xml::TAG-12.0::dev1 ran successfully in 1ms Running Changeset: db.changelog-v12.0.xml::TAG-12.0::dev2 [2023-02-01 11:12:35] INFO [liquibase.changelog] Tag 'release/12.0' applied to database [2023-02-01 11:12:35] INFO [liquibase.changelog] ChangeSet db.changelog-v12.0.xml::TAG-12.0::dev2 ran successfully in 0ms [2023-02-01 11:12:35] INFO [liquibase.lockservice] Successfully released change log lock Liquibase command 'update' was executed successfully.

In a more complicated example, dev3 might have tagged the database, made other changes and then dev4 might have inadvertently added their own same tag and made their changes.

Expected/Desired Behavior

My feeling is that one shouldn't be able to tag the database with the same value, or minimally there should be some warning. I'm not sure what the value in allowing the current behavior would be.

Screenshots (if appropriate)

Example of a more complex scenario this could impact. image

Additional Context

Thanks for your consideration.

Contributor guide