Can you clear the Liquibase checksums for this file only?

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 checksums for changesets in db.changelog-next.xml.

thank

+3


source to share


2 answers


I don't think there is another command or parameter for clearCheckSums

that does this.

But you can do it manually. All it clearCheckSums

does is nullify the MD5SUM

table column databasechangelog

.

So something like:



update databasechangelog set md5sum=null where filename like '%db.changelog-next.xml';

      

must work.

(I have not tested this SQL. This is just an example - so make sure it works in your development db before applying this in your production database.)

+9


source


If you are using the Maven plugin for Liquibase you might have something like this in your pom.xml file where you use clearCheckSum as a parameter for each execution (you can split the files like I did 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 parameterized build with Maven by adding default values:

<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>

      

0


source







All Articles