<?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">
    <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="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" />
  </table>

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

</database>
