<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
    <changeSet author="giriraj.sharma27@gmail.com" id="1.3.0.Beta1">
        <createTable tableName="ADMIN_EVENT_ENTITY">
            <column name="ID" type="VARCHAR(36)">
                <constraints nullable="false"/>
            </column>
            <column name="ADMIN_EVENT_TIME" type="BIGINT"/>
            <column name="OPERATION_TYPE" type="VARCHAR(255)"/>
            <column name="REALM_ID" type="VARCHAR(255)"/>
            <column name="CLIENT_ID" type="VARCHAR(255)"/>
            <column name="USER_ID" type="VARCHAR(255)"/>
            <column name="IP_ADDRESS" type="VARCHAR(255)"/>
            <column name="RESOURCE_PATH" type="VARCHAR(255)"/>
            <column name="REPRESENTATION" type="VARCHAR(25500)"/>
            <column name="ERROR" type="VARCHAR(255)"/>
        </createTable>
        <createTable tableName="REALM_ENABLED_ADMIN_EVENT_OPERATIONS">
            <column name="REALM_ID" type="VARCHAR(36)">
                <constraints nullable="false"/>
            </column>
            <column name="VALUE" type="VARCHAR(255)"/>
        </createTable>
        <addColumn tableName="REALM">
            <column name="ADMIN_EVENTS_ENABLED" type="BOOLEAN" defaultValueBoolean="false">
                <constraints nullable="false"/>
            </column>
            <column name="ADMIN_EVENTS_DETAILS_ENABLED" type="BOOLEAN" defaultValueBoolean="false">
                <constraints nullable="false"/>
            </column>
        </addColumn>
        <addForeignKeyConstraint baseColumnNames="REALM_ID" baseTableName="REALM_ENABLED_ADMIN_EVENT_OPERATIONS" constraintName="FKF8459C8FAE5C3B34" referencedColumnNames="ID" referencedTableName="REALM"/>        
    </changeSet>
</databaseChangeLog>