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

  <behavior name="timestampable">
    <parameter name="boolean" value="true"/>
    <parameter name="create_column" value="create_date"/>
  </behavior>

  <table name="ab_group" phpName="Group" package="foo.bar.lib.model" isI18N="true" i18nTable="ab_group_i18n">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
    <column name="name" type="varchar" size="50" />
    <column name="type" type="varchar" size="50" inheritance="single">
      <inheritance extends="foo.bar.lib.model.Group" key="tight" class="Group_Tight" />
      <inheritance extends="foo.bar.lib.model.Group" key="loose" class="Group_Loose" package="some.other.package" />
    </column>
  </table>

  <table name="cd_user" phpName="User" isI18N="true" i18nTable="cd_user_i18n">
    <column name="first_name" type="varchar" size="255" default="Anonymous" />
    <column name="last_name" type="varchar" size="50" />
    <column name="age" type="integer" required="true" />
    <index>
      <index-column name="age" />
    </index>
    <column name="ab_group_id" type="integer" />
    <foreign-key foreignTable="ab_group">
      <reference local="ab_group_id" foreign="id" />
    </foreign-key>
    <column name="created_at" type="timestamp" />
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
  </table>

  <table name="cd_user_i18n">
    <column name="description" type="longvarchar" />
    <column name="id" type="integer" required="true" primaryKey="true" />
    <foreign-key foreignTable="cd_user" onDelete="cascade">
      <reference local="id" foreign="id" />
    </foreign-key>
    <column name="culture" isCulture="true" type="varchar" size="7" required="true" primaryKey="true" />
  </table>

  <table name="ef_article">
    <column name="title" type="longvarchar" required="true" />
    <unique>
      <unique-column name="title" />
    </unique>
    <column name="stripped_title" type="longvarchar" required="true" primaryKey="true" />
    <id-method-parameter value="my_custom_sequence_name" />
    <column name="user_id" type="integer" />
    <foreign-key foreignTable="cd_user">
      <reference local="user_id" foreign="id" />
    </foreign-key>
    <column name="my_group" type="integer" />
    <foreign-key foreignTable="ab_group" onDelete="setnull">
      <reference local="my_group" foreign="id" />
    </foreign-key>
    <column name="my_other_group" type="integer" phpName="MyOtherGroupPhpName" />
    <foreign-key foreignTable="ab_group" onDelete="setnull" phpName="MyOtherGroupFkPhpName" refPhpName="MyOtherGroupFkRefPhpName">
      <reference local="my_other_group" foreign="id" />
    </foreign-key>
    <column name="created_at" type="timestamp" />
    <column name="updated_at" type="timestamp" />
  </table>

  <table name="ij_article" phpName="Article" behaviors="a:2:{s:8:&quot;paranoid&quot;;a:1:{s:6:&quot;column&quot;;s:10:&quot;deleted_at&quot;;}s:17:&quot;act_as_nested_set&quot;;N;}">
    <behavior name="paranoid">
      <parameter name="column" value="deleted_at" />
    </behavior>
    <behavior name="act_as_nested_set" />
    <column name="title" type="varchar" size="50" />
    <column name="user_id" type="integer" />
    <column name="created_at" type="timestamp" />
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
    <index name="my_index">
      <index-column name="title" size="10" />
      <index-column name="user_id" />
    </index>
    <unique name="my_other_index">
      <unique-column name="created_at" size="10" />
    </unique>
    <foreign-key foreignTable="cd_user" onDelete="cascade" phpName="SomePhpName" refPhpName="SomeRefPhpName">
      <reference local="user_id" foreign="id" />
    </foreign-key>
  </table>

  <table name="kl_article">
    <column name="title" type="varchar" size="50" />
    <column name="user_id" type="integer" phpName="AuthorId" />
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
    <foreign-key phpName="Author" foreignTable="cd_user">
      <reference local="user_id" foreign="id" />
    </foreign-key>
  </table>

  <table name="ab_group_i18n">
    <column name="motto" type="longvarchar" />
    <column name="id" type="integer" required="true" primaryKey="true" />
    <foreign-key foreignTable="ab_group" onDelete="cascade">
      <reference local="id" foreign="id" />
    </foreign-key>
    <column name="culture" isCulture="true" type="varchar" size="7" required="true" primaryKey="true" />
  </table>

  <table name="history">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
    <column name="type" type="varchar" size="64" inheritance="single">
      <inheritance extends="lib.model.History" key="new_user" class="History_NewUser" />
      <inheritance extends="lib.model.History" key="new_page" class="History_NewPage" />
    </column>
  </table>

  <table name="my_nested_sets" phpName="myNestedSetNode" treeMode="NestedSet">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
    <column name="lft" type="integer" required="true" nestedSetLeftKey="true" />
    <column name="rgt" type="integer" required="true" nestedSetRightKey="true" />
    <column name="scope" type="integer" required="true" treeScopeKey="true" />
  </table>

</database>
