<?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="press_f_presser-table">
        <createTable tableName="press_f_presser">
            <column name="press_f_presser_user_in_server_id" type="BIGINT">
                <constraints nullable="false"/>
            </column>
            <column name="press_f_id" type="BIGINT">
                <constraints nullable="false"/>
            </column>
            <column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
                <constraints nullable="false"/>
            </column>
            <column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
        </createTable>
        <addPrimaryKey columnNames="press_f_presser_user_in_server_id, press_f_id" tableName="press_f_presser" constraintName="pk_press_f_presser" validate="true"/>
        <addForeignKeyConstraint baseColumnNames="press_f_presser_user_in_server_id" baseTableName="press_f_presser" constraintName="fk_press_f_presser_user"
                                 deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" 
                                 referencedTableName="user_in_server" validate="true"/>
        <addForeignKeyConstraint baseColumnNames="press_f_id" baseTableName="press_f_presser" constraintName="fk_press_f_presser_press_f"
                                 deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
                                 referencedTableName="press_f" validate="true"/>
        <sql>
            DROP TRIGGER IF EXISTS press_f_presser_update_trigger ON press_f_presser;
            CREATE TRIGGER press_f_presser_update_trigger BEFORE UPDATE ON press_f_presser FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
        </sql>
        <sql>
            DROP TRIGGER IF EXISTS press_f_presser_insert_trigger ON press_f_presser;
            CREATE TRIGGER press_f_presser_insert_trigger BEFORE INSERT ON press_f_presser FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
        </sql>
    </changeSet>

</databaseChangeLog>