# HG changeset patch # User Oleksandr Gavenko # Date 1450865972 -7200 # Node ID e66fcbaf99faa9a07d4b4bd6def86284366d3be0 # Parent 2aaf1f0297f9be3cbe7919f809c58206a067556a Split changesets into files. How big chould be changeset? diff -r 2aaf1f0297f9 -r e66fcbaf99fa liquibase.rst --- a/liquibase.rst Tue Dec 22 22:29:09 2015 +0200 +++ b/liquibase.rst Wed Dec 23 12:19:32 2015 +0200 @@ -68,6 +68,11 @@ Now my file is safely can be applied to production database without loosing data and can recreate new schema in empty database. + * http://www.operatornew.com/2012/11/automatic-db-migration-for-java-web.html + * http://www.baeldung.com/liquibase-refactor-schema-of-java-app + * http://www.liquibase.org/documentation/existing_project.html + * http://www.liquibase.org/tutorial-using-oracle + Generate difference between databases. ====================================== @@ -292,7 +297,7 @@ SQL syntax also have ``logicalFilePath`` attribute for top level file mark -(implemented in v3.3): +(implemented in v3.3):: --liquibase formatted sql logicalFilePath:legacy.sql @@ -329,3 +334,65 @@ ``liquibase-core/src/main/java/liquibase/parser/core/formattedsql/FormattedSqlChangeLogParser.java`` for further info . +Split changesets into files. +============================ + +It is not possible to split file formatted in SQL LiquiBase syntax. + +It is not possible to set tag with SQL LiquiBase syntax. To workaround this +issue you may split SQL file and set tags in XML sytax:: + + + + + + + + + + + + + +Also you should be interested in storing stored procedures in separate file and +apply ``runOnChange`` attribure for XML syntax:: + + + + CREATE OR REPLACE PROCEDURE hello AS + BEGIN + DBMS_OUTPUT.PUT_LINE('Hello'); + END; + + + +or with SQL syntax:: + + --changeset admin:proc-hello runOnChange:true + CREATE OR REPLACE PROCEDURE hello AS + BEGIN + DBMS_OUTPUT.PUT_LINE('Hello'); + END; + +Some people suggest to use one file per stored procedure / package. + +How big chould be changeset? +============================ + +Less is better. + +Some databases doesn't support transactional DDL (e.g. Oracle, SQL Server), each +DDL statement should be put into a single changeset. + +Putting unrelated operations into single changeset leads to trouble when last or +intermediate of them fail to apply. + +Try to group constraint adding in corresponding update statements. If you have +wrong update that doesn't prepare data to constraint it shouldn't be commited +but rewritten. + + * http://blog.mgm-tp.com/2010/11/data-modeling-part2/ +