Database

Contribute custom database scripts

With the new Database Setup for v8.0 we added a new extension point (com.heiler.ppm.dbsetup.core.sqlScript) where it is possible to contribute customized update scripts. With a flexible declaration it is possible to define the order of these scripts so they can run before or after a specific standard script. Furthermore it is possible to create whole new schemas by defining them in the extension point.

Custom Update Scripts

To add a new custom update script create a new Plugin and add a dependency to the plugin com.heiler.ppm.dbsetup.core and add the extension point com.heiler.ppm.dbsetup.core.sqlScript.

The extension point is constructed as follow: DB type -> schema -> script type -> script

In the screen shot below you can see how the structure looks like. You will only have to declare the schemas and types you want to contribute to. So if you want to add an update script for the main schema, just add MSSQL -> main -> update -> your script.

To select your update script it has to be located inside of your plugin.

Your script file has to be encoded with UTF-8. If not, you may get an encoding exception during execution.

Since version has to be unique and is used as the order of execution, you will have to define a version that is not taken by our standard scripts. As a convention use only versions above 1000. To execute a script before or after a script from the standard, for example to drop an index, you can define the corresponding script in the runBefore or runAfter field. Just enter the version of that script. The version consists of the last 3 digits of the update script name (without the dot). If left empty, the defined version of that script will be used as the order of execution.

If runAlways is set to false, which is the default, then the version is written into the database and it won't be executed on the next run. If set to true you have to make sure this script can be executed multiple times without any dependencies to the data structure.

images/download/attachments/70582494/contributeScriptsExtPoint.JPG