<database defaultIdMethod="native" name="thelia" namespace="PlanificationLivraison\Model">

    <table name="order_delivery_schedule">
        <column name="id" autoIncrement="true" primaryKey="true" required="true" type="INTEGER" />
        <column name="order_id" type="INTEGER" />
        <column name="delivery_address_id" required="false" type="INTEGER" />
        <column name="delivery_place_id" required="false" type="INTEGER" />

        <column name="schedule_id" required="true" type="INTEGER" />
        <column name="due_delivery_time_start" required="true" type="TIMESTAMP" />
        <column name="due_delivery_time_end" required="true" type="TIMESTAMP" />

        <foreign-key foreignTable="order" name="fk_order_delivery_schedule_order_id">
            <reference foreign="id" local="order_id" />
        </foreign-key>
        <foreign-key foreignTable="order_address" name="fk_order_delivery_address_id">
            <reference foreign="id" local="delivery_address_id" />
        </foreign-key>
        <foreign-key foreignTable="pdr_places" name="fk_order_delivery_place_id">
            <reference foreign="id" local="delivery_place_id" />
        </foreign-key>
        <foreign-key foreignTable="lps_area_schedule" name="fk_order_delivery_schedule_id">
            <reference foreign="id" local="schedule_id" />
        </foreign-key>

    </table>
    <external-schema filename="local/config/schema.xml" referenceOnly="true" />
    <external-schema filename="local/modules/LivraisonParSecteurs/Config/schema.xml" referenceOnly="true" />
    <external-schema filename="local/modules/PointRetrait/Config/schema.xml" referenceOnly="true" />

</database>
