How do I trim my changelog?
Often the changelog file is so large that it causes performance issues in your editor, or there are too many merge conflicts.
Procedure
The best way to handle this is to divide your changelog file into multiple files.
1
Create a main.changelog.xml file
Instead of having a single changelog.xml
file with everything in it, create a main.changelog.xml
file which uses the include tag to reference other changelog files.
changelog.xml file example
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
<include file="com/example/news/news.changelog.xml"/>
<include file="com/example/directory/directory.changelog.xml"/>
</databaseChangeLog>
2
Run the liquibase update command
When you run liquibase update
against the main.changelog.xml
file, changesets in com/example/news/news.changelog.xml
will run and then the changesets in com/example/directory/directory.changelog.xml
will run. You can break up changesets by feature, release, or other ways.