3.12 Liquibaseを使用した例
Liquibase機能を使用して、データベース変更管理タスクを実行する例を示します。
3.12.4 RunOracleScriptを使用したカスタムSQLの実行
RunOracleScript変更セットを作成して表を作成し、PL/SQL変数をスクリプトで使用します。
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:n0="http://www.oracle.com/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet id="runScriptString" author="jdoe">
<n0:runOracleScript objectName="myScript" ownerName="JDOE"
sourceType="STRING">
<n0:source><![CDATA[
DEFINE table_name = RUNNERSTRING;
create table &&table_name (id number);
]]></n0:source>
</n0:runOracleScript>
</changeSet>
</databaseChangeLog>