Documentation Home

2.0.x to 2.2.0 Migration

New schema for Cart Rules and Cart Rule Actions

Liquibase

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
    <changeSet author="cart rules 2.2" id="1">
        <addColumn tableName="blc_cart_rule_action">
            <column defaultValueBoolean="false" name="IS_DEFAULT_PRODUCT" type="BIT"/>
        </addColumn>
    </changeSet>
    <changeSet author="cart rules 2.2" id="2">
        <addColumn tableName="blc_cart_rule">
            <column name="TIMES_PER_CUSTOMER" type="INT">
                <constraints nullable="false"/>
            </column>
        </addColumn>
    </changeSet>
    <changeSet author="cart rules 2.2" id="3">
        <addColumn tableName="blc_cart_rule_action">
            <column defaultValueComputed="NULL" name="ACTION_SKU_ID" type="BIGINT"/>
        </addColumn>
    </changeSet>
    <changeSet author="cart rules 2.2" id="4">
        <createIndex indexName="FKop16j7ls2ua6neotstk0w3g7j" tableName="blc_cart_rule_action">
            <column defaultValueComputed="NULL" name="ACTION_SKU_ID"/>
        </createIndex>
    </changeSet>
    <changeSet author="cart rules 2.2" id="5">
        <addForeignKeyConstraint baseColumnNames="ACTION_SKU_ID" baseTableName="blc_cart_rule_action" constraintName="FKop16j7ls2ua6neotstk0w3g7j" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SKU_ID" referencedTableName="blc_sku" validate="true"/>
    </changeSet>
</databaseChangeLog>

MySQL

ALTER TABLE blc_cart_rule_action ADD IS_DEFAULT_PRODUCT BIT DEFAULT 0 NULL;
ALTER TABLE blc_cart_rule ADD TIMES_PER_CUSTOMER INT NOT NULL;
ALTER TABLE blc_cart_rule_action ADD ACTION_SKU_ID BIGINT DEFAULT null NULL;
CREATE INDEX FKop16j7ls2ua6neotstk0w3g7j ON blc_cart_rule_action(ACTION_SKU_ID);
ALTER TABLE blc_cart_rule_action ADD CONSTRAINT FKop16j7ls2ua6neotstk0w3g7j FOREIGN KEY (ACTION_SKU_ID) REFERENCES blc_sku (SKU_ID) ON UPDATE RESTRICT ON DELETE RESTRICT;