Migration from 4.0 to 4.2.0-GA
Admin Entity Folders
A new feature has been added to allow admin users to separate entities of the same type into folders to easily organize them. The following schema changes are needed for this functionality.
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="enterprise 4.2" id="1">
<createTable tableName="blc_admin_folder">
<column name="ID" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="COLOR" type="VARCHAR(255)"/>
<column name="ENTITY_TYPE" type="VARCHAR(255)"/>
<column name="NAME" type="VARCHAR(255)"/>
<column defaultValueBoolean="false" name="ROOT" type="BIT"/>
<column defaultValueComputed="NULL" name="PARENT_FOLDER" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="enterprise 4.2" id="2">
<createTable tableName="blc_admin_folder_item">
<column name="ID" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column defaultValueComputed="NULL" name="ENTITY_ID" type="BIGINT"/>
<column name="ENTITY_TYPE" type="VARCHAR(255)"/>
<column name="ICON" type="VARCHAR(255)"/>
<column defaultValueComputed="NULL" name="PARENT_FOLDER" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="enterprise 4.2" id="3">
<createIndex indexName="FK5aks5cymyaef15hoj7bwfd5lr" tableName="blc_admin_folder_item">
<column defaultValueComputed="NULL" name="PARENT_FOLDER"/>
</createIndex>
</changeSet>
<changeSet author="enterprise 4.2" id="4">
<createIndex indexName="FKauigh7hnysl901sqi6yiqxotf" tableName="blc_admin_folder">
<column defaultValueComputed="NULL" name="PARENT_FOLDER"/>
</createIndex>
</changeSet>
<changeSet author="enterprise 4.2" id="5">
<addForeignKeyConstraint baseColumnNames="PARENT_FOLDER" baseTableName="blc_admin_folder_item" constraintName="FK5aks5cymyaef15hoj7bwfd5lr" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ID" referencedTableName="blc_admin_folder" validate="true"/>
</changeSet>
<changeSet author="enterprise 4.2" id="6">
<addForeignKeyConstraint baseColumnNames="PARENT_FOLDER" baseTableName="blc_admin_folder" constraintName="FKauigh7hnysl901sqi6yiqxotf" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ID" referencedTableName="blc_admin_folder" validate="true"/>
</changeSet>
</databaseChangeLog>
MySQL
CREATE TABLE `BLC_ADMIN_FOLDER` (
`ID` bigint(20) NOT NULL,
`COLOR` varchar(255) DEFAULT NULL,
`ENTITY_TYPE` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`ROOT` bit(1) DEFAULT NULL,
`PARENT_FOLDER` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FKauigh7hnysl901sqi6yiqxotf` (`PARENT_FOLDER`),
CONSTRAINT `FKauigh7hnysl901sqi6yiqxotf` FOREIGN KEY (`PARENT_FOLDER`) REFERENCES `BLC_ADMIN_FOLDER` (`ID`)
);
CREATE TABLE `BLC_ADMIN_FOLDER_ITEM` (
`ID` bigint(20) NOT NULL,
`ENTITY_ID` bigint(20) DEFAULT NULL,
`ENTITY_TYPE` varchar(255) DEFAULT NULL,
`ICON` varchar(255) DEFAULT NULL,
`PARENT_FOLDER` bigint(20) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FK5aks5cymyaef15hoj7bwfd5lr` (`PARENT_FOLDER`),
CONSTRAINT `FK5aks5cymyaef15hoj7bwfd5lr` FOREIGN KEY (`PARENT_FOLDER`) REFERENCES `BLC_ADMIN_FOLDER` (`ID`)
);