Upgrading Data Schemas in Development

As you develop modules, you might need to iterate through several database schema changes. Before you release new module versions with your finalized schema changes, you must create a formal data upgrade process. Until then, you can use the Build Auto Upgrade feature to test schema changes on the fly.

Setting the global property schema.module.build.auto.upgrade to true applies module schema changes for redeployed modules whose service build numbers have incremented. The build.number property in the module’s service.properties file indicates the service build number. Build Auto Upgrade executes schema changes without massaging existing data. It leaves data empty for created columns, drops data from deleted and renamed columns, and orphans data from deleted and renamed tables.

Although Build Auto Upgrade updates databases quickly and automatically, it doesn’t guarantee a proper data upgrade–you implement that via data upgrade processes. Build Auto Upgrade is for development purposes only.

By default, schema.module.build.auto.upgrade is set to false. On any module’s first deployment, the module’s tables are generated regardless of the schema.module.build.auto.upgrade value.

The following table summarizes Build Auto Upgrade’s handling of schema changes:

Schema ChangeResult
Add columnCreate a new empty column.
Rename columnDrop the existing column and delete all its data. Create a new empty column.
Delete columnDrop the existing column and delete all its data.
Create or rename a table in Liferay DXP’s built-in data source.Orphan the existing table and all its data. Create the new table.

Great! Now you know how to use the Build Auto Upgrade developer feature.

Creating Data Upgrade Process for Modules

« Meaningful Schema VersioningIntroduction to Back-end Frameworks »
Was this article helpful?
0 out of 0 found this helpful