Permalink
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (39 sloc) 2.16 KB
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<database name="bookstore-behavior" defaultIdMethod="native" package="behavior.aggregate" namespace="Propel\Tests\Bookstore\Behavior">
<table name="aggregate_post" phpName="AggregatePost">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<behavior name="aggregate_column">
<parameter name="name" value="nb_comments" />
<parameter name="expression" value="COUNT(id)" />
<parameter name="foreign_table" value="aggregate_comment" />
</behavior>
</table>
<table name="aggregate_comment" phpName="AggregateComment">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="post_id" type="INTEGER" />
<foreign-key foreignTable="aggregate_post" onDelete="setnull" onUpdate="cascade">
<reference local="post_id" foreign="id" />
</foreign-key>
</table>
<table name="aggregate_poll" phpName="AggregatePoll">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<behavior id="aggregate_total_score" name="aggregate_column">
<parameter name="name" value="total_score" />
<parameter name="expression" value="SUM(score)" />
<parameter name="foreign_table" value="aggregate_item" />
</behavior>
<behavior id="aggregate_nb_votes" name="aggregate_column">
<parameter name="name" value="nb_votes" />
<parameter name="expression" value="COUNT(score)" />
<parameter name="foreign_table" value="aggregate_item" />
</behavior>
</table>
<table name="aggregate_item" phpName="AggregateItem">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="score" defaultValue="0" type="INTEGER" />
<column name="poll_id" type="INTEGER" />
<foreign-key foreignTable="aggregate_poll" onDelete="setnull" onUpdate="cascade">
<reference local="poll_id" foreign="id" />
</foreign-key>
</table>
</database>