Running
liquibase --url=jdbc:oracle:thin:@localhost:1521/XE -- driver=oracle.jdbc.OracleDriver --changeLogFile=db.changelog-next.xml -- username=owner --password=xxxx --logLevel=info clearCheckSums clears ALL checksums from the database. Is there a way to clear only the checksums for changesets in db.changelog-next.xml.
Thanks
2 Answers
I don't think there is another command or a parameter to clearCheckSums that does this.
But you could do this manually. All that clearCheckSums does is nullifying the MD5SUM column of the databasechangelog table.
So something like:
update databasechangelog set md5sum=null where filename like '%db.changelog-next.xml'; should work.
(I haven't tested this SQL. It's just an example - so before you apply this to your production database make sure this works on a development db.)
1If you are using a Maven plugin for Liquibase, you may have something like this on your pom.xml file, where you use clearCheckSum as a parameter for each execution(you may want to split the files as I did in here):
<build> <plugins> <plugin> <!--NOTE: clearCheckSums=true attribute will make the changesets run only once. The runOnChange attribute added to changesets will not work as originally intended.--> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <version>${database.liquibase.version}</version> <executions> <execution> <id>admin-schema-database-update</id> <phase>process-resources</phase> <configuration> <changeLogFile>admin-schema.db.changelog-master.xml</changeLogFile> <driver>${database.driver}</driver> <contexts>${database.liquibasecontext}</contexts> <url>${database.server.url}</url> <username>${database.adminschema.username}</username> <password>${database.adminschema.password}</password> <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> <outputDefaultSchema>true</outputDefaultSchema> <verbose>true</verbose> <logging>${database.liquibase.logging}</logging> <propertyFileWillOverride>false</propertyFileWillOverride> <clearCheckSums>${liquibase.clearCheckSums}</clearCheckSums> </configuration> <goals> <goal>update</goal> </goals> </execution> <execution> <id>user-schema-database-update</id> <phase>process-resources</phase> <configuration> <changeLogFile>user-schema.db.changelog-master.xml</changeLogFile> <driver>${database.driver}</driver> <contexts>${database.liquibasecontext}</contexts> <url>${database.server.url}</url> <username>${database.username}</username> <password>${database.password}</password> <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> <outputDefaultSchema>true</outputDefaultSchema> <verbose>true</verbose> <logging>${database.liquibase.logging}</logging> <propertyFileWillOverride>false</propertyFileWillOverride> <clearCheckSums>${liquibase.clearCheckSums}</clearCheckSums> </configuration> <goals> <goal>update</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.liquibase.ext</groupId> <artifactId>liquibase-mssql</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.liquibase.ext</groupId> <artifactId>liquibase-oracle</artifactId> <version>3.1</version> </dependency> </dependencies> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.xml</include> <include>**/*.csv</include> <include>**/*.sql</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <excludes> <exclude>**/*.xml</exclude> <exclude>**/*.csv</exclude> <exclude>**/*.sql</exclude> </excludes> </resource> </resources> </build> You can always use the parameterized build with Maven, adding default values as:
<properties> <liquibase.clearCheckSums>true</liquibase.clearCheckSums> <database.username>userSchema</database.username> <database.password>myUserPassword</database.password> <database.adminschema.username>adminSchema</database.adminschema.username> <database.adminschema.password>myAdminPassword</database.adminschema.password> <database.liquibasecontext>!IntegrationTesting</database.liquibasecontext> </properties>