<?xml version="1.1" 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 https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
    <changeSet author="Sheldan" id="cool_down_channel_group-table">
        <createTable tableName="cool_down_channel_group">
            <column name="id" type="BIGINT">
                <constraints nullable="true" primaryKey="true" primaryKeyName="pk_command_cooldown_channel_group"/>
            </column>
            <column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
                <constraints nullable="true"/>
            </column>
            <column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
            <column name="channel_cool_down" type="integer">
                <constraints nullable="true"/>
            </column>
            <column name="member_cool_down" type="integer">
                <constraints nullable="true"/>
            </column>
        </createTable>
        <addForeignKeyConstraint baseColumnNames="id" baseTableName="cool_down_channel_group" constraintName="fk_cool_down_channel_group_group_group"
                                 deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="channel_group" validate="true"/>

        <sql>
            DROP TRIGGER IF EXISTS cool_down_channel_group_update_trigger ON cool_down_channel_group;
            CREATE TRIGGER repost_check_channel_group_update_trigger BEFORE UPDATE ON cool_down_channel_group FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
        </sql>
        <sql>
            DROP TRIGGER IF EXISTS cool_down_channel_group_insert_trigger ON cool_down_channel_group;
            CREATE TRIGGER repost_check_channel_group_insert_trigger BEFORE INSERT ON cool_down_channel_group FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
        </sql>
    </changeSet>

</databaseChangeLog>