AppSuite:CustomDBMigrationBundle: Difference between revisions

From Open-Xchange
(Created page with "<div class="title">How to write custom bundles to execute database migration statements.</div> '''Summary''': With release 7.6.1 it is possible to change the database schema ...")
 
No edit summary
Line 2: Line 2:


'''Summary''': With release 7.6.1 it is possible to change the database schema based on usage of the open source tool Liquibase. Currently only updating the configdb with the new mechanism is desired. This article gives a short introduction based on an existing sample bundle how to write custom database migration bundles and how to attach your custom statements to those given by Open-Xchange.  
'''Summary''': With release 7.6.1 it is possible to change the database schema based on usage of the open source tool Liquibase. Currently only updating the configdb with the new mechanism is desired. This article gives a short introduction based on an existing sample bundle how to write custom database migration bundles and how to attach your custom statements to those given by Open-Xchange.  
Please have a look at liquibase, its features and documentation before writing custom bundles: http://www.liquibase.org/documentation/ . Current available version of liquibase within the Open-Xchange server is 3.0.7.


__TOC__
__TOC__
Line 13: Line 15:


The required bundle is named 'com.openexchange.sample.database.migration'.
The required bundle is named 'com.openexchange.sample.database.migration'.
== Current restrictions ==
Database migrations can only be applied to the configdb!


== Bundle dependencies ==
== Bundle dependencies ==
To execute custom database migration for the configdb you have to track the service com.openexchange.database.migration.DBMigrationExecutorService (default provided within bundle com.openexchange.database.migration).
If you would like to have the Open-Xchange database migrations executed before your custom statements are used you even have to track the service com.openexchange.database.migration.ox.DBMigrationOXExcecutorService which is provided within the bundle com.openexchange.database.migration.ox
Usage of both is shown within the sample bundle.


== Using Liquibase ==
== Using Liquibase ==


== Database lock ==
=== Database lock ===


=== Preconditions ===
=== Preconditions ===

Revision as of 10:26, 28 August 2014

How to write custom bundles to execute database migration statements.

Summary: With release 7.6.1 it is possible to change the database schema based on usage of the open source tool Liquibase. Currently only updating the configdb with the new mechanism is desired. This article gives a short introduction based on an existing sample bundle how to write custom database migration bundles and how to attach your custom statements to those given by Open-Xchange.

Please have a look at liquibase, its features and documentation before writing custom bundles: http://www.liquibase.org/documentation/ . Current available version of liquibase within the Open-Xchange server is 3.0.7.

Prerequisite

This article is based on an existing sample bundle located in the public git repository backend-samples. Clone the repository by executing

git clone https://git.open-xchange.com/git/examples/backend-samples

The required bundle is named 'com.openexchange.sample.database.migration'.

Current restrictions

Database migrations can only be applied to the configdb!

Bundle dependencies

To execute custom database migration for the configdb you have to track the service com.openexchange.database.migration.DBMigrationExecutorService (default provided within bundle com.openexchange.database.migration).

If you would like to have the Open-Xchange database migrations executed before your custom statements are used you even have to track the service com.openexchange.database.migration.ox.DBMigrationOXExcecutorService which is provided within the bundle com.openexchange.database.migration.ox

Usage of both is shown within the sample bundle.

Using Liquibase

Database lock

Preconditions

Custom Java Classes

Command line tools

Important hints