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 preconditions support for include/includeAll tags #6440

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cagliostro92
Copy link

Refs: #6354

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

Fixes #6354
This pull request is intended to add a new feature and allow the end user to leverage preconditions also from inside <include> and <includeAll> tags e.g.

<include file="include.xml" relativeToChangelogFile="true" logicalFilePath="included">
        <preConditions onFail="WARN">
            <changeLogPropertyDefined property="foo" value="bar"/>
        </preConditions>
</include>

To make it possible was added a new <sequence> tag for both <include> and <includeAll> tags inside dbchangelog-latest.xsd and was changed the DatabaseChangeLog class to allow the inclusion of include and includeAll nodes only after checking the preconditions.
The correctness is guaranteed through the following brand new integration tests:

Things to be aware of

@MalloD12 as previously discussed with you be aware that:

In this case not_include files will not be included

<includeAll path="not_include" relativeToChangelogFile="true">
        <preConditions onFail="WARN">
            <tableExists tableName="NOT_EXISTANT_TABLE" />
        </preConditions>
</includeAll>

While in this case they will be included. This is the reason behind the #1200, and this is our n°2 point discussion in #6354. The global preconditions seem to be always ignored, and changeset/include/includeAll are always parsed and included in the changelog. I'm going to leave this PR in draft state so that you can tell me your preference about the handling of this situation.

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

    <preConditions onFail="WARN">
        <tableExists tableName="NOT_EXISTANT_TABLE"/>
    </preConditions>
    <includeAll path="not_include" relativeToChangelogFile="true">
    </includeAll>
</databaseChangeLog>

Things to worry about

Additional Context

@MalloD12
Copy link
Collaborator

Hi @cagliostro92,

I think if this PR is ready, we can probably work on its review next week. One thing, @wwillard7800 made us notice is that we would need to resolve some merge conflicts once #6381 gets merged since a DatabaseChangeLog refactoring has been made there. I'll make sure to keep you posted about it.

At first glance, this PR looks good to me, but we will conduct a deeper review soon.

Thanks,
Daniel.

@cagliostro92 cagliostro92 marked this pull request as ready for review October 23, 2024 10:54
@cagliostro92
Copy link
Author

Hi @MalloD12,
The PR is ready, I'm going to remove the draft state. When the other incoming changes will be merged, feel free to ping me and I'll do a rebase.
Thank you.

@MalloD12
Copy link
Collaborator

Hi @cagliostro92,

I've been reviewing and doing a bit of manual testing, and this PR looks good to me. I have only posted a few minor comments, but I think this is ready to move forward and allow other team members to look at it. However, if you don't mind, I would like to wait for the approval until making sure the rebase with #6381 is all good.

Thanks,
Daniel.

@cagliostro92
Copy link
Author

Hi @cagliostro92,

I've been reviewing and doing a bit of manual testing, and this PR looks good to me. I have only posted a few minor comments, but I think this is ready to move forward and allow other team members to look at it. However, if you don't mind, I would like to wait for the approval until making sure the rebase with #6381 is all good.

Thanks, Daniel.

Hi @MalloD12,
I completely agree. Let me know when the #6381 is merged, so that we will test the whole codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Development
Development

Successfully merging this pull request may close these issues.

Add precondition support for Include/IncludeAll changes
2 participants