author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 22 Feb 2016 12:46:36 +0200 | |
changeset 1905 | fba288d59662 |
parent 1844 | 7427de2e34ea |
child 1912 | 8b81a8f0f692 |
permissions | -rw-r--r-- |
1838
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
.. -*- coding: utf-8; -*- |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
.. include:: HEADER.rst |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
3 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
============ |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
LiquiBase. |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
============ |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1844
diff
changeset
|
8 |
:local: |
1838
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
Introducing LiquiBase to existing project. |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
========================================== |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
12 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
Official statement about introducing LiquiBase to existing project are: |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
14 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
15 |
http://www.liquibase.org/documentation/existing_project.html |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
16 |
Adding Liquibase on an Existing project |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
17 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
18 |
There are two approaches: |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
19 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
20 |
* create full schema definition prior to introducing Liquibase |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
21 |
* works only with current changes becase Liquibase basically work only with changesets and only |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
22 |
special supplied instruments care about full schema definition |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
23 |
|
1840
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
24 |
To create full schema definition in LiquiBase XML changelog format you may run:: |
1838
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
25 |
|
1840
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
26 |
$ mvn liquibase:generateChangeLog -Dliquibase.outputChangeLogFile=... |
1838
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
27 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
28 |
on clean project without Liquibase. Or set name for changelog output file in ``pom.xml``. |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
29 |
(here reduced not fully worked declaration):: |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
30 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
31 |
<plugin> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
32 |
<groupId>org.liquibase</groupId> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
33 |
<artifactId>liquibase-maven-plugin</artifactId> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
34 |
<version>${liquibase.version}</version> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
35 |
<configuration> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
36 |
<outputChangeLogFile>changelog.xml</outputChangeLogFile> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
37 |
</configuration> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
38 |
</plugin> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
39 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
40 |
.. NOTE:: |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
41 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
42 |
``pom.xml`` settings have precedence over ``-Dliquibase.outputChangeLogFile=...`` unless you |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
43 |
define it as:: |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
44 |
|
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
45 |
<properties> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
46 |
<liquibase.outputChangeLogFile>${project.build.directory}/changelog.xml</liquibase.outputChangeLogFile> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
47 |
</properties> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
48 |
<plugins> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
49 |
<plugin> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
50 |
<configuration> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
51 |
<outputChangeLogFile>${liquibase.outputChangeLogFile}</outputChangeLogFile> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
52 |
</configuration> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
53 |
</plugin> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
54 |
</plugins> |
031c61d1a8bd
Introducing LiquiBase to existing project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
55 |
|
1840
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
56 |
To create full schema definition in LiquiBase SQL format you may first to dump |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
57 |
your schema definition:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
58 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
59 |
$ mysqldump --no-data -u $USER -p $DB_NAME > schema.sql |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
60 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
61 |
then check ``schema.sql`` for danger operations. For example I forget to add |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
62 |
``--skip-add-drop-table`` option to ``mysqldump`` and so remove any ``DROP |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
63 |
TABLE`` lines by editor. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
64 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
65 |
Becase we already have tables I replace ``CREATE TABLE`` statements with:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
66 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
67 |
CREATE TABLE IF NOT EXISTS |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
68 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
69 |
Now my file is safely can be applied to production database without loosing |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
70 |
data and can recreate new schema in empty database. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
71 |
|
1842
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
72 |
* http://www.operatornew.com/2012/11/automatic-db-migration-for-java-web.html |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
73 |
* http://www.baeldung.com/liquibase-refactor-schema-of-java-app |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
74 |
* http://www.liquibase.org/documentation/existing_project.html |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
75 |
* http://www.liquibase.org/tutorial-using-oracle |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
76 |
|
1844
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
77 |
SQL syntax. |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
78 |
=========== |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
79 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
80 |
* http://www.liquibase.org/2015/09/liquibase-without-changelogs.html |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
81 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
82 |
|
1840
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
83 |
Generate difference between databases. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
84 |
====================================== |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
85 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
86 |
`This site |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
87 |
<http://www.broadleafcommerce.com/docs/core/current/appendix/managing-db-versions-migrations-with-liquibase>`_ |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
88 |
suggest using Hibernate ``hibernate.hbm2ddl.auto=create`` to create clean schema |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
89 |
with Hibernate and compare it with previous one. So you: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
90 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
91 |
* create empty schema and grand permissions for user |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
92 |
* register project to new user and schema, for example with Spring config:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
93 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
94 |
<bean id="dataSource" |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
95 |
class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
96 |
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
97 |
<property name="url" value="jdbc:mysql://localhost:3306/app"/> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
98 |
<property name="username" value="dbuser"/> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
99 |
<property name="password" value="123456"/> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
100 |
</bean> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
101 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
102 |
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
103 |
<property name="dataSource" ref="dataSource" /> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
104 |
<property name="jpaVendorAdapter"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
105 |
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
106 |
<property name="generateDdl" value="false"/> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
107 |
<property name="showSql" value="false"/> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
108 |
</bean> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
109 |
</property> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
110 |
<property name="packagesToScan" value="com.app.domain" /> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
111 |
<property name="jpaProperties"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
112 |
<props> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
113 |
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
114 |
<prop key="hibernate.hbm2ddl.auto">create</prop> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
115 |
<prop key="hibernate.default_schema">schema_v2_0</prop> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
116 |
</props> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
117 |
</property> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
118 |
</bean> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
119 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
120 |
* run Hibernate initialisation code via test or application deploy so |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
121 |
``hibernate.hbm2ddl.auto=create`` trigger to new schema generation. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
122 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
123 |
* configure Maven ``pom.xml`` with paths and authentication data to old and new |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
124 |
schema:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
125 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
126 |
<plugin> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
127 |
<groupId>org.liquibase</groupId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
128 |
<artifactId>liquibase-maven-plugin</artifactId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
129 |
<version>${liquibase.version}</version> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
130 |
<configuration> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
131 |
<changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
132 |
<diffChangeLogFile>changelogDiff.xml</diffChangeLogFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
133 |
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
134 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
135 |
<driver>com.mysql.jdbc.Driver</driver> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
136 |
<username>dbuser</username> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
137 |
<password>123456</password> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
138 |
<url>jdbc:mysql://localhost:3306/app</url> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
139 |
<defaultSchemaName>schema_v1.1</defaultSchemaName> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
140 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
141 |
<referenceDriver>com.mysql.jdbc.Driver</referenceDriver> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
142 |
<referenceUsername>dbuser</referenceUsername> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
143 |
<referencePassword>123456</referencePassword> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
144 |
<referenceUrl>jdbc:mysql://127.0.0.1:3306/app</referenceUrl> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
145 |
<referenceDefaultSchemaName>schema_v2.0</referenceDefaultSchemaName> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
146 |
</configuration> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
147 |
<dependencies> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
148 |
<dependency> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
149 |
<groupId>mysql</groupId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
150 |
<artifactId>mysql-connector-java</artifactId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
151 |
<version>5.1.6</version> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
152 |
</dependency> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
153 |
</dependencies> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
154 |
</plugin> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
155 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
156 |
.. NOTE:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
157 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
158 |
``username`` and ``referenceUsername`` as ``url`` and ``referenceUrl``, |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
159 |
and ``defaultSchemaName`` and ``referenceDefaultSchemaName``, etc pairs |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
160 |
should be adopted to your connection/authentication data. This settings |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
161 |
also possible externalize to:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
162 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
163 |
<changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
164 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
165 |
* Review diff in ``changelogDiff.xml`` after:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
166 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
167 |
$ mvn liquibase:diff |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
168 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
169 |
Resulted ``changelogDiff.xml`` may be registered to project with ``schema_v1.1`` |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
170 |
schema state. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
171 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
172 |
It is possible to move inner part of ``changelogDiff.xml`` to the last changeset |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
173 |
that managed by LiquiBase in your project. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
174 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
175 |
Alternatively that file may be registered via ``<include file="..."/>`` syntax. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
176 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
177 |
After that staying in project at ``schema_v1.1`` state you may upgrade from |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
178 |
``schema_v1.1`` to ``schema_v2.0`` schema by:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
179 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
180 |
$ mvn liquibase:update |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
181 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
182 |
Or create, review and apply SQL upgrade script (for your DBA):: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
183 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
184 |
$ mvn liquibase:updateSQL |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
185 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
186 |
TODO: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
187 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
188 |
$ mvn liquibase:update -Dliquibase.changesToApply=1 |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
189 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
190 |
Generating difference between database and JPA. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
191 |
=============================================== |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
192 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
193 |
LiquiBase come with plug-in which mimics like SQL driver. So we may run:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
194 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
195 |
$ mvn liquibase:diff |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
196 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
197 |
to get difference in LiquiBase XML format between our current database and JPA |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
198 |
schema description. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
199 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
200 |
With:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
201 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
202 |
$ mvn liquibase:updateSQL |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
203 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
204 |
we get SQL update code to state that described by Hibernate. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
205 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
206 |
Depending on Hibernate metadata form we shoud adapt ``referenceUrl`` property. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
207 |
For example for Spring enabled project with JPA annotations:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
208 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
209 |
<referenceUrl>hibernate:spring:com.app.domain?dialect=org.hibernate.dialect.MySQLDialect</referenceUrl> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
210 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
211 |
Here ``com.app.domain`` represent package with JPA annotated entities. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
212 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
213 |
So complete reference visit: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
214 |
https://github.com/liquibase/liquibase-hibernate/wiki |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
215 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
216 |
Also we need Spring Beans and LiquiBase driver in classpath to resolve |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
217 |
dependencies during diff calculation. Complete Maven piece look like:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
218 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
219 |
<plugin> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
220 |
<groupId>org.liquibase</groupId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
221 |
<artifactId>liquibase-maven-plugin</artifactId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
222 |
<version>${liquibase.version}</version> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
223 |
<configuration> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
224 |
<changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
225 |
<propertyFile>${liquibase.profile}</propertyFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
226 |
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
227 |
<logging>info</logging> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
228 |
<driver>com.mysql.jdbc.Driver</driver> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
229 |
<defaultSchemaName>app</defaultSchemaName> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
230 |
<changelogSchemaName>app</changelogSchemaName> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
231 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
232 |
<!-- For mvn liquibase:updateSQL --> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
233 |
<migrationSqlOutputFile>migration.sql</migrationSqlOutputFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
234 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
235 |
<referenceUrl>hibernate:spring:com.app.domain?dialect=org.hibernate.dialect.MySQLDialect</referenceUrl> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
236 |
<diffChangeLogFile>changelogDiff.xml</diffChangeLogFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
237 |
<diffTypes>tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints</diffTypes> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
238 |
</configuration> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
239 |
<dependencies> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
240 |
<dependency> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
241 |
<groupId>org.springframework.data</groupId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
242 |
<artifactId>spring-data-jpa</artifactId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
243 |
<version>${spring-data.version}</version> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
244 |
</dependency> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
245 |
<dependency> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
246 |
<groupId>org.liquibase.ext</groupId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
247 |
<artifactId>liquibase-hibernate4.2</artifactId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
248 |
<version>3.5</version> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
249 |
</dependency> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
250 |
</dependencies> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
251 |
</plugin> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
252 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
253 |
http://stackoverflow.com/questions/27877154/liquibase-and-jpa-annotated-entities |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
254 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
255 |
http://www.baeldung.com/liquibase-refactor-schema-of-java-app |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
256 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
257 |
How changelogs are identified. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
258 |
============================== |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
259 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
260 |
Upstream deside use three field to identify changeset: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
261 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
262 |
* each changeset mandatory marked by pair of ``user:id`` (which is actually any |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
263 |
non-whitespace characters) |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
264 |
* full path to file with changeset |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
265 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
266 |
``user:id`` is actually any non-whitespace and non-colon text with |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
267 |
non-whitespace text. Upstream suggest to use changeset authro identity for |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
268 |
``user`` and numbers or reason/name for changeset for ``id``. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
269 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
270 |
``user:id`` pair should be unique for file. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
271 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
272 |
Reason to capture full path as part of identifier is very dumb. Upstream |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
273 |
arguments: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
274 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
275 |
* http://forum.liquibase.org/topic/why-does-the-change-log-contain-the-file-name |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
276 |
* http://forum.liquibase.org/topic/i-need-to-ignore-the-filename-in-the-processing-to-see-if-a-change-set-has-already-been-applied |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
277 |
* http://forum.liquibase.org/topic/logical-filepath-in-change-sets-and-changelog |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
278 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
279 |
is very Java centric and require sticking to fixed changeset file location in |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
280 |
``CLASSPATH``. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
281 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
282 |
When you work with same file on different hosts / tools you should very |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
283 |
carefully check that path satisfy conventions that used with previous LiquiBase |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
284 |
work for concrete DB. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
285 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
286 |
I have incompatibilities between String integration and Maven plug-in. Because I |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
287 |
use full path in Maven and CLASSPATH relative in String. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
288 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
289 |
Hopefully there is logicalFilePath attribute. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
290 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
291 |
In XML syntax in may be applied to top level tag:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
292 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
293 |
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
294 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
295 |
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd" |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
296 |
logicalFilePath="legacy.xml"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
297 |
... |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
298 |
</databaseChangeLog> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
299 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
300 |
or may be overridden by each changeset:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
301 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
302 |
<changeSet author="admin" id="fix-25" logicalFilePath="fix.xml"> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
303 |
... |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
304 |
</changeSet> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
305 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
306 |
SQL syntax also have ``logicalFilePath`` attribute for top level file mark |
1842
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
307 |
(implemented in v3.3):: |
1840
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
308 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
309 |
--liquibase formatted sql logicalFilePath:legacy.sql |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
310 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
311 |
and may be overridden by each changeset:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
312 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
313 |
--changeset legacy:1 logicalFilePath:other.sql |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
314 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
315 |
To verify that settings have effect run:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
316 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
317 |
mvn liquibase:changelogSyncSQL |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
318 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
319 |
and review migration.sql. Corresponding ``pom.xml`` part:: |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
320 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
321 |
<plugin> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
322 |
<groupId>org.liquibase</groupId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
323 |
<artifactId>liquibase-maven-plugin</artifactId> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
324 |
<version>${liquibase.version}</version> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
325 |
<configuration> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
326 |
<changeLogFile>${basedir}/src/main/resources/sql/master.xml</changeLogFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
327 |
<propertyFile>${liquibase.profile}</propertyFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
328 |
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
329 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
330 |
<migrationSqlOutputFile>migration.sql</migrationSqlOutputFile> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
331 |
</configuration> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
332 |
</plugin> |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
333 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
334 |
.. |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
335 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
336 |
* http://stackoverflow.com/questions/19896436/how-to-configure-liquibase-not-to-include-file-path-or-name-for-calculating-chec |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
337 |
* http://stackoverflow.com/questions/19959755/liquibase-how-to-disable-filename-column-check |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
338 |
* http://stackoverflow.com/questions/18767815/refactoring-liquibase-changelog-files |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
339 |
|
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
340 |
Consult |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
341 |
``liquibase-core/src/main/java/liquibase/parser/core/formattedsql/FormattedSqlChangeLogParser.java`` |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
342 |
for further info . |
da2130eaa115
How changelogs are identified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1838
diff
changeset
|
343 |
|
1842
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
344 |
Split changesets into files. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
345 |
============================ |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
346 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
347 |
It is not possible to split file formatted in SQL LiquiBase syntax. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
348 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
349 |
It is not possible to set tag with SQL LiquiBase syntax. To workaround this |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
350 |
issue you may split SQL file and set tags in XML sytax:: |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
351 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
352 |
<changeSet author="master" id="1"> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
353 |
<tagDatabase tag="v0.1"/> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
354 |
</changeSet> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
355 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
356 |
<include file="legacy.sql" relativeToChangelogFile="true"/> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
357 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
358 |
<changeSet author="master" id="2"> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
359 |
<tagDatabase tag="v1.0"/> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
360 |
</changeSet> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
361 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
362 |
<include file="v1.0.sql" relativeToChangelogFile="true"/> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
363 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
364 |
Also you should be interested in storing stored procedures in separate file and |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
365 |
apply ``runOnChange`` attribure for XML syntax:: |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
366 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
367 |
<changeSet author="admin" id="proc-hello"> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
368 |
<createProcedure |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
369 |
runOnChange="true" |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
370 |
encoding="utf8" |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
371 |
dbms="oracle"> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
372 |
CREATE OR REPLACE PROCEDURE hello AS |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
373 |
BEGIN |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
374 |
DBMS_OUTPUT.PUT_LINE('Hello'); |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
375 |
END; |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
376 |
</createProcedure> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
377 |
</changeSet> |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
378 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
379 |
or with SQL syntax:: |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
380 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
381 |
--changeset admin:proc-hello runOnChange:true |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
382 |
CREATE OR REPLACE PROCEDURE hello AS |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
383 |
BEGIN |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
384 |
DBMS_OUTPUT.PUT_LINE('Hello'); |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
385 |
END; |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
386 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
387 |
Some people suggest to use one file per stored procedure / package. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
388 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
389 |
How big chould be changeset? |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
390 |
============================ |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
391 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
392 |
Less is better. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
393 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
394 |
Some databases doesn't support transactional DDL (e.g. Oracle, SQL Server), each |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
395 |
DDL statement should be put into a single changeset. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
396 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
397 |
Putting unrelated operations into single changeset leads to trouble when last or |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
398 |
intermediate of them fail to apply. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
399 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
400 |
Try to group constraint adding in corresponding update statements. If you have |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
401 |
wrong update that doesn't prepare data to constraint it shouldn't be commited |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
402 |
but rewritten. |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
403 |
|
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
404 |
* http://blog.mgm-tp.com/2010/11/data-modeling-part2/ |
e66fcbaf99fa
Split changesets into files. How big chould be changeset?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1840
diff
changeset
|
405 |
|
1844
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
406 |
Labels vs Contexts. |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
407 |
=================== |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
408 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
409 |
* http://forum.liquibase.org/topic/labels-vs-contexts-in-3-3-0 |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
410 |
* http://www.liquibase.org/2014/11/contexts-vs-labels.html |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
411 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
412 |
How to apply LiquiBase to you DB? |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
413 |
================================= |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
414 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
415 |
* http://www.liquibase.org/2015/07/executing-liquibase.html |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
416 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
417 |
Comparison LiquiBase with Python Django South and Ruby ActiveRecord. |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
418 |
==================================================================== |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
419 |
|
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
420 |
* http://south.readthedocs.org/en/latest/index.html |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
421 |
* https://code.djangoproject.com/wiki/SchemaEvolution |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
422 |
* http://guides.rubyonrails.org/active_record_basics.html |
7427de2e34ea
Comparison LiquiBase with Python Django South and Ruby ActiveRecord.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1842
diff
changeset
|
423 |