Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

2 - Extending the schema

2 - Extending the schema

After extending the Commerce Engine's domain and service layers to support automatic subscription renewal, you'll need to extend the database schema so the Order's autoBill value can be stored.

This section of the tutorial will show you how to extend the database schema using Liquibase changesets.

Extending the TORDER table

The database stores Orders in the TORDER table. To extend the TORDER table, you'll create a new table named TORDEREXT that contains an AUTOBILL column. You'll also add a discriminator column to TORDER that maps the extended order data in TORDEREXT with the out of the box order data in TORDER.

To extend the TORDER table:

  1. In extensions/database directory, open ext-schema-client/src/main/resources/liquibase/core-changelog-ext.xml, and add the following XML before the </databaseChangeLog> tag:
    Note: CS-Inception Extensions Project

    For CS-Inception Extensions, the file is located in extensions/database/ext-data/src/main/resources/schema/schema-customizations-changelog.xml

    	<changeSet id="BN-595.1" author="elasticpath">
    		<createTable tableName="TORDEREXT">
    			<column name="UIDPK" type="BIGINT">
    				<constraints primaryKey="true" nullable="false"/commerce-legacy/>
    			<column name="AUTOBILL" type="INTEGER"
    	<changeSet id="BN-595.2" author="elasticpath">
    		<addColumn tableName="TORDER">
    			<column name="ORDERTYPE" type="VARCHAR(20)"/commerce-legacy/>
  2. With the command prompt, navigate to extensions/database/ext-schema-client and run:
    mvn package liquibase:update
    Note: CS-Inception Extensions Project

    For CS-Inception Extensions Project, navigate to extensions/database and run the command: mvn clean install -Preset-db

    This will apply the changesets you added to schema-customizations-changelog.xml to your database.