Documentation Home

3.0.x to 3.2.0 Migration

Account Attributes

Accounts now have additional attributes. A new table called BLC_ACCOUNT_ATTRIBUTE will need to be created.

Liquibase Script

<?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="acccount 3.2" id="1">
        <createTable tableName="blc_account_attribute">
            <column name="ATTRIBUTE_ID" type="BIGINT">
                <constraints primaryKey="true"/>
            </column>
            <column defaultValueComputed="NULL" name="CREATED_BY" type="BIGINT"/>
            <column defaultValueComputed="NULL" name="DATE_CREATED" type="datetime"/>
            <column defaultValueComputed="NULL" name="DATE_UPDATED" type="datetime"/>
            <column defaultValueComputed="NULL" name="UPDATED_BY" type="BIGINT"/>
            <column defaultValueComputed="NULL" name="SNDBX_ID" type="BIGINT"/>
            <column name="SNDBX_ARCHIVED_FLAG" type="CHAR(1)"/>
            <column defaultValueComputed="NULL" name="SITE_DISC" type="BIGINT"/>
            <column name="FIELD_NAME" type="VARCHAR(255)">
                <constraints nullable="false"/>
            </column>
            <column defaultValueBoolean="false" name="IS_PREVIEW" type="BIT"/>
            <column name="FIELD_VALUE" type="VARCHAR(255)"/>
            <column name="ACCOUNT_ID" type="BIGINT">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>
    <changeSet author="acccount 3.2" id="2">
        <createIndex indexName="ACCOUNT_ATTRIBUTE_INDEX" tableName="blc_account_attribute">
            <column name="ACCOUNT_ID"/>
        </createIndex>
    </changeSet>
    <changeSet author="acccount 3.2" id="3">
        <createIndex indexName="ACCOUNT_ATTRIBUTE_NAME_INDEX" tableName="blc_account_attribute">
            <column name="FIELD_NAME"/>
        </createIndex>
    </changeSet>
    <changeSet author="acccount 3.2" id="4">
        <addForeignKeyConstraint baseColumnNames="ACCOUNT_ID" baseTableName="blc_account_attribute" constraintName="FKmov6gq0q2n1743fdc4weap9en" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNT_ID" referencedTableName="blc_account" validate="true"/>
    </changeSet>
</databaseChangeLog>

MySQL

CREATE TABLE blc_account_attribute (ATTRIBUTE_ID BIGINT NOT NULL, CREATED_BY BIGINT DEFAULT NULL NULL, DATE_CREATED datetime DEFAULT NULL NULL, DATE_UPDATED datetime DEFAULT NULL NULL, UPDATED_BY BIGINT DEFAULT NULL NULL, SNDBX_ID BIGINT DEFAULT NULL NULL, SNDBX_ARCHIVED_FLAG CHAR(1) NULL, SITE_DISC BIGINT DEFAULT NULL NULL, FIELD_NAME VARCHAR(255) NOT NULL, IS_PREVIEW BIT DEFAULT 0 NULL, FIELD_VALUE VARCHAR(255) NULL, ACCOUNT_ID BIGINT NOT NULL, CONSTRAINT PK_BLC_ACCOUNT_ATTRIBUTE PRIMARY KEY (ATTRIBUTE_ID));
CREATE INDEX ACCOUNT_ATTRIBUTE_INDEX ON blc_account_attribute(ACCOUNT_ID);
CREATE INDEX ACCOUNT_ATTRIBUTE_NAME_INDEX ON blc_account_attribute(FIELD_NAME);
ALTER TABLE blc_account_attribute ADD CONSTRAINT FKmov6gq0q2n1743fdc4weap9en FOREIGN KEY (ACCOUNT_ID) REFERENCESblc_account (ACCOUNT_ID) ON UPDATE RESTRICT ON DELETE RESTRICT;