<?xml version="1.0" encoding="utf-8"?>
<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.5.xsd">
    <!--
        Added the constraints for entity TBCrop.
    -->
    <changeSet id="20200806075003-2" author="jhipster">

        <addForeignKeyConstraint baseColumnNames="tb_supplies_id"
                                 baseTableName="tb_crop"
                                 constraintName="fk_tb_crop_tb_supplies_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_supplies"/>

        <addForeignKeyConstraint baseColumnNames="tb_guideline_id"
                                 baseTableName="tb_crop"
                                 constraintName="fk_tb_crop_tb_guideline_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_guideline"/>

        <addForeignKeyConstraint baseColumnNames="tb_entity_id"
                                 baseTableName="tb_crop"
                                 constraintName="fk_tb_crop_tb_entity_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_entity"/>

        <addForeignKeyConstraint baseColumnNames="created_by"
                                 baseTableName="tb_crop"
                                 constraintName="fk_tb_crop_created_by_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_detail_user"/>

        <addForeignKeyConstraint baseColumnNames="modified_by"
                                 baseTableName="tb_crop"
                                 constraintName="fk_tb_crop_modified_by_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_detail_user"/>

        <addForeignKeyConstraint baseColumnNames="deleted_by"
                                 baseTableName="tb_crop"
                                 constraintName="fk_tb_crop_deleted_by_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_detail_user"/>

        <addForeignKeyConstraint baseColumnNames="tb_crops_id"
                                 baseTableName="tb_assignment"
                                 constraintName="fk_tb_crop_tb_assignment_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_crop"/>

        <addForeignKeyConstraint baseColumnNames="tb_detail_users_id"
                                 baseTableName="tb_assignment"
                                 constraintName="fk_tb_detail_users_tb_assignment_id"
                                 referencedColumnNames="id"
                                 referencedTableName="tb_detail_user"/>
    </changeSet>
</databaseChangeLog>
