Skip to content

Instantly share code, notes, and snippets.

@goyalmohit
Created March 4, 2019 19:49
Show Gist options
  • Save goyalmohit/a0e850eee02d378e6320be8b4083fd49 to your computer and use it in GitHub Desktop.
Save goyalmohit/a0e850eee02d378e6320be8b4083fd49 to your computer and use it in GitHub Desktop.
drop a table using precondition in liquibase
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="mohitgoyal" id="20190304224600">
<preConditions onFail="HALT">
<sqlCheck expectedResult="0">select count(*) from customer</sqlCheck>
</preConditions>
<comment>Make sure that no data exists in the table before you drop it</comment>
<dropTable tableName="customer"/>
</changeSet>
</databaseChangeLog>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment