<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
            http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <property name="cmValueLength" value="4000" dbms="postgresql,oracle"/>
    <property name="cmValueLength" value="255" dbms="mysql,mssql"/>

    <property name="cmAccessDecisionReasonLength" value="1024" dbms="postgresql,oracle"/>
    <property name="cmAccessDecisionReasonLength" value="255" dbms="mysql,mssql"/>

    <property name="cmObjectTypeLength" value="1024" dbms="postgresql,oracle"/>
    <property name="cmObjectTypeLength" value="255" dbms="mysql,mssql"/>

    <property name="cmObjectStateLength" value="1024" dbms="postgresql,oracle"/>
    <property name="cmObjectStateLength" value="255" dbms="mysql,mssql"/>

    <property name="cmAccessLevelLength" value="1024" dbms="postgresql,oracle"/>
    <property name="cmAccessLevelLength" value="255" dbms="mysql,mssql"/>

    <property name="cmAccessorTypeLength" value="1024" dbms="postgresql,oracle"/>
    <property name="cmAccessorTypeLength" value="255" dbms="mysql,mssql"/>

    <property name="cmAccessorIdLength" value="1024" dbms="postgresql,oracle"/>
    <property name="cmAccessorIdLength" value="255" dbms="mysql,mssql"/>

    <changeSet id="01-data-access-acl-table" author="dmiller" dbms="oracle,postgresql">
        <createTable tableName="acm_boolean_lu">
            <column name="cm_id" type="${idType}">
                <constraints nullable="false" primaryKey="true" primaryKeyName="pk_boolean"/>
            </column>
            <column name="cm_value" type="VARCHAR(${cmValueLength})">
                <constraints nullable="false" unique="true" uniqueConstraintName="uk_boolean_type"/>
            </column>
            <column name="cm_order" type="NUMBER(32,0)">
                <constraints nullable="false" unique="true" uniqueConstraintName="uk_boolean_order"/>
            </column>
            <column name="cm_status" type="VARCHAR(128)">
                <constraints nullable="false"/>
            </column>
            <column name="cm_created" type="${timestampType}">
                <constraints nullable="false"/>
            </column>
            <column name="cm_creator" type="VARCHAR(1024)">
                <constraints nullable="false"/>
            </column>
            <column name="cm_modified" type="${timestampType}">
                <constraints nullable="false"/>
            </column>
            <column name="cm_modifier" type="VARCHAR(1024)">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>

    <changeSet id="01-data-access-acl-table" author="dmiller" dbms="mysql">
        <createTable tableName="acm_boolean_lu">
            <column name="cm_id" type="${idType}">
                <constraints nullable="false" primaryKey="true" primaryKeyName="pk_boolean"/>
            </column>
            <column name="cm_value" type="VARCHAR(${cmValueLength})">
                <constraints nullable="false" unique="true" uniqueConstraintName="uk_boolean_type"/>
            </column>
            <column name="cm_order" type="NUMBER(32,0)">
                <constraints nullable="false" unique="true" uniqueConstraintName="uk_boolean_order"/>
            </column>
            <column name="cm_status" type="VARCHAR(128)">
                <constraints nullable="false"/>
            </column>
            <column name="cm_created" type="${timestampType}" defaultValueComputed="${timestampFunction}">
                <constraints nullable="false"/>
            </column>
            <column name="cm_creator" type="VARCHAR(1024)">
                <constraints nullable="false"/>
            </column>
            <column name="cm_modified" type="${timestampType}" defaultValueComputed="${timestampFunction}">
                <constraints nullable="false"/>
            </column>
            <column name="cm_modifier" type="VARCHAR(1024)">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>

    <changeSet id="01-data-access-acl-table-mssql" author="riste.tutureski" dbms="mssql">
        <createTable tableName="acm_boolean_lu">
            <column name="cm_id" type="${idType}">
                <constraints nullable="false" primaryKey="true" primaryKeyName="pk_boolean"/>
            </column>
            <column name="cm_value" type="VARCHAR(32)">
                <constraints nullable="false" unique="true" uniqueConstraintName="uk_boolean_type"/>
            </column>
            <column name="cm_order" type="NUMBER(32,0)">
                <constraints nullable="false" unique="true" uniqueConstraintName="uk_boolean_order"/>
            </column>
            <column name="cm_status" type="VARCHAR(128)">
                <constraints nullable="false"/>
            </column>
            <column name="cm_created" type="${timestampType}">
                <constraints nullable="false"/>
            </column>
            <column name="cm_creator" type="VARCHAR(1024)">
                <constraints nullable="false"/>
            </column>
            <column name="cm_modified" type="${timestampType}">
                <constraints nullable="false"/>
            </column>
            <column name="cm_modifier" type="VARCHAR(1024)">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>

    <changeSet id="02-acm_boolean_lu-id" author="nebojsha.davidovikj">
        <createTable tableName="acm_boolean_lu_id">
            <column name="cm_seq_num" type="${idType}"/>
            <column name="cm_seq_name" type="VARCHAR(255)"/>
        </createTable>
        <insert tableName="acm_boolean_lu_id">
            <column name="cm_seq_num" value="100"></column>
            <column name="cm_seq_name" value="acm_boolean_lu"></column>
        </insert>
    </changeSet>

    <changeSet id="03-change_cm_boolean_lu_datetime" author="mario.gjurcheski" dbms="mysql">
        <modifyDataType tableName="acm_boolean_lu" columnName="cm_created" newDataType="DATETIME"/>
        <modifyDataType tableName="acm_boolean_lu" columnName="cm_modified" newDataType="DATETIME"/>
    </changeSet>

</databaseChangeLog>