Posts

Showing posts with the label Liquibase

Create Function From SQL Script By Liquibase

Answer : I think you need to add the endDelimiter clause in the Liquibase tag, based on the documentation found here Below is an example <changeSet author="newbie" id="function_rad2deg" dbms="mysql,h2"> <sqlFile encoding="utf8" path="sql/function_rad2deg.sql" relativeToChangelogFile="true" splitStatements="false" stripComments="false" endDelimiter="\nGO" /> </changeSet> Your SQL file with the above delimiter would then look like DROP FUNCTION IF EXISTS rad2deg; GO CREATE FUNCTION rad2deg(rad DOUBLE) RETURNS DOUBLE BEGIN RETURN (rad * 180 / PI()); END GO Hope this helps With above example there are two problems one is it will not work on h2 and 2 is splitStatements should be true: <changeSet author="me" id="01_functions_mysql" dbms="mysql"> <sqlFile encoding...

Alter Column Length With Liquibase

Answer : You can increase the size of your column like this: <changeSet author="liquibase" id="sample"> <modifyDataType columnName="description" newDataType="varchar(2000)" tableName="account"/> </changeSet> The schema defintion in your xml file doesn't allow <modifyDataType ... /> . The version of the xsd file should match the version of Liquibase you are using. The exception looks like you are using the xsd of version 1.9, see http://www.liquibase.org/documentation/xml_format.html