Last active
March 11, 2016 16:20
-
-
Save stefanborghys/5197947 to your computer and use it in GitHub Desktop.
Drop a trigger from an Oracle database using Liquibase (http://www.liquibase.org).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" | |
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../xsd/dbchangelog-2.0.xsd | |
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../xsd/dbchangelog-ext.xsd" | |
logicalFilePath="drop_trigger_changelog.xml"> | |
<changeSet id="1" author="stefanborghys" runOnChange="true"> | |
<preConditions onFail="MARK_RAN"> | |
<sqlCheck expectedResult="1"> | |
SELECT DECODE(COUNT(*),0,0,1) FROM DBA_OBJECTS WHERE OBJECT_TYPE = 'TRIGGER' AND OBJECT_NAME = 'TRIGGER_NAME'; | |
</sqlCheck> | |
</preConditions> | |
<comment>Drop a trigger from an Oracle database.</comment> | |
<sql><![CDATA[DROP TRIGGER TRIGGER_NAME;]]></sql> | |
<rollback> | |
<![CDATA[ | |
create or replace | |
trigger SCHEMA_NAME.TRIGGER_NAME | |
BEFORE INSERT OR UPDATE ON TABLE_NAME | |
BEGIN | |
-- The trigger's logic | |
END; | |
]]> | |
</rollback> | |
</changeSet> | |
</databaseChangeLog> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the same syntax should you wish to drop an Oracle package. There aren't many in the wild but still good to know. (e.g.