eXo Platform 3.5

## Chapter 77. DB Schema creator service (JDBC implementation)

DB Schema Creator is responsible for creating database schema, using a DDL script inside service configuration or in an external file, calling:

      org.exoplatform.services.database.jdbc.DBSchemaCreator.createTables(String dsName, String script)

via

    org.exoplatform.services.database.jdbc.CreateDBSchemaPlugin component plugin

A configuration example:

    <component>

       <key>org.exoplatform.services.database.jdbc.DBSchemaCreator</key>

       <type>org.exoplatform.services.database.jdbc.DBSchemaCreator</type>

       <component-plugins>

          <component-plugin>

             <name>jcr.dbschema</name>

             <set-method>addPlugin</set-method>

             <type>org.exoplatform.services.database.jdbc.CreateDBSchemaPlugin</type>

             <init-params>

                <value-param>

                   <name>data-source</name>

                   <value>jdbcjcr</value>

                </value-param>

                <value-param>

                   <name>script-file</name>

                   <value>conf/storage/jcr-mjdbc.sql</value>

                </value-param>

             </init-params>

          </component-plugin>

      ........

An example of a DDL script:

    CREATE TABLE JCR_MITEM(
            ID VARCHAR(255) NOT NULL PRIMARY KEY,
            VERSION INTEGER NOT NULL,
            PATH VARCHAR(1024) NOT NULL
            );
    CREATE INDEX JCR_IDX_MITEM_PATH ON JCR_MITEM(PATH);

Copyright © 2009-2012. All rights reserved. eXo Platform SAS