Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

404 lines (364 sloc) 22.0 kb
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<database name="bookstore" defaultIdMethod="native"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
namespace="Propel\Tests\Bookstore">
<table name="book" description="Book Table">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Book Id" />
<column name="title" type="VARCHAR" required="true" description="Book Title" primaryString="true" />
<column name="isbn" required="true" type="VARCHAR" size="24" phpName="ISBN" description="ISBN Number" primaryString="false" />
<column name="price" required="false" type="FLOAT" description="Price of the book." />
<column name="publisher_id" required="false" type="INTEGER" description="Foreign Key Publisher" />
<column name="author_id" required="false" type="INTEGER" description="Foreign Key Author" />
<foreign-key foreignTable="publisher" onDelete="setnull">
<reference local="publisher_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="author" onDelete="setnull" onUpdate="cascade">
<reference local="author_id" foreign="id" />
</foreign-key>
</table>
<table name="publisher" description="Publisher Table" defaultStringFormat="XML">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Publisher Id" />
<column name="name" required="true" type="VARCHAR" size="128" default="Penguin" description="Publisher Name" />
</table>
<table name="author" description="Author Table">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Author Id" />
<column name="first_name" required="true" type="VARCHAR" size="128" description="First Name" />
<column name="last_name" required="true" type="VARCHAR" size="128" description="Last Name" />
<column name="email" type="VARCHAR" size="128" description="E-Mail Address" />
<column name="age" type="INTEGER" description="The authors age" />
</table>
<!-- This table exists to test multi-level JOINS with renamed relations -->
<table name="book_summary">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="book_id" required="true" type="INTEGER" />
<column name="summary" required="true" type="LONGVARCHAR" />
<foreign-key phpName="SummarizedBook" foreignTable="book" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
</table>
<!-- This table exists to test validators -->
<table name="review" description="Book Review">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Review Id" />
<column name="reviewed_by" required="true" type="VARCHAR" size="128" description="Reviewer Name" />
<column name="review_date" required="true" type="DATE" default="2001-01-01" description="Date of Review" />
<column name="recommended" required="true" type="BOOLEAN" description="Does reviewer recommend book?" />
<column name="status" type="VARCHAR" size="8" description="The status of this review." />
<column name="book_id" required="false" type="INTEGER" description="Book ID for this review" />
<foreign-key foreignTable="book" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
</table>
<!-- This table exists to test the related setters on identical table ("relatedByXXX" issues) and column phpNames -->
<table name="essay" >
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="title" type="VARCHAR" required="true" primaryString="true" />
<column name="first_author_id" required="false" type="INTEGER" description="Foreign Key Author" />
<column name="second_author_id" required="false" type="INTEGER" description="Foreign Key Author" />
<column name="subtitle" type="VARCHAR" phpName="SecondTitle" />
<column name="next_essay_id" required="false" type="INTEGER" description="Book Id" />
<foreign-key foreignTable="author" onDelete="setnull" onUpdate="cascade" phpName="FirstAuthor">
<reference local="first_author_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="author" defaultJoin="INNER JOIN" onDelete="setnull" onUpdate="cascade" phpName="SecondAuthor">
<reference local="second_author_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="essay" onDelete="setnull" onUpdate="cascade">
<reference local="next_essay_id" foreign="id" />
</foreign-key>
</table>
<!-- This table exists to test the related setters on identical table ("relatedByXXX" issues) when there is more than one self-referential foreign key -->
<table name="composite_essay" >
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="title" type="VARCHAR" required="true" primaryString="true" />
<column name="first_essay_id" required="false" type="INTEGER" description="Book Id" />
<column name="second_essay_id" required="false" type="INTEGER" description="Book Id" />
<foreign-key foreignTable="composite_essay" onDelete="setnull" onUpdate="cascade" phpName="firstEssay">
<reference local="first_essay_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="composite_essay" onDelete="setnull" onUpdate="cascade" phpName="secondEssay">
<reference local="second_essay_id" foreign="id" />
</foreign-key>
</table>
<!-- This table and the following exist to test the related setters ("relatedByXXX" issues) when two foreign keys exist on symmetrical tables -->
<table name="man" >
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true"/>
<column name="wife_id" type="INTEGER"/>
<foreign-key foreignTable="woman" onDelete="setnull">
<reference local="wife_id" foreign="id"/>
</foreign-key>
</table>
<table name="woman" >
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="husband_id" type="INTEGER"/>
<foreign-key foreignTable="man">
<reference local="husband_id" foreign="id"/>
</foreign-key>
</table>
<!-- This table exists to explore/test the handling of BLOB/CLOB objects. -->
<table name="media">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Media Id" />
<column name="cover_image" type="BLOB" lazyLoad="true" description="The image of the book cover." />
<column name="excerpt" type="CLOB" lazyLoad="true" description="An excerpt from the book." />
<column name="book_id" required="true" type="INTEGER" description="Book ID for this media collection." />
<foreign-key foreignTable="book" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
</table>
<!-- test many-to-many relationships -->
<table name="book_club_list" description="Reading list for a book club.">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" description="Unique ID for a school reading list." />
<column name="group_leader" required="true" type="VARCHAR" size="100" description="The name of the teacher in charge of summer reading." />
<column name="theme" required="false" type="VARCHAR" size="50" description="The theme, if applicable, for the reading list." />
<column name="created_at" required="false" type="TIMESTAMP" />
</table>
<table name="book_x_list" phpName="BookListRel" isCrossRef="true"
description="Cross-reference table between book and book_club_list rows.">
<column name="book_id" primaryKey="true" type="INTEGER" description="Fkey to book.id" />
<column name="book_club_list_id" primaryKey="true" type="INTEGER" description="Fkey to book_club_list.id" />
<foreign-key foreignTable="book" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book_club_list" onDelete="cascade">
<reference local="book_club_list_id" foreign="id" />
</foreign-key>
</table>
<table name="book_club_list_favorite_books" phpName="BookListFavorite" isCrossRef="true"
description="Another cross-reference table for many-to-many relationship between book rows and book_club_list rows for favorite books.">
<column name="book_id" primaryKey="true" type="INTEGER" description="Fkey to book.id" />
<column name="book_club_list_id" primaryKey="true" type="INTEGER" description="Fkey to book_club_list.id" />
<foreign-key foreignTable="book" phpName="FavoriteBook" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book_club_list" phpName="FavoriteBookClubList" onDelete="cascade">
<reference local="book_club_list_id" foreign="id" />
</foreign-key>
</table>
<!-- test self-referencing foreign keys and inheritance-->
<table name="bookstore_employee"
description="Hierarchical table to represent employees of a bookstore.">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" description="Employee ID number" />
<column name="class_key" type="INTEGER" required="true" default="0" inheritance="single">
<inheritance key="0" class="BookstoreEmployee" />
<inheritance key="1" class="BookstoreManager" extends="BookstoreEmployee" />
<inheritance key="2" class="BookstoreCashier" extends="BookstoreEmployee" />
<inheritance key="3" class="BookstoreHead" extends="BookstoreManager"/>
</column>
<column name="name" type="VARCHAR" size="32" description="Employee name" />
<column name="job_title" type="VARCHAR" size="32" description="Employee job title" />
<column name="supervisor_id" type="INTEGER" description="Fkey to supervisor." />
<column name="photo" type="BLOB" lazyLoad="true" />
<foreign-key foreignTable="bookstore_employee" phpName="Supervisor" refPhpName="Subordinate" onDelete="setnull">
<reference local="supervisor_id" foreign="id" />
</foreign-key>
</table>
<!-- Test one-to-one (1:1) relationship, default values -->
<table name="bookstore_employee_account" reloadOnInsert="true" reloadOnUpdate="true" description="Bookstore employees login credentials.">
<column name="employee_id" type="INTEGER" primaryKey="true" description="Primary key for the account ..." />
<column name="login" type="VARCHAR" size="32" />
<column name="password" type="VARCHAR" size="100" default="'@''34&quot;" />
<column name="enabled" type="BOOLEAN" default="true" />
<column name="not_enabled" type="BOOLEAN" default="false" />
<column name="created" type="TIMESTAMP" defaultExpr="CURRENT_TIMESTAMP" />
<column name="role_id" type="INTEGER" required="false" default="null" />
<column name="authenticator" type="VARCHAR" size="32" defaultExpr="'Password'" />
<foreign-key foreignTable="bookstore_employee" onDelete="cascade">
<reference local="employee_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="acct_access_role" onDelete="setnull">
<reference local="role_id" foreign="id" />
</foreign-key>
<unique>
<unique-column name="login" />
</unique>
</table>
<table name="acct_audit_log">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="uid" type="VARCHAR" size="32" required="true" />
<column name="message" type="VARCHAR" size="255" />
<foreign-key foreignTable="bookstore_employee_account" onDelete="cascade">
<reference local="uid" foreign="login" />
</foreign-key>
<index>
<index-column name="id" />
<index-column name="uid" />
</index>
<unique>
<unique-column name="uid" />
<unique-column name="message" />
</unique>
</table>
<table name="acct_access_role">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" description="Role ID number" />
<column name="name" type="VARCHAR" size="25" required="true" />
</table>
<!-- book_reader, book_opinion, and reader_favorite test some foreign key issues
(see: http://propel.phpdb.org/trac/ticket/228) -->
<table name="book_reader">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" description="Book reader ID number" />
<column name="name" type="VARCHAR" size="50" />
</table>
<!-- Test composite primary keys -->
<table name="book_opinion">
<column name="book_id" type="INTEGER" primaryKey="true" />
<column name="reader_id" type="INTEGER" primaryKey="true" />
<column name="rating" type="DECIMAL" />
<column name="recommend_to_friend" type="BOOLEAN" />
<foreign-key foreignTable="book" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book_reader" onDelete="cascade">
<reference local="reader_id" foreign="id" />
</foreign-key>
</table>
<!-- Test multiple foreign keys for a single column -->
<table name="reader_favorite">
<column name="book_id" type="INTEGER" primaryKey="true" />
<column name="reader_id" type="INTEGER" primaryKey="true" />
<foreign-key foreignTable="book" onDelete="cascade">
<reference local="book_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book_reader" onDelete="cascade">
<reference local="reader_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book_opinion" onDelete="cascade">
<reference local="book_id" foreign="book_id"/>
<reference local="reader_id" foreign="reader_id"/>
</foreign-key>
</table>
<!-- Test some custom php column types. -->
<table name="bookstore">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" description="Book store ID number" />
<column name="store_name" type="VARCHAR" size="50" required="true" />
<column name="location" type="VARCHAR" size="100" />
<column name="population_served" type="BIGINT" />
<column name="total_books" type="INTEGER" />
<column name="store_open_time" type="TIME" />
<column name="website" type="VARCHAR" size="255"/>
</table>
<!-- test default values on foreign keys, default expr w/ reloadOnUpdate="true" -->
<table name="bookstore_sale" reloadOnUpdate="true">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="bookstore_id" type="INTEGER" required="false" default="1" />
<column name="publisher_id" type="INTEGER" required="false" />
<column name="sale_name" type="VARCHAR" size="100" required="false" />
<column name="discount" type="TINYINT" description="Discount percentage" defaultExpr="10" />
<foreign-key foreignTable="bookstore" onDelete="cascade">
<reference local="bookstore_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="publisher" onDelete="setnull">
<reference local="publisher_id" foreign="id" />
</foreign-key>
</table>
<table name="customer" allowPkInsert="true">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" size="255" />
<column name="join_date" type="DATE" />
</table>
<table name="contest">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" size="100" />
<column name="country_code" type="VARCHAR" size="6" />
<foreign-key foreignTable="country" onDelete="setnull">
<reference local="country_code" foreign="code" />
</foreign-key>
</table>
<!-- Test Views (read-only tables) -->
<table name="country_translation" readOnly="true">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="country_code" type="VARCHAR" size="6" />
<column name="language_code" type="VARCHAR" size="6" />
<column name="label" type="VARCHAR" size="100" />
<index>
<index-column name="country_code"/>
</index>
<foreign-key foreignTable="country" onDelete="cascade">
<reference local="country_code" foreign="code" />
</foreign-key>
</table>
<!-- Test Views (read-only tables) -->
<table name="country" readOnly="true">
<column name="code" type="VARCHAR" size="6" primaryKey="true" />
<column name="capital" type="VARCHAR" size="100" />
</table>
<table name="bookstore_contest">
<column name="bookstore_id" type="INTEGER" primaryKey="true" />
<column name="contest_id" type="INTEGER" primaryKey="true" />
<column name="prize_book_id" type="INTEGER" />
<foreign-key foreignTable="bookstore" onDelete="cascade">
<reference local="bookstore_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="contest" onDelete="cascade">
<reference local="contest_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book" onDelete="setnull" phpName="Work">
<reference local="prize_book_id" foreign="id" />
</foreign-key>
</table>
<table name="bookstore_contest_entry" reloadOnInsert="true">
<column name="bookstore_id" type="INTEGER" primaryKey="true" />
<column name="contest_id" type="INTEGER" primaryKey="true" />
<column name="customer_id" type="INTEGER" primaryKey="true" />
<column name="entry_date" type="TIMESTAMP" defaultExpr="CURRENT_TIMESTAMP" />
<foreign-key foreignTable="bookstore" onDelete="cascade">
<reference local="bookstore_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="customer" onDelete="cascade">
<reference local="customer_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="bookstore_contest" onDelete="cascade">
<reference local="bookstore_id" foreign="bookstore_id" />
<reference local="contest_id" foreign="contest_id" />
</foreign-key>
</table>
<table name="book2">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="title" type="VARCHAR" />
<column name="style" type="ENUM" valueSet="novel, essay, poetry" />
<column name="tags" type="ARRAY" />
</table>
<!-- Test single table inheritance with Abstract true -->
<table name="distribution" abstract="true">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" />
<column name="type" type="INTEGER" required="true" default="0" inheritance="single">
<inheritance key="44" class="DistributionStore" />
<inheritance key="23" class="DistributionOnline" extends="DistributionStore" />
<inheritance key="3838" class="DistributionVirtualStore" extends="DistributionStore" />
</column>
<column name="distribution_manager_id" type="INTEGER" required="true"/>
<foreign-key foreignTable="distribution_manager" onDelete="cascade">
<reference local="distribution_manager_id" foreign="id" />
</foreign-key>
</table>
<table name="distribution_manager">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" />
</table>
<table name="record_label">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="abbr" type="VARCHAR" size="5" primaryKey="true" required="true"/>
<column name="name" type="VARCHAR" />
</table>
<table name="release_pool">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="record_label_id" type="INTEGER" required="true"/>
<column name="name" type="VARCHAR" />
<foreign-key foreignTable="record_label" onDelete="cascade">
<reference local="record_label_id" foreign="id" />
</foreign-key>
</table>
<table name="polymorphic_relation_log">
<column name="id" primaryKey="true" autoIncrement="true" type="INTEGER"/>
<column name="message" type="VARCHAR" required="true" />
<column name="target_id" required="false" type="INTEGER" />
<column name="target_type" required="false" type="VARCHAR" size="55" />
<foreign-key foreignTable="author" onDelete="setnull" onUpdate="cascade">
<reference local="target_type" value="author" />
<reference local="target_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="book" onDelete="setnull" onUpdate="cascade">
<reference local="target_type" value="book" />
<reference local="target_id" foreign="id" />
</foreign-key>
</table>
</database>
Jump to Line
Something went wrong with that request. Please try again.