All Downloads are FREE. Search and download functionalities are using the official Maven repository.

db.v5.10.0.initialize.xml Maven / Gradle / Ivy

<?xml version="1.1" encoding="UTF-8"?>
<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-latest.xsd
                   http://www.liquibase.org/xml/ns/dbchangelog
                   http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

    <changeSet author="DTH" id="init-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="task"/>
            </not>
        </preConditions>
        <createTable tableName="task">
            <column name="id" type="UUID">
                <constraints nullable="false"
                             primaryKey="true"
                             primaryKeyName="task_pkey"/>
            </column>
            <column name="status" type="SMALLINT"/>
            <column name="timestamp" type="TIMESTAMP WITHOUT TIME ZONE">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <addUniqueConstraint constraintName="uk_task_timestamp"
                             tableName="task"
                             columnNames="timestamp"/>
        <createIndex indexName="task_status_idx" tableName="task">
            <column name="status"/>
        </createIndex>
    </changeSet>

    <changeSet author="DTH" id="init-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="process_file"/>
            </not>
        </preConditions>
        <createTable tableName="process_file">
            <column name="id" type="UUID">
                <constraints nullable="false"
                             primaryKey="true"
                             primaryKeyName="process_file_pkey"/>
            </column>
            <column name="ending_availability_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
            <column name="file_group" type="VARCHAR(255)"/>
            <column name="file_object_key" type="VARCHAR(500)">
                <constraints nullable="false"/>
            </column>
            <column name="file_type" type="VARCHAR(255)"/>
            <column name="document_id" type="VARCHAR(255)"/>
            <column name="last_modification_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
            <column name="starting_availability_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
        </createTable>
        <addUniqueConstraint constraintName="uk_process_file_file_object_key"
                             tableName="process_file"
                             columnNames="file_object_key"/>
    </changeSet>

    <changeSet author="DTH" id="init-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="process_run"/>
            </not>
            <tableExists tableName="task"/>
        </preConditions>
        <createTable tableName="process_run">
            <column name="id" type="UUID">
                <constraints nullable="false"
                             primaryKey="true"
                             primaryKeyName="process_run_pkey"/>
            </column>
            <column name="execution_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
            <column name="task_id" type="UUID"/>
        </createTable>
        <addForeignKeyConstraint baseTableName="process_run"
                                 baseColumnNames="task_id"
                                 constraintName="fk_process_run_fk1"
                                 referencedTableName="task"
                                 referencedColumnNames="id"
                                 validate="true"/>
    </changeSet>

    <changeSet author="DTH" id="init-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="process_event"/>
            </not>
            <tableExists tableName="task"/>
        </preConditions>
        <createTable tableName="process_event">
            <column name="id" type="UUID">
                <constraints nullable="false"
                             primaryKey="true"
                             primaryKeyName="process_event_pkey"/>
            </column>
            <column name="level" type="VARCHAR(255)"/>
            <column name="message" type="TEXT"/>
            <column name="service_name" type="VARCHAR(255)"/>
            <column name="timestamp" type="TIMESTAMP WITHOUT TIME ZONE"/>
            <column name="task_id" type="UUID"/>
        </createTable>
        <createIndex indexName="process_event_task_idx" tableName="process_event">
            <column name="task_id"/>
        </createIndex>
        <addForeignKeyConstraint baseTableName="process_event"
                                 baseColumnNames="task_id"
                                 constraintName="fk_process_event_fk1"
                                 referencedTableName="task"
                                 referencedColumnNames="id"
                                 validate="true"/>
    </changeSet>

    <changeSet author="DTH" id="init-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="parameter"/>
            </not>
        </preConditions>
        <createTable tableName="parameter">
            <column name="id" type="VARCHAR(255)">
                <constraints nullable="false"
                             primaryKey="true"
                             primaryKeyName="parameter_pkey"/>
            </column>
            <column name="display_order" type="INTEGER">
                <constraints nullable="false"/>
            </column>
            <column name="name" type="VARCHAR(255)"/>
            <column name="parameter_type" type="VARCHAR(255)"/>
            <column name="parameter_value" type="VARCHAR(255)"/>
            <column name="section_order" type="INTEGER">
                <constraints nullable="false"/>
            </column>
            <column name="section_title" type="VARCHAR(255)"/>
        </createTable>
    </changeSet>

    <changeSet author="DTH" id="init-6">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="task_process_file"/>
            </not>
            <tableExists tableName="process_file"/>
            <tableExists tableName="task"/>
        </preConditions>
        <createTable tableName="task_process_file">
            <column name="fk_task" type="UUID">
                <constraints nullable="false"/>
            </column>
            <column name="fk_process_file" type="UUID">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <addPrimaryKey tableName="task_process_file"
                       columnNames="fk_process_file, fk_task"
                       constraintName="task_process_file_pkey"/>
        <addForeignKeyConstraint baseTableName="task_process_file"
                                 baseColumnNames="fk_process_file"
                                 constraintName="fk_task_process_file_fk1"
                                 referencedTableName="process_file"
                                 referencedColumnNames="id"
                                 validate="true"/>
        <addForeignKeyConstraint baseTableName="task_process_file"
                                 baseColumnNames="fk_task"
                                 constraintName="fk_task_process_file_fk2"
                                 referencedTableName="task"
                                 referencedColumnNames="id"
                                 validate="true"/>
    </changeSet>

    <changeSet author="DTH" id="init-7">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="task_available_process_file"/>
            </not>
            <tableExists tableName="process_file"/>
            <tableExists tableName="task"/>
        </preConditions>
        <createTable tableName="task_available_process_file">
            <column name="fk_task" type="UUID">
                <constraints nullable="false"/>
            </column>
            <column name="fk_process_file" type="UUID">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <addPrimaryKey tableName="task_available_process_file"
                       columnNames="fk_process_file, fk_task"
                       constraintName="task_available_process_file_pkey"/>
        <addForeignKeyConstraint baseTableName="task_available_process_file"
                                 baseColumnNames="fk_process_file"
                                 constraintName="fk_task_available_process_file_fk1"
                                 referencedTableName="process_file"
                                 referencedColumnNames="id"
                                 validate="true"/>
        <addForeignKeyConstraint baseTableName="task_available_process_file"
                                 baseColumnNames="fk_task"
                                 constraintName="fk_task_available_process_file_fk2"
                                 referencedTableName="task"
                                 referencedColumnNames="id"
                                 validate="true"/>
    </changeSet>

    <changeSet author="DTH" id="init-8">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="process_run_process_file"/>
            </not>
            <tableExists tableName="process_run"/>
            <tableExists tableName="process_file"/>
        </preConditions>
        <createTable tableName="process_run_process_file">
            <column name="fk_process_run" type="UUID">
                <constraints nullable="false"/>
            </column>
            <column name="fk_process_file" type="UUID">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <addForeignKeyConstraint baseTableName="process_run_process_file"
                                 baseColumnNames="fk_process_run"
                                 constraintName="fk_process_run_process_file_fk1"
                                 referencedTableName="process_run"
                                 referencedColumnNames="id"
                                 validate="true"/>
        <addForeignKeyConstraint baseTableName="process_run_process_file"
                                 baseColumnNames="fk_process_file"
                                 constraintName="fk_process_run_process_file_fk2"
                                 referencedTableName="process_file"
                                 referencedColumnNames="id"
                                 validate="true"/>
    </changeSet>

</databaseChangeLog>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy