<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_1.dtd">
<!-- Autogenerated by JDBCToXMLSchema! -->
<database>
    
    <!-- associates a page with its sub group pages -->
    <table name="SUB_PAGES">
        <column name="PAGE_ID" required="true" size="80" type="VARCHAR"/>
        <column name="SUB_PAGE_ID" required="true" size="80" type="VARCHAR"/>
        <index name="IX_SUB_PAGES_1">
            <index-column name="PAGE_ID" />
            <index-column name="SUB_PAGE_ID" />
        </index>
    </table>
    
    <!--
       Page Definitions
    -->

    <table name="PAGE">
        <column name="PAGE_ID" primaryKey="true" required="true"
            size="80" type="VARCHAR"/>
        <column name="TITLE" size="100" type="VARCHAR"/>
        <column name="DEFAULT_SKIN" size="100" type="VARCHAR"/>
        <column name="DEFAULT_DECORATOR" size="100" type="VARCHAR"/>
        <column name="DEFAULT_PORTLET_DECORATOR" size="100" type="VARCHAR"/>
        <column name="ACL" size="80" type="VARCHAR"/>
    </table>
    
    <!--
       Fragments (portlets, layouts)
    -->

    <table name="FRAGMENT">
        <column name="FRAGMENT_ID" primaryKey="true" required="true"
            size="80" type="VARCHAR"/>
        <column name="COMPONENT_NAME" size="100" type="VARCHAR"/>
        <column name="ACL" size="80" type="VARCHAR"/>
        <column name="TITLE" size="100" type="VARCHAR"/>
        <column name="TYPE" size="40" type="VARCHAR"/>
        <column name="SKIN" size="80" type="VARCHAR"/>
        <column name="DECORATOR" size="80" type="VARCHAR"/>
        <column name="STATE" size="40" type="VARCHAR"/>
    </table>
    
    <!-- associates a page with its top level fragments -->
    <table name="PAGE_FRAGMENTS">
        <column name="PAGE_ID" required="true" size="80" type="VARCHAR"/>
        <column name="FRAGMENT_ID" required="true" size="80" type="VARCHAR"/>
        <index name="IX_PAGE_FRAGMENTS_1">
            <index-column name="PAGE_ID" />
            <index-column name="FRAGMENT_ID" />
        </index>
    </table>
    
    <!-- associates a fragment with its top level fragments -->
    <table name="SUB_FRAGMENTS">
        <column name="FRAGMENT_ID" required="true" size="80" type="VARCHAR"/>
        <column name="SUB_FRAGMENT_ID" required="true" size="80" type="VARCHAR"/>
        <index name="IX_SUB_FRAGMENTS_1">
            <index-column name="FRAGMENT_ID" />
            <index-column name="SUB_FRAGMENT_ID" />
        </index>
    </table>
    
    <table name="FRAGMENT_PARAMETER">
        <column name="PARAMETER_ID" primaryKey="true" required="true" type="INTEGER"/>
        <column name="FRAGMENT_ID" required="true" type="INTEGER"/>
        <column name="NAME" required="true" size="80" type="VARCHAR"/>
        <column name="VALUE" required="true" type="LONGVARCHAR"/>
        <unique name="UN_FRAGMENT_PARAMETER_1">
          <unique-column name="FRAGMENT_ID" />
          <unique-column name="PARAMETER_ID" />
        </unique>
    </table>
    
    <!-- names a reference to a fragment subtree -->
    <table name="FRAGMENT_REF">
        <column name="FRAGMENT_REF_ID" primaryKey="true" required="true"
            size="80" type="VARCHAR"/>
        <column name="FRAGMENT_ID" required="true" size="80" type="VARCHAR"/>
        <column name="NAME" required="true" size="80" type="VARCHAR"/>
        <column name="TITLE" size="100" type="VARCHAR"/>
    </table>
    
    <table name="FRAGMENT_REFS">
        <column name="FRAGMENT_REF_ID" required="true" size="80" type="VARCHAR"/>
        <column name="FRAGMENT_ID" required="true" size="80" type="VARCHAR"/>
    </table>
    
    <!--
       Profiler
    -->

    <table name="PROFILING_RULE">
        <column name="RULE_ID" primaryKey="true" required="true"
            size="80" type="VARCHAR"/>
        <column name="CLASS_NAME" required="true" size="100" type="VARCHAR"/>
        <column name="TITLE" size="100" type="VARCHAR"/>
    </table>

    <table name="RULE_CRITERION">
        <column name="CRITERION_ID" primaryKey="true" required="true"
            size="80" type="VARCHAR"/>
        <column name="RULE_ID" required="true" size="80" type="VARCHAR"/>
        <column name="FALLBACK_ORDER" required="true" type="INTEGER"/>
        <column name="REQUEST_TYPE" required="true" size="40" type="VARCHAR"/>
        <column name="NAME" required="true" size="80" type="VARCHAR"/>
        <column name="VALUE" size="128" type="VARCHAR"/>
        <column default="1" name="FALLBACK_TYPE" type="INTEGER"/>
        <index name="IX_RULE_CRITERION_1">
            <index-column name="RULE_ID" />
            <index-column name="FALLBACK_ORDER" />
        </index>
        <foreign-key foreignTable="PROFILING_RULE" onDelete="cascade">
            <reference foreign="RULE_ID" local="RULE_ID"/>
        </foreign-key>           
    </table>
          
    <table name="PRINCIPAL_RULE_ASSOC">
        <column name="PRINCIPAL_NAME" primaryKey="true" required="true" size="80" type="VARCHAR"/>
        <column name="LOCATOR_NAME" primaryKey="true" required="true" size="80" type="VARCHAR"/>
        <column name="RULE_ID" required="true" size="80" type="VARCHAR"/>
    </table>
        	    
    <table name="PROFILE_PAGE_ASSOC">
        <column name="LOCATOR_HASH" required="true" size="40" type="VARCHAR"/>
        <column name="PAGE_ID" required="true" size="80" type="VARCHAR"/>
        <unique name="UN_PROFILE_PAGE_1">
          <unique-column name="LOCATOR_HASH" />
          <unique-column name="PAGE_ID" />
        </unique>
    </table>
    
    <table name="CLUBS">
        <column name="NAME" primaryKey='true' required="true" size="80" type="VARCHAR"/>
        <column name="COUNTRY" required="true" size="40" type="VARCHAR"/>
        <column name="CITY" required="true" size="40" type="VARCHAR"/>
        <column name="STADIUM" required="true" size="80" type="VARCHAR"/>
        <column name="CAPACITY" type='INTEGER'/>
        <column name="FOUNDED" type='INTEGER'/>        
        <column name="PITCH" size="40" type="VARCHAR"/>
        <column name="NICKNAME" size="40" type="VARCHAR"/>
    </table>  
    
</database>
