Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
nameblue

This section describes how custom database changes can be made, defining those changes in XML files rather that writing SQL directly against the database.

 

What does this section cover?

Table of Contents

...

Each change runs only one time and this is ensured by DATABASECHANGELOGLOCK table.

Changelog For Database

...

Object Changes

New tables, columns and constraints are defined in <projectname>.changelog.xml which is located under ProjectNameCrmEJB/ejbModule.

...

Code Block
languagexml
titleprojectname.changelog.xml
collapsetrue
<databaseChangeLog>
	...
	<changeSet author="p_kestora" id="CRMCOM-5483-05">
        <addForeignKeyConstraint baseColumnNames="RENTALID" baseTableName="CUSTOMTABLE" constraintName="FK_CUSTOMTABLE_01" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="RENTALID" referencedTableName="TRN_RENTALS"/>
    </changeSet>
	...
</databaseChangeLog>

Changelog For

...

Data Changes

<projectname>.changelog.xml which , which is located under ProjectNameCrmEJB/ejbModule, is used for inserting and updating data in existing tables

Insert Data In Existing Table

Code Block
languagexml
titleprojectname.changelog.xml
collapsetrue
<databaseChangeLog>
	...
	<changeSet author="custom_developer" id="custom-data-db-change-3">
        <insert tableName="CUSTOMTABLE">
            <column name="CUSTOMID" value="63E096DF859A44ED958007C71F0389E5"/>
            <column name="CUSTOMNAME" value="Standard Customer"/>
            <column name="CUSTOMALTCODE" value="SC"/>
            <column name="CUSTOMDESC"/>
            <column name="CUSTOMCREATEDDATE" valueDate="2016-03-11 10:03:21.0"/>
            <column name="CUSTOMUPDATEDDATE" valueDate="2016-03-11 10:03:56.0"/>
            <column name="CUSTOMDELETED" valueNumeric="0"/>
            <column name="CUSTOMCREATEDBYUSERID" value="1"/>
            <column name="CUSTOMUPDATEDBYUSERID" value="1"/>
            <column name="CUSTOMCREATEDBYOUUID" value="1"/>
            <column name="CUSTOMUPDATEDBYOUUID" value="1"/>
            <column name="RECVERSION" valueNumeric="0"/>
        </insert>
    </changeSet>
	...
</databaseChangeLog>

Update Data In Existing Table

Code Block
languagexml
titleprojectname.changelog.xml
collapsetrue
<databaseChangeLog>
	...
	<changeSet author="custom_developer" id="custom-data-db-change-3">
        <insert tableName="CUSTOMTABLE">
            <column name="CUSTOMID" value="63E096DF859A44ED958007C71F0389E5"/>
            <column name="CUSTOMNAME" value="Standard Customer"/>
            <column name="CUSTOMALTCODE" value="SC"/>
            <column name="CUSTOMDESC"/>
            <column name="CUSTOMCREATEDDATE" valueDate="2016-03-11 10:03:21.0"/>
            <column name="CUSTOMUPDATEDDATE" valueDate="2016-03-11 10:03:56.0"/>
            <column name="CUSTOMDELETED" valueNumeric="0"/>
            <column name="CUSTOMCREATEDBYUSERID" value="1"/>
            <column name="CUSTOMUPDATEDBYUSERID" value="1"/>
            <column name="CUSTOMCREATEDBYOUUID" value="1"/>
            <column name="CUSTOMUPDATEDBYOUUID" value="1"/>
            <column name="RECVERSION" valueNumeric="0"/>
        </insert>
    </changeSet>
	...
</databaseChangeLog>