Precondition in databaseChangeLog should allow to skip the whole file
See original GitHub issueEnvironment
Liquibase Version: 3.4
Liquibase Integration & Version: CLI
Liquibase Extension(s) & Version:
Database Vendor & Version:
Operating System Type & Version:
Description
There is no option to conditionally include a file or to skip executing file if preConditions in databaseChangeLog fails
Steps To Reproduce
List the steps to reproduce the behavior.
- Create ABC table
- Execute:
<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-3.4.xsd'>
<preConditions onFail="CONTINUE"> <!-- CONTINUE not supported -->
<not><tableExists tableName="ABC"/></not>
</preConditions>
<include file="tables.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Actual Behavior
It fails because preConditions in databaseChangeLog supports only WARN and HALT. CONTINUE is not supported:
org.xml.sax.SAXParseException: cvc-enumeration-valid: Value 'CONTINUE' is not facet-valid with respect to enumeration '[HALT, WARN]'. It must be a value from the enumeration.
Expected/Desired Behavior
When ABC table exists, the whole databaseChangeLog should be skipped.
Additional Context
It was reported before: https://liquibase.jira.com/browse/CORE-1421 https://liquibase.jira.com/browse/CORE-917
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Preconditions | Liquibase Docs
Preconditions. Preconditions are changelog or changeset tags which control the execution of an update based on the state of the database.
Read more >Liquibase - How to skip changesets that have been executed
Is there a precondition at the changelog level that I can use to indicate "skip already executed changesets'? Or do I just create...
Read more >Check database state and conditionally apply changes in the ...
Preconditions can be attached to changelogs or changesets to control the execution of an update based on the state of the database.
Read more >How to fail Liquibase changeset when prerequisites are missing
</databaseChangeLog>. When the data file has more than 10GB of free space, the changeset executes, but when the precondition fails, you can ......
Read more >Get Started | Core Liquibase Usage Concepts
These changelog files are stored in source control to enable collaboration. ... Preconditions can be applied to either the changelog as a whole...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@CristianDuta It depends on your situation. We have some changelog files that we omit in order to reduce the number being loaded. In particular we now have e.g. changelog-2021-onwards.xml which is linked from changelog-2020-onwards.xml, and for production systems we set a year for database updates so we don’t load all the XML for changes that have all been applied. For CI, we also add in contexts to apply test data and some feature toggles.
What about this feature? Is it in process?