You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 4
Next »
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?
Introduction
CRM.COM uses LiquiBase to implement this database changes management mechanism and uses changelog XML files to define the desired database changes.
DATABASECHANGELOG table is used to keep track of those changes.
Create New Table
New tables are defined in <projectname>.changelog.xml under ProjectNameCrmEJB/ejbModule.
<databaseChangeLog>
...
<changeSet author="custom_developer" id="custom-db-change-1">
<createTable tableName="CUSTOMTABLE">
<column name="CUSTOMID" remarks="Primary Key" type="VARCHAR(32)">
<constraints nullable="false"/>
</column>
<column name="CUSTOMNAME" remarks="The name of the custom entity" type="VARCHAR(256)"/>
<column name="CUSTOMALTCODE" type="VARCHAR(32)"/>
<column name="CUSTOMDESC" remarks="The description of the custom entity" type="VARCHAR(512)"/>
<column name="CUSTOMCREATEDDATE" type="TIMESTAMP"/>
<column name="CUSTOMUPDATEDDATE" type="TIMESTAMP"/>
<column name="CUSTOMDELETED" type="INTEGER"/>
<column name="CUSTOMCREATEDBYUSERID" type="VARCHAR(32)"/>
<column name="CUSTOMUPDATEDBYUSERID" type="VARCHAR(32)"/>
<column name="CUSTOMCREATEDBYOUUID" type="VARCHAR(32)"/>
<column name="CUSTOMUPDATEDBYOUUID" type="VARCHAR(32)"/>
<column defaultValueNumeric="0" name="RECVERSION" type="INTEGER">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
...
</databaseChangeLog>
Add New Column To An Existing Table