<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="../../../core/vendor/thelia/propel/resources/xsd/database.xsd" >

    <table name="lps_area" namespace="LivraisonParSecteurs\Model">
        <column name="id" primaryKey="true" required="true" type="INTEGER" />
        <column name="title" required="true" size="50" type="VARCHAR" />
        <column name="active" required="true" type="TINYINT" defaultValue="1" />
        <column name="price" required="true" type="FLOAT" defaultValue="0" />
        <column name="minimum_amount" required="true" type="FLOAT" defaultValue="15" />

        <behavior name="timestampable" />
    </table>


    <table name="lps_area_city" namespace="LivraisonParSecteurs\Model">
        <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
        <column name="id_area" required="true" type="INTEGER" />
        <column name="zipcode" required="true" size="10" type="VARCHAR" />
        <column name="title" required="true" size="50" type="VARCHAR" />
        <column name="latitude" required="false" type="DOUBLE" />
        <column name="longitude" required="false" type="DOUBLE" />

        <foreign-key foreignTable="lps_area" name="fk_area_area_city" onDelete="CASCADE">
            <reference foreign="id" local="id_area"/>
        </foreign-key>

        <behavior name="timestampable" />
    </table>


    <table name="lps_area_schedule" namespace="LivraisonParSecteurs\Model">
        <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
        <column name="id_area" required="true" type="INTEGER" />
        <column name="day" required="true" type="INTEGER" />
        <column name="begin_time" required="true" type="TIME" />
        <column name="end_time" required="true" type="TIME" />

        <foreign-key foreignTable="lps_area" name="fk_area_area_schedule" onDelete="CASCADE">
            <reference foreign="id" local="id_area"/>
        </foreign-key>

        <behavior name="timestampable" />
    </table>

</database>
