<?xml version="1.0" encoding="UTF-8"?>
<database name="propel" defaultIdMethod="native" package="lib.model">

  <table name="article">
    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" />
    <column name="title" type="varchar" size="255" required="true" />
    <column name="body" type="longvarchar" />
    <column name="Online" type="boolean" />
    <column name="excerpt" type="varchar" />
    <column name="category_id" type="integer" required="true" />
    <foreign-key foreignTable="category">
      <reference local="category_id" foreign="id" />
    </foreign-key>
    <column name="created_at" type="timestamp" />
    <column name="end_date" type="timestamp" />
    <column name="book_id" type="integer" />
    <foreign-key foreignTable="book">
      <reference local="book_id" foreign="id" onDelete="setnull" />
    </foreign-key>

    <unique name="unique_title_category">
      <unique-column name="title" />
      <unique-column name="category_id" />
    </unique>
  </table>

  <table name="category">
    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" />
    <column name="name" type="varchar" size="255" />
    <unique name="unique_name">
      <unique-column name="name" />
    </unique>
    <unique name="unique_name1">
      <unique-column name="name" />
    </unique>
  </table>

  <table name="book">
    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" />
    <column name="name" type="varchar" size="255" />
  </table>

  <table name="author">
    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" />
    <column name="name" type="varchar" size="255" />
  </table>

  <table name="author_article">
    <behavior name="symfony">
      <parameter name="form" value="false"/>
      <parameter name="filter" value="false"/>
    </behavior>
    <column name="author_id" type="integer" primaryKey="true" />
    <foreign-key foreignTable="author">
      <reference local="author_id" foreign="id" />
    </foreign-key>
    <column name="article_id" type="integer" primaryKey="true" />
    <foreign-key foreignTable="article">
      <reference local="article_id" foreign="id" />
    </foreign-key>
  </table>

  <table name="product" phpName="Product" isI18N="true" i18nTable="product_i18n">
    <column autoIncrement="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/>
    <column primaryKey="false" required="false" autoIncrement="false" name="price" type="float"/>
    <column name="a_primary_string" type="varchar" size="64" primaryString="true"/>
  </table>

  <table name="product_i18n" phpName="ProductI18n">
    <column autoIncrement="false" name="id" type="integer" required="true" primaryKey="true"/>
    <column autoIncrement="false" name="culture" isCulture="true" type="varchar" size="7" required="true" primaryKey="true"/>
    <column primaryKey="false" required="false" autoIncrement="false" name="name" type="varchar" size="50" primaryString="true"/>
    <foreign-key onDelete="none" onUpdate="none" foreignTable="product" refPhpName="Translation">
      <reference local="id" foreign="id"/>
    </foreign-key>
  </table>

  <table name="movie" isI18N="true" i18nTable="movie_i18n">
    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" />
    <column name="director" type="varchar" size="255" />
  </table>

  <table name="movie_i18n">
    <column name="id" type="integer" required="true" primaryKey="true" />
    <foreign-key foreignTable="movie" onDelete="cascade">
      <reference local="id" foreign="id"/>
    </foreign-key>
    <column name="culture" type="varchar" size="7" required="true" primaryKey="true" isCulture="true" />
    <column name="title" type="varchar" primaryString="true" />
    <unique>
     <unique-column name="title" />
    </unique>
  </table>

  <table name="attachment">
    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" />
    <column name="article_id" type="integer" />
    <column name="name" type="varchar" size="255" />
    <column name="file" type="varchar" size="255" />
    <foreign-key foreignTable="article">
      <reference local="article_id" foreign="id" onDelete="setnull" />
    </foreign-key>
  </table>

</database>
