<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
 * MODX CMS and PHP Application Framework ("MODX")
 * Copyright 2006, 2007, 2008 by MODX, LLC.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */
 -->
<!-- The following xPDO model represents an object-relational map structure of MODX -->
<model package="modx" baseClass="xPDOObject" platform="sqlsrv" phpdoc-package="modx" phpdoc-subpackage="" version="1.1">
    <object class="modAccess" extends="xPDOSimpleObject">
        <field key="target" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="fk" />
        <field key="principal_class" dbtype="nvarchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
        <field key="principal" dbtype="int" phptype="integer" null="false" default="0" index="fk" />
        <field key="authority" dbtype="int" phptype="integer" null="false" default="9999" index="index" />
        <field key="policy" dbtype="int" phptype="integer" null="false" default="0" index="fk" />

        <index alias="target" name="target" primary="false" unique="false" type="BTREE">
            <column key="target" length="" collation="A" null="false" />
        </index>
        <index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE">
            <column key="principal_class" length="" collation="A" null="false" />
        </index>
        <index alias="principal" name="principal" primary="false" unique="false" type="BTREE">
            <column key="principal" length="" collation="A" null="false" />
        </index>
        <index alias="authority" name="authority" primary="false" unique="false" type="BTREE">
            <column key="authority" length="" collation="A" null="false" />
        </index>
        <index alias="policy" name="policy" primary="false" unique="false" type="BTREE">
            <column key="policy" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Policy" class="modAccessPolicy" local="policy" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Principal" class="modPrincipal" local="principal" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="GroupPrincipal" class="modUserGroup" local="principal" foreign="id" owner="foreign" cardinality="one">
            <criteria target="local"><![CDATA[
            {"principal_class":"modUserGroup"}
            ]]></criteria>
        </aggregate>
        <aggregate alias="UserPrincipal" class="modUserGroup" local="principal" foreign="id" owner="foreign" cardinality="one">
            <criteria target="local"><![CDATA[
            {"principal_class":"modUser"}
            ]]></criteria>
        </aggregate>
        <aggregate alias="MinimumRole" class="modUserGroupRole" local="authority" foreign="authority" owner="local" cardinality="one" />
    </object>

    <object class="modAccessAction" table="access_actions" extends="modAccess">
        <aggregate alias="Target" class="modAction" local="target" foreign="id" owner="foreign" cardinality="one" />
    </object>

    <object class="modAccessActionDom" table="access_actiondom" extends="modAccess">
        <aggregate alias="Target" class="modActionDom" local="target" foreign="id" owner="foreign" cardinality="one" />
    </object>

    <object class="modAccessCategory" table="access_category" extends="modAccess">
        <field key="context_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="fk" />

        <index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE">
            <column key="context_key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Target" class="modCategory" local="target" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Context" class="modContext" local="context_key" foreign="key" cardinality="one" owner="foreign" />
    </object>

    <object class="modAccessContext" table="access_context" extends="modAccess">
        <aggregate alias="Target" class="modContext" local="target" foreign="key" owner="foreign" cardinality="one" />
    </object>

    <object class="modAccessElement" table="access_elements" extends="modAccess">
        <field key="context_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="fk" />

        <index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE">
            <column key="context_key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Target" class="modElement" local="target" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Context" class="modContext" local="context_key" foreign="key" cardinality="one" owner="foreign" />
    </object>

    <object class="modAccessTemplateVar" table="access_templatevars" extends="modAccessElement">
        <aggregate alias="Target" class="modTemplateVar" local="target" foreign="id" owner="foreign" cardinality="one" />
    </object>

    <object class="modAccessibleObject" extends="xPDOObject" />

    <object class="modAccessibleSimpleObject" extends="modAccessibleObject">
        <field key="id" dbtype="int" phptype="integer" null="false" index="pk" generated="native" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="id" length="" collation="A" null="false" />
        </index>
    </object>

    <object class="modAccessMenu" table="access_menus" extends="modAccess">
        <aggregate alias="Target" class="modMenu" local="target" foreign="text" owner="foreign" cardinality="one" />
    </object>

    <object class="modAccessPolicy" table="access_policies" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" index="unique" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="parent" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="template" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="class" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="data" dbtype="nvarchar" precision="max" phptype="json" default="{}" />
        <field key="lexicon" dbtype="nvarchar" precision="255" phptype="string" null="false" default="permissions" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="parent" name="parent" primary="false" unique="false" type="BTREE">
            <column key="parent" length="" collation="A" null="false" />
        </index>
        <index alias="class" name="class" primary="false" unique="false" type="BTREE">
            <column key="class" length="" collation="A" null="false" />
        </index>
        <index alias="template" name="template" primary="false" unique="false" type="BTREE">
            <column key="template" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Parent" class="modAccessPolicy" local="parent" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Template" class="modAccessPolicyTemplate" local="template" foreign="id" owner="foreign" cardinality="one" />
        <composite alias="Children" class="modAccessPolicy" local="id" foreign="parent" owner="local" cardinality="many" />
    </object>

    <object class="modAccessPolicyTemplate" table="access_policy_templates" extends="xPDOSimpleObject">
        <field key="template_group" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="lexicon" dbtype="nvarchar" precision="255" phptype="string" null="false" default="permissions" />

        <aggregate alias="TemplateGroup" class="modAccessPolicyTemplateGroup" local="template_group" foreign="id" owner="foreign" cardinality="one" />
        <composite alias="Permissions" class="modAccessPermission" local="id" foreign="template" owner="local" cardinality="many" />
        <composite alias="Policies" class="modAccessPolicy" local="id" foreign="template" owner="local" cardinality="many" />
    </object>

    <object class="modAccessPolicyTemplateGroup" table="access_policy_template_groups" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />

        <composite alias="Templates" class="modAccessPolicyTemplate" local="id" foreign="template_group" owner="local" cardinality="many" />
    </object>

    <object class="modAccessPermission" table="access_permissions" extends="xPDOSimpleObject">
        <field key="template" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="value" dbtype="bit" phptype="boolean" null="false" default="1" />

        <index alias="template" name="template" primary="false" unique="false" type="BTREE">
            <column key="template" length="" collation="A" null="false" />
        </index>
        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Template" class="modAccessPolicyTemplate" local="template" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modAccessResource" table="access_resources" extends="modAccess">
        <field key="context_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="fk" />

        <index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE">
            <column key="context_key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Target" class="modResource" local="target" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Context" class="modContext" local="context_key" foreign="key" cardinality="one" owner="foreign" />
    </object>

    <object class="modAccessResourceGroup" table="access_resource_groups" extends="modAccess">
        <field key="context_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="fk" />

        <index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE">
            <column key="context_key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Target" class="modResourceGroup" local="target" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Context" class="modContext" local="context_key" foreign="key" cardinality="one" owner="foreign" />
    </object>

    <!-- deprecated 2.3, will be removed in 2.4/3.0 -->
    <object class="modAction" table="actions" extends="modAccessibleSimpleObject">
        <field key="namespace" dbtype="nvarchar" precision="100" phptype="string" null="false" default="core" index="index" />
        <field key="controller" dbtype="nvarchar" precision="255" phptype="string" null="false" index="index" />
        <field key="haslayout" dbtype="tinyint" precision="1" phptype="integer" null="false" default="1" />
        <field key="lang_topics" dbtype="nvarchar" precision="max" phptype="string" null="false" />
        <field key="assets" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="help_url" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />

        <index alias="namespace" name="namespace" primary="false" unique="false" type="BTREE">
            <column key="namespace" length="" collation="A" null="false" />
        </index>
        <index alias="controller" name="controller" primary="false" unique="false" type="BTREE">
            <column key="controller" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" owner="foreign" cardinality="one" />
        <composite alias="Menus" class="modMenu" local="id" foreign="action" owner="local" cardinality="many" />
        <composite alias="Acls" class="modAccessAction" local="id" foreign="target" owner="local" cardinality="many" />
        <composite alias="Fields" class="modActionField" local="id" foreign="action" owner="local" cardinality="many" />
        <composite alias="DOM" class="modActionDom" local="id" foreign="action" owner="local" cardinality="many" />
    </object>

    <object class="modActiveUser" table="active_users" extends="xPDOObject">
        <field key="internalKey" dbtype="int" precision="9" phptype="integer" null="false" default="0" index="pk" />
        <field key="username" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" />
        <field key="lasthit" dbtype="int" precision="20" phptype="timestamp" null="false" default="0" />
        <field key="id" dbtype="int" phptype="integer" null="true" />
        <field key="action" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="ip" dbtype="nvarchar" precision="20" phptype="string" null="false" default="" />

        <index alias="internalKey" name="internalKey" primary="true" unique="true" type="BTREE">
            <column key="internalKey" length="" collation="A" null="false" />
        </index>

        <aggregate alias="User" class="modUser" local="internalKey" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modCategory" table="categories" extends="modAccessibleSimpleObject">
        <field key="parent" dbtype="int" phptype="integer" default="0" index="unique" indexgrp="category" />
        <field key="category" dbtype="nvarchar" precision="45" phptype="string" null="false" default="" index="unique" indexgrp="category" />

        <index alias="parent" name="parent" primary="false" unique="false" type="BTREE">
            <column key="parent" length="" collation="A" null="false" />
        </index>
        <index alias="category" name="category" primary="false" unique="true" type="BTREE">
            <column key="parent" length="" collation="A" null="false" />
            <column key="category" length="" collation="A" null="false" />
        </index>

        <composite alias="Children" class="modCategory" local="id" foreign="parent" cardinality="many" owner="local" />
        <aggregate alias="Parent" class="modCategory" local="parent" foreign="id" cardinality="one" owner="foreign" />

        <aggregate alias="Chunks" class="modChunk" key="id" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="Snippets" class="modSnippet" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="Plugins" class="modPlugin" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="Templates" class="modTemplate" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="TemplateVars" class="modTemplateVar" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="PropertySets" class="modPropertySet" local="id" foreign="category" cardinality="many" owner="local" />
        <composite alias="Acls" class="modAccessCategory" local="id" foreign="target" owner="local" cardinality="many" />

        <composite alias="Ancestors" class="modCategoryClosure" local="id" foreign="ancestor" cardinality="many" owner="local" />
        <composite alias="Descendants" class="modCategoryClosure" local="id" foreign="descendant" cardinality="many" owner="local" />

        <!-- LEGACY RELATIONSHIPS : PLEASE USE ABOVE -->
        <aggregate alias="modChunk" class="modChunk" key="id" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="modSnippet" class="modSnippet" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="modPlugin" class="modPlugin" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="modTemplate" class="modTemplate" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="modTemplateVar" class="modTemplateVar" local="id" foreign="category" cardinality="many" owner="local" />
        <aggregate alias="modPropertySet" class="modPropertySet" local="id" foreign="category" cardinality="many" owner="local" />
        <!-- END LEGACY -->
        <validation>
            <rule field="category" name="preventBlank" type="xPDOValidationRule" rule="xPDOMinLengthValidationRule" value="1" message="category_err_ns_name" />
        </validation>
    </object>

    <object class="modCategoryClosure" table="categories_closure" extends="xPDOObject">
        <field key="ancestor" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="descendant" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="depth" dbtype="int" phptype="integer" null="false" default="0" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="ancestor" length="" collation="A" null="false" />
            <column key="descendant" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Ancestor" class="modCategory" local="ancestor" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Descendant" class="modCategory" local="descendant" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modChunk" table="site_htmlsnippets" extends="modElement">
        <field key="name" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="unique" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="Chunk" />
        <field key="editor_type" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="category" dbtype="int" phptype="integer" null="false" default="0" index="fk" />
        <field key="cache_type" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />
        <field key="snippet" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="locked" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="array" null="true" />
        <field key="static" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="static_file" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />

        <alias key="content" field="snippet" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="category" name="category" primary="false" unique="false" type="BTREE">
            <column key="category" length="" collation="A" null="false" />
        </index>
        <index alias="locked" name="locked" primary="false" unique="false" type="BTREE">
            <column key="locked" length="" collation="A" null="false" />
        </index>
        <index alias="static" name="static" primary="false" unique="false" type="BTREE">
            <column key="static" length="" collation="A" null="false" />
        </index>

        <composite alias="PropertySets" class="modElementPropertySet" local="id" foreign="element" owner="local" cardinality="many">
            <criteria target="foreign"><![CDATA[
            {"element_class":"modChunk"}
            ]]></criteria>
        </composite>
        <aggregate alias="Category" class="modCategory" key="id" local="category" foreign="id" cardinality="one" owner="foreign" />
        <validation>
            <rule field="name" name="invalid" type="preg_match" rule="/^(?!\s)[a-zA-Z0-9\x2d-\x2f\x7f-\xff-_\s]+(?!\s)$/" message="chunk_err_invalid_name" />
        </validation>
    </object>

    <object class="modClassMap" table="class_map" extends="xPDOSimpleObject">
        <field key="class" dbtype="nvarchar" precision="120" phptype="string" null="false" default="" index="unique" />
        <field key="parent_class" dbtype="nvarchar" precision="120" phptype="string" null="false" default="" index="index" />
        <field key="name_field" dbtype="nvarchar" precision="255" phptype="string" null="false" default="name" index="index" />
        <field key="path" dbtype="nvarchar" precision="512" phptype="string" default="" />
        <field key="lexicon" dbtype="nvarchar" precision="255" phptype="string" null="false" default="core:resource" />

        <index alias="class" name="class" primary="false" unique="true" type="BTREE">
            <column key="class" length="" collation="A" null="false" />
        </index>
        <index alias="parent_class" name="parent_class" primary="false" unique="false" type="BTREE">
            <column key="parent_class" length="" collation="A" null="false" />
        </index>
        <index alias="name_field" name="name_field" primary="false" unique="false" type="BTREE">
            <column key="name_field" length="" collation="A" null="false" />
        </index>
    </object>

    <object class="modContentType" table="content_type" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" index="unique" />
        <field key="description" dbtype="nvarchar" precision="512" phptype="string" null="true" />
        <field key="mime_type" dbtype="nvarchar" precision="512" phptype="string" />
        <field key="file_extensions" dbtype="nvarchar" precision="512" phptype="string" />
        <field key="headers" dbtype="nvarchar" precision="max" phptype="array" />
        <field key="binary" dbtype="bit" phptype="boolean" null="false" default="0" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Resources" class="modResource" local="id" foreign="content_type" owner="local" cardinality="many" />
        <validation>
            <rule field="name" name="name" type="xPDOValidationRule" rule="xPDOMinLengthValidationRule" value="1" message="content_type_err_ns_name" />
        </validation>
    </object>

    <object class="modContext" table="context" extends="modAccessibleObject">
        <field key="key" dbtype="nvarchar" precision="100" phptype="string" null="false" index="pk" />
        <field key="name" dbtype="varchar" precision="255" phptype="string" index="index" />
        <field key="description" dbtype="nvarchar" precision="512" phptype="string" />
        <field key="rank" dbtype="int" precision="11" phptype="integer" null="false" default="0" index="index" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="key" length="" collation="A" null="false" />
        </index>
        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>

        <composite alias="ContextResources" class="modContextResource" local="key" foreign="context_key" cardinality="many" owner="local" />
        <composite alias="ContextSettings" class="modContextSetting" local="key" foreign="context_key" cardinality="many" owner="local" />
        <composite alias="Acls" class="modAccessContext" local="key" foreign="target" owner="local" cardinality="many" />
        <validation>
            <rule field="key" name="key" type="preg_match" rule="/^[a-zA-Z\x7f-\xff][a-zA-Z0-9\x2d-\x2f\x7f-\xff]*$/" message="context_err_ns_key" />
        </validation>
    </object>

    <object class="modContextSetting" table="context_setting" extends="xPDOObject">
        <field key="context_key" dbtype="nvarchar" precision="255" phptype="string" null="false" index="pk" />
        <field key="key" dbtype="nvarchar" precision="50" phptype="string" null="false" index="pk" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="xtype" dbtype="nvarchar" precision="75" phptype="string" null="false" default="textfield" />
        <field key="namespace" dbtype="nvarchar" precision="40" phptype="string" null="false" default="core" />
        <field key="area" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="editedon" dbtype="datetime" phptype="timestamp" null="true" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="context_key" collation="A" null="false" />
            <column key="key" collation="A" null="false" />
        </index>

        <aggregate alias="Context" class="modContext" key="context_key" local="context_key" foreign="key" cardinality="one" owner="foreign" />
        <aggregate alias="SystemSetting" class="modSystemSetting" key="key" local="key" foreign="key" cardinality="one" owner="foreign" />
    </object>

    <object class="modContextResource" table="context_resource" extends="xPDOObject">
        <field key="context_key" dbtype="nvarchar" precision="255" phptype="string" null="false" index="pk" />
        <field key="resource" dbtype="int" phptype="integer" null="false" index="pk" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="context_key" collation="A" null="false" />
            <column key="resource" collation="A" null="false" />
        </index>

        <aggregate alias="Context" class="modContext" local="context_key" foreign="key" cardinality="one" owner="foreign" />
        <aggregate alias="Resource" class="modResource" local="resource" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <!-- A dashboard that shows on the loading screen for a user -->
    <object class="modDashboard" table="dashboard" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="hide_trees" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />

        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="hide_trees" name="hide_trees" primary="false" unique="false" type="BTREE">
            <column key="hide_trees" length="" collation="A" null="false" />
        </index>

        <aggregate alias="UserGroups" class="modUserGroup" local="id" foreign="dashboard" cardinality="many" owner="local" />
        <composite alias="Placements" class="modDashboardWidgetPlacement" local="id" foreign="dashboard" cardinality="many" owner="local" />
    </object>

    <!-- Widgets that can be placed on dashboards. Can be files, html, or a snippet -->
    <object class="modDashboardWidget" table="dashboard_widget" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="type" dbtype="nvarchar" precision="100" phptype="string" null="false" index="index" /><!-- file/chunk/snippet -->
        <field key="content" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="namespace" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="lexicon" dbtype="nvarchar" precision="255" phptype="string" null="false" default="core:dashboards" index="index" />
        <field key="size" dbtype="nvarchar" precision="255" phptype="string" null="false" default="half" />

        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="type" name="type" primary="false" unique="false" type="BTREE">
            <column key="type" length="" collation="A" null="false" />
        </index>
        <index alias="namespace" name="namespace" primary="false" unique="false" type="BTREE">
            <column key="namespace" length="" collation="A" null="false" />
        </index>
        <index alias="lexicon" name="lexicon" primary="false" unique="false" type="BTREE">
            <column key="lexicon" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" cardinality="one" owner="foreign" />
        <composite alias="Placements" class="modDashboardWidgetPlacement" local="id" foreign="widget" cardinality="many" owner="local" />
    </object>

    <!-- Placements of widgets on a dashboard -->
    <object class="modDashboardWidgetPlacement" table="dashboard_widget_placement" extends="xPDOObject">
        <field key="dashboard" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="widget" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" index="index" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="dashboard" collation="A" null="false" />
            <column key="widget" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Dashboard" class="modDashboard" local="dashboard" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Widget" class="modDashboardWidget" local="widget" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modDocument" extends="modResource" />

    <object class="modElement" table="site_element" extends="modAccessibleSimpleObject">
        <field key="source" dbtype="int" phptype="integer" null="false" default="0" index="fk" />
        <field key="property_preprocess" dbtype="bit" phptype="boolean" null="false" default="0" />

        <composite alias="Acls" class="modAccessElement" local="id" foreign="target" owner="local" cardinality="many" />
        <aggregate alias="CategoryAcls" class="modAccessCategory" local="category" foreign="target" owner="local" cardinality="many" />
        <aggregate alias="Source" class="sources.modMediaSource" local="source" foreign="id" owner="foreign" cardinality="one" />
    </object>

    <object class="modElementPropertySet" table="element_property_sets" extends="xPDOObject">
        <field key="element" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="element_class" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="pk" />
        <field key="property_set" dbtype="int" phptype="integer" null="false" default="0" index="pk" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="element" collation="A" null="false" />
            <column key="element_class" collation="A" null="false" />
            <column key="property_set" collation="A" null="false" />
        </index>

        <aggregate alias="Element" class="modElement" local="element" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="PropertySet" class="modPropertySet" local="property_set" foreign="id" owner="foreign" cardinality="one" />
    </object>

    <object class="modEvent" table="system_eventnames" extends="xPDOObject">
        <field key="name" dbtype="nvarchar" precision="50" phptype="string" null="false" index="pk" />
        <field key="service" dbtype="tinyint" precision="4" phptype="integer" null="false" default="0" />
        <field key="groupname" dbtype="nvarchar" precision="20" phptype="string" null="false" default="" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>

        <aggregate alias="PluginEvents" class="modPluginEvent" local="name" foreign="event" cardinality="many" owner="local" />
    </object>

    <object class="modActionDom" table="actiondom" extends="modAccessibleSimpleObject">
        <field key="set" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="action" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="xtype" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" /><!-- deprecated -->
        <field key="container" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="rule" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="constraint" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" /><!-- deprecated -->
        <field key="constraint_field" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" /><!-- deprecated -->
        <field key="constraint_class" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" /><!-- deprecated -->
        <field key="active" dbtype="bit" phptype="boolean" null="false" default="1" index="index" /><!-- deprecated -->
        <field key="for_parent" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" index="index" />

        <index alias="set" name="set" primary="false" unique="false" type="BTREE">
            <column key="set" length="" collation="A" null="false" />
        </index>
        <index alias="action" name="action" primary="false" unique="false" type="BTREE">
            <column key="action" length="" collation="A" null="false" />
        </index>
        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="active" name="active" primary="false" unique="false" type="BTREE">
            <column key="active" length="" collation="A" null="false" />
        </index>
        <index alias="for_parent" name="for_parent" primary="false" unique="false" type="BTREE">
            <column key="for_parent" length="" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>

        <aggregate alias="FCSet" class="modFormCustomizationSet" local="set" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Action" class="modAction" local="action" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="Access" class="modAccessActionDom" local="id" foreign="target" cardinality="many" owner="local" />
    </object>

    <object class="modFormCustomizationProfileUserGroup" table="fc_profiles_usergroups" extends="xPDOObject">
        <field key="usergroup" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="profile" dbtype="int" phptype="integer" null="false" default="0" index="pk" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="usergroup" length="" collation="A" null="false" />
            <column key="profile" length="" collation="A" null="false" />
        </index>

        <aggregate alias="UserGroup" class="modUserGroup" local="usergroup" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Profile" class="modFormCustomizationProfile" local="profile" foreign="id" cardinality="one" owner="foreign" />
    </object>
    <object class="modFormCustomizationProfile" table="fc_profiles" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="active" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" index="index" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" index="index" />

        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>
        <index alias="active" name="active" primary="false" unique="false" type="BTREE">
            <column key="active" length="" collation="A" null="false" />
        </index>

        <composite alias="Sets" class="modFormCustomizationSet" local="id" foreign="profile" cardinality="many" owner="local" />
        <composite alias="UserGroups" class="modFormCustomizationProfileUserGroup" local="id" foreign="profile" cardinality="many" owner="local" />
    </object>

    <object class="modFormCustomizationSet" table="fc_sets" extends="xPDOSimpleObject">
        <field key="profile" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="action" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="active" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" index="index" />
        <field key="template" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="constraint" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="constraint_field" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="constraint_class" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />

        <index alias="profile" name="profile" primary="false" unique="false" type="BTREE">
            <column key="profile" length="" collation="A" null="false" />
        </index>
        <index alias="action" name="action" primary="false" unique="false" type="BTREE">
            <column key="action" length="" collation="A" null="false" />
        </index>
        <index alias="active" name="active" primary="false" unique="false" type="BTREE">
            <column key="active" length="" collation="A" null="false" />
        </index>
        <index alias="template" name="template" primary="false" unique="false" type="BTREE">
            <column key="template" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Action" class="modAction" local="action" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Template" class="modTemplate" local="template" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Profile" class="modFormCustomizationProfile" local="profile" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="Rules" class="modActionDom" local="id" foreign="set" cardinality="many" owner="local" />
    </object>

    <object class="modActionField" table="actions_fields" extends="xPDOSimpleObject">
        <field key="action" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" /> <!-- name/id of field -->
        <field key="type" dbtype="nvarchar" precision="100" phptype="string" null="false" default="field" index="index" /> <!-- either field/tab -->
        <field key="tab" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" /> <!-- for fields, what tab they are on -->
        <field key="form" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" /> <!-- the form ID (for dom sel purposes) -->
        <field key="other" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" /> <!-- used on tabs to delineate TV tabs -->
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" />

        <index alias="action" name="action" primary="false" unique="false" type="BTREE">
            <column key="action" length="" collation="A" null="false" />
        </index>
        <index alias="type" name="type" primary="false" unique="false" type="BTREE">
            <column key="type" length="" collation="A" null="false" />
        </index>
        <index alias="tab" name="tab" primary="false" unique="false" type="BTREE">
            <column key="tab" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Action" class="modAction" local="action" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modJSONRPCResource" extends="modXMLRPCResource" />

    <object class="modLexiconEntry" table="lexicon_entries" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="topic" dbtype="nvarchar" precision="255" phptype="string" null="false" default="default" index="index" />
        <field key="namespace" dbtype="nvarchar" precision="40" phptype="string" null="false" default="core" index="index" />
        <field key="language" dbtype="nvarchar" precision="20" phptype="string" null="false" default="en" index="index" />
        <field key="createdon" dbtype="datetime" phptype="datetime" />
        <field key="editedon" dbtype="datetime" phptype="timestamp" null="true" />

        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="topic" name="topic" primary="false" unique="false" type="BTREE">
            <column key="topic" length="" collation="A" null="false" />
        </index>
        <index alias="namespace" name="namespace" primary="false" unique="false" type="BTREE">
            <column key="namespace" length="" collation="A" null="false" />
        </index>
        <index alias="language" name="language" primary="false" unique="false" type="BTREE">
            <column key="language" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" cardinality="one" owner="foreign" />
    </object>

    <object class="modManagerLog" table="manager_log" extends="xPDOSimpleObject">
        <field key="user" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="occurred" dbtype="datetime" phptype="datetime" null="true" default="0000-00-00 00:00:00" />
        <field key="action" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="classKey" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="item" dbtype="nvarchar" precision="255" phptype="string" null="false" default="0" />

        <aggregate alias="User" class="modUser" local="user" foreign="id" owner="foreign" cardinality="one" />
    </object>

    <object class="modMenu" table="menus" extends="modAccessibleObject">
        <field key="text" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="pk" />
        <field key="parent" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="action" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="icon" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="menuindex" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="params" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="handler" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="permissions" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="namespace" dbtype="nvarchar" precision="100" phptype="string" null="false" default="core" index="index" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="text" length="" collation="A" null="false" />
        </index>
        <index alias="parent" name="parent" primary="false" unique="false" type="BTREE">
            <column key="parent" length="" collation="A" null="false" />
        </index>
        <index alias="action" name="action" primary="false" unique="false" type="BTREE">
            <column key="action" length="" collation="A" null="false" />
        </index>
        <index alias="namespace" name="namespace" primary="false" unique="false" type="BTREE">
            <column key="namespace" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Action" class="modAction" local="action" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Parent" class="modMenu" local="parent" foreign="text" owner="foreign" cardinality="one" />
        <aggregate alias="Children" class="modMenu" local="text" foreign="parent" owner="local" cardinality="many" />
        <composite alias="Acls" class="modAccessMenu" local="text" foreign="target" owner="local" cardinality="many" />
    </object>

    <object class="modNamespace" table="namespaces" extends="xPDOObject">
        <field key="name" dbtype="nvarchar" precision="40" phptype="string" null="false" default="" index="pk" />
        <field key="path" dbtype="nvarchar" precision="max" phptype="string" default="" />
        <field key="assets_path" dbtype="nvarchar" precision="max" phptype="string" default="" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>

        <composite alias="LexiconEntries" class="modLexiconEntry" local="name" foreign="namespace" cardinality="many" owner="local" />
        <composite alias="SystemSettings" class="modSystemSetting" local="name" foreign="namespace" cardinality="many" owner="local" />
        <composite alias="ContextSettings" class="modContextSetting" local="name" foreign="namespace" cardinality="many" owner="local" />
        <composite alias="UserSettings" class="modUserSetting" local="name" foreign="namespace" cardinality="many" owner="local" />
        <composite alias="Actions" class="modAction" local="name" foreign="namespace" cardinality="many" owner="local" />
    </object>

    <!--
        Extension packages load xPDO models during modX instantiation, allowing for custom database tables and other
        models to be loaded prior to modX request handling. Useful for when you want to integrate custom data and
        extensions, such as Custom Resource Classes, into the core.
    -->
    <object class="modExtensionPackage" table="extension_packages" extends="xPDOObject">
        <!-- The namespace the extension package relates to -->
        <field key="namespace" dbtype="nvarchar" precision="40" phptype="string" null="false" default="core" index="index" />
        <!-- If empty, will assume the Namespace path -->
        <field key="path" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <!-- If empty, will assume no table prefix and delegate to package schema -->
        <field key="table_prefix" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <!-- If specified, will create an instance of the class with this name using modX.getService on the loading of this extension package -->
        <field key="service_class" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <!-- The name to give the service on the modX object when instantiating. Only valid if service_class is not empty. -->
        <field key="service_name" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />

        <index alias="namespace" name="namespace" primary="false" unique="false" type="BTREE">
            <column key="namespace" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" cardinality="one" owner="foreign" />
    </object>

    <object class="modPlugin" table="site_plugins" extends="modScript">
        <field key="cache_type" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />
        <field key="plugincode" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="locked" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="array" null="true" />
        <field key="disabled" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="moduleguid" dbtype="nvarchar" precision="32" phptype="string" null="false" default="" index="fk" />
        <field key="static" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="static_file" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />

        <alias key="content" field="plugincode" />

        <index alias="locked" name="locked" primary="false" unique="false" type="BTREE">
            <column key="locked" length="" collation="A" null="false" />
        </index>
        <index alias="disabled" name="disabled" primary="false" unique="false" type="BTREE">
            <column key="disabled" length="" collation="A" null="false" />
        </index>

        <composite alias="PropertySets" class="modElementPropertySet" local="id" foreign="element" owner="local" cardinality="many">
            <criteria target="foreign"><![CDATA[
            {"element_class":"modPlugin"}
            ]]></criteria>
        </composite>
        <composite alias="PluginEvents" class="modPluginEvent" local="id" foreign="pluginid" cardinality="many" owner="local" />
        <validation>
            <rule field="name" name="invalid" type="preg_match" rule="/^(?!\s)[a-zA-Z0-9_-\x7f-\xff\s]+(?!\s)$/" message="plugin_err_invalid_name" />
        </validation>
    </object>

    <object class="modPluginEvent" table="site_plugin_events" extends="xPDOObject">
        <field key="pluginid" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="event" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="pk" />
        <field key="priority" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="propertyset" dbtype="int" phptype="integer" null="false" default="0" index="index" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="pluginid" length="" collation="A" null="false" />
            <column key="event" length="" collation="A" null="false" />
        </index>
        <index alias="priority" name="priority" primary="false" unique="false" type="BTREE">
            <column key="priority" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Plugin" class="modPlugin" local="pluginid" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Event" class="modEvent" local="event" foreign="name" cardinality="one" owner="foreign" />
        <aggregate alias="PropertySet" class="modPropertySet" local="propertyset" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modPrincipal" extends="xPDOSimpleObject">
        <composite alias="Acls" class="modAccess" local="id" foreign="principal" cardinality="many" owner="local" />
    </object>

    <object class="modPropertySet" table="property_set" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="unique" />
        <field key="category" dbtype="int" phptype="integer" null="false" default="0" index="fk" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="array" null="true" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="category" name="category" primary="false" unique="false" type="BTREE">
            <column key="category" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Category" class="modCategory" key="id" local="category" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="Elements" class="modElementPropertySet" local="id" foreign="property_set" cardinality="many" owner="local" />
    </object>

    <object class="modResource" table="site_content" extends="modAccessibleSimpleObject" inherit="single">
        <field key="type" dbtype="nvarchar" precision="20" phptype="string" null="false" default="document" />
        <field key="contentType" dbtype="nvarchar" precision="50" phptype="string" null="false" default="text/html" />
        <field key="pagetitle" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="fulltext" indexgrp="content_ft_idx" />
        <field key="longtitle" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="fulltext" indexgrp="content_ft_idx" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="fulltext" indexgrp="content_ft_idx" />
        <field key="alias" dbtype="nvarchar" precision="255" phptype="string" null="true" default="" index="index" />
        <field key="link_attributes" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="published" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="pub_date" dbtype="bigint" phptype="timestamp" null="false" default="0" index="index" />
        <field key="unpub_date" dbtype="bigint" phptype="timestamp" null="false" default="0" index="index" />
        <field key="parent" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="isfolder" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="introtext" dbtype="nvarchar" precision="max" phptype="string" index="fulltext" indexgrp="content_ft_idx" />
        <field key="content" dbtype="nvarchar" precision="max" phptype="string" index="fulltext" indexgrp="content_ft_idx" />
        <field key="richtext" dbtype="bit" phptype="boolean" null="false" default="1" />
        <field key="template" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="menuindex" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="searchable" dbtype="bit" phptype="boolean" null="false" default="1" index="index" />
        <field key="cacheable" dbtype="bit" phptype="boolean" null="false" default="1" index="index" />
        <field key="createdby" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="createdon" dbtype="bigint" phptype="timestamp" null="false" default="0" />
        <field key="editedby" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="editedon" dbtype="bigint" phptype="timestamp" null="false" default="0" />
        <field key="deleted" dbtype="bit" phptype="boolean" null="false" default="0" />
        <field key="deletedon" dbtype="bigint" phptype="timestamp" null="false" default="0" />
        <field key="deletedby" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="publishedon" dbtype="bigint" phptype="timestamp" null="false" default="0" />
        <field key="publishedby" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="menutitle" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="donthit" dbtype="bit" phptype="boolean" null="false" default="0" />
        <field key="privateweb" dbtype="bit" phptype="boolean" null="false" default="0" />
        <field key="privatemgr" dbtype="bit" phptype="boolean" null="false" default="0" />
        <field key="content_dispo" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />
        <field key="hidemenu" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="class_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="modDocument" index="index" />
        <field key="context_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="web" index="index" />
        <field key="content_type" dbtype="int" phptype="integer" null="false" default="1" />
        <field key="uri" dbtype="nvarchar" precision="1000" phptype="string" null="false" default="" index="index" />
        <field key="uri_override" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="hide_children_in_tree" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="show_in_tree" dbtype="bit" phptype="boolean" null="false" default="1" index="index" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="json" null="true" />

        <index alias="alias" name="alias" primary="false" unique="false" type="BTREE">
            <column key="alias" length="" collation="A" null="true" />
        </index>
        <index alias="published" name="published" primary="false" unique="false" type="BTREE">
            <column key="published" length="" collation="A" null="false" />
        </index>
        <index alias="pub_date" name="pub_date" primary="false" unique="false" type="BTREE">
            <column key="pub_date" length="" collation="A" null="false" />
        </index>
        <index alias="unpub_date" name="unpub_date" primary="false" unique="false" type="BTREE">
            <column key="unpub_date" length="" collation="A" null="false" />
        </index>
        <index alias="parent" name="parent" primary="false" unique="false" type="BTREE">
            <column key="parent" length="" collation="A" null="false" />
        </index>
        <index alias="isfolder" name="isfolder" primary="false" unique="false" type="BTREE">
            <column key="isfolder" length="" collation="A" null="false" />
        </index>
        <index alias="template" name="template" primary="false" unique="false" type="BTREE">
            <column key="template" length="" collation="A" null="false" />
        </index>
        <index alias="menuindex" name="menuindex" primary="false" unique="false" type="BTREE">
            <column key="menuindex" length="" collation="A" null="false" />
        </index>
        <index alias="searchable" name="searchable" primary="false" unique="false" type="BTREE">
            <column key="searchable" length="" collation="A" null="false" />
        </index>
        <index alias="cacheable" name="cacheable" primary="false" unique="false" type="BTREE">
            <column key="cacheable" length="" collation="A" null="false" />
        </index>
        <index alias="hidemenu" name="hidemenu" primary="false" unique="false" type="BTREE">
            <column key="hidemenu" length="" collation="A" null="false" />
        </index>
        <index alias="class_key" name="class_key" primary="false" unique="false" type="BTREE">
            <column key="class_key" length="" collation="A" null="false" />
        </index>
        <index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE">
            <column key="context_key" length="" collation="A" null="false" />
        </index>
        <index alias="uri" name="uri" primary="false" unique="false" type="BTREE">
            <column key="uri" length="1000" collation="A" null="false" />
        </index>
        <index alias="uri_override" name="uri_override" primary="false" unique="false" type="BTREE">
            <column key="uri_override" length="" collation="A" null="false" />
        </index>
        <index alias="hide_children_in_tree" name="hide_children_in_tree" primary="false" unique="false" type="BTREE">
            <column key="hide_children_in_tree" length="" collation="A" null="false" />
        </index>
        <index alias="show_in_tree" name="show_in_tree" primary="false" unique="false" type="BTREE">
            <column key="show_in_tree" length="" collation="A" null="false" />
        </index>
        <index alias="content_ft_idx" name="content_ft_idx" primary="false" unique="false" type="FULLTEXT">
            <column key="pagetitle" length="" collation="A" null="false" />
            <column key="longtitle" length="" collation="A" null="false" />
            <column key="description" length="" collation="A" null="false" />
            <column key="introtext" length="" collation="A" null="true" />
            <column key="content" length="" collation="A" null="true" />
        </index>

        <aggregate alias="Parent" class="modResource" local="parent" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Children" class="modResource" local="id" foreign="parent" cardinality="many" owner="local" />
        <aggregate alias="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="DeletedBy" class="modUser" local="deletedby" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="PublishedBy" class="modUser" local="publishedby" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Template" class="modTemplate" local="template" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="TemplateVars" class="modTemplateVar" local="id:template" foreign="contentid:templateid" cardinality="many" owner="local" />
        <aggregate alias="TemplateVarTemplates" class="modTemplateVarTemplate" local="template" foreign="templateid" cardinality="many" owner="local" />
        <aggregate alias="ContentType" class="modContentType" local="content_type" foreign="id" owner="foreign" cardinality="one" />
        <aggregate alias="Context" class="modContext" local="context_key" foreign="key" owner="foreign" cardinality="one" />
        <composite alias="TemplateVarResources" class="modTemplateVarResource" local="id" foreign="contentid" cardinality="many" owner="local" />
        <composite alias="ResourceGroupResources" class="modResourceGroupResource" local="id" foreign="document" cardinality="many" owner="local" />
        <composite alias="Acls" class="modAccessResource" local="id" foreign="target" owner="local" cardinality="many" />
        <composite alias="ContextResources" class="modContextResource" local="id" foreign="resource" cardinality="many" owner="local" />
    </object>

    <object class="modResourceGroup" table="documentgroup_names" extends="modAccessibleSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="unique" />
        <field key="private_memgroup" dbtype="bit" phptype="boolean" null="false" default="0" />
        <field key="private_webgroup" dbtype="bit" phptype="boolean" null="false" default="0" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>

        <composite alias="ResourceGroupResources" class="modResourceGroupResource" local="id" foreign="document_group" cardinality="many" owner="local" />
        <composite alias="TemplateVarResourceGroups" class="modTemplateVarResourceGroup" local="id" foreign="documentgroup" cardinality="many" owner="local" />
        <composite alias="Acls" class="modAccessResourceGroup" local="id" foreign="target" owner="local" cardinality="many" />
    </object>

    <object class="modResourceGroupResource" table="document_groups" extends="xPDOSimpleObject">
        <field key="document_group" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="document" dbtype="int" phptype="integer" null="false" default="0" index="index" />

        <index alias="document_group" name="document_group" primary="false" unique="false" type="BTREE">
            <column key="document_group" length="" collation="A" null="false" />
        </index>
        <index alias="document" name="document" primary="false" unique="false" type="BTREE">
            <column key="document" length="" collation="A" null="false" />
        </index>

        <aggregate alias="ResourceGroup" class="modResourceGroup" key="id" local="document_group" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Resource" class="modResource" key="id" local="document" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modScript" table="site_script" extends="modElement">
        <field key="name" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="unique" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="editor_type" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="category" dbtype="int" phptype="integer" null="false" default="0" index="fk" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="category" name="category" primary="false" unique="false" type="BTREE">
            <column key="category" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Category" class="modCategory" key="id" local="category" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modSession" table="session" extends="xPDOObject">
        <field key="id" dbtype="nvarchar" precision="255" phptype="string" null="false" index="pk" default="" />
        <field key="access" dbtype="bigint" phptype="timestamp" null="false" />
        <field key="data" dbtype="nvarchar" precision="max" phptype="string" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="id" length="" collation="A" null="false" />
        </index>
        <index alias="access" name="access" primary="false" unique="false" type="BTREE">
            <column key="access" length="" collation="A" null="false" />
        </index>

        <validation>
            <rule field="id" name="invalid" type="preg_match" rule="/^[0-9a-zA-Z,-]{22,255}$/" message="session_err_invalid_id" />
        </validation>
    </object>

    <object class="modSnippet" table="site_snippets" extends="modScript">
        <field key="cache_type" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />
        <field key="snippet" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="locked" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="array" null="true" />
        <field key="moduleguid" dbtype="nvarchar" precision="32" phptype="string" null="false" default="" index="fk" />
        <field key="static" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="static_file" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />

        <alias key="content" field="snippet" />

        <index alias="locked" name="locked" primary="false" unique="false" type="BTREE">
            <column key="locked" length="" collation="A" null="false" />
        </index>
        <index alias="moduleguid" name="moduleguid" primary="false" unique="false" type="BTREE">
            <column key="moduleguid" length="" collation="A" null="false" />
        </index>

        <composite alias="PropertySets" class="modElementPropertySet" local="id" foreign="element" owner="local" cardinality="many">
            <criteria target="foreign"><![CDATA[
            {"element_class":"modSnippet"}
            ]]></criteria>
        </composite>
        <validation>
            <rule field="name" name="invalid" type="preg_match" rule="/^(?!\s)[a-zA-Z0-9\x2d-\x2f\x7f-\xff-_\s]+(?!\s)$/" message="snippet_err_invalid_name" />
        </validation>
    </object>

    <object class="modStaticResource" extends="modResource" />

    <object class="modSymLink" extends="modResource" />

    <object class="modSystemSetting" table="system_settings" extends="xPDOObject">
        <field key="key" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="pk" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="xtype" dbtype="nvarchar" precision="75" phptype="string" null="false" default="textfield" />
        <field key="namespace" dbtype="nvarchar" precision="40" phptype="string" null="false" default="core" />
        <field key="area" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="editedon" dbtype="datetime" phptype="timestamp" null="true" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="ContextSetting" class="modContextSetting" local="key" foreign="key" cardinality="one" owner="local" />
        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" cardinality="one" owner="foreign" />
    </object>

    <object class="modTemplate" table="site_templates" extends="modElement">
        <field key="templatename" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="unique" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="Template" />
        <field key="editor_type" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="category" dbtype="int" phptype="integer" null="false" default="0" index="fk" />
        <field key="icon" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="template_type" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="content" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="locked" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="array" null="true" />
        <field key="static" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="static_file" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />

        <index alias="templatename" name="templatename" primary="false" unique="true" type="BTREE">
            <column key="templatename" length="" collation="A" null="false" />
        </index>
        <index alias="category" name="category" primary="false" unique="false" type="BTREE">
            <column key="category" length="" collation="A" null="false" />
        </index>
        <index alias="locked" name="locked" primary="false" unique="false" type="BTREE">
            <column key="locked" length="" collation="A" null="false" />
        </index>
        <index alias="static" name="static" primary="false" unique="false" type="BTREE">
            <column key="static" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Category" class="modCategory" local="category" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Resources" class="modResource" local="id" foreign="template" cardinality="many" owner="local" />
        <composite alias="PropertySets" class="modElementPropertySet" local="id" foreign="element" owner="local" cardinality="many">
            <criteria target="foreign"><![CDATA[
            {"element_class":"modTemplate"}
            ]]></criteria>
        </composite>
        <composite alias="TemplateVarTemplates" class="modTemplateVarTemplate" local="id" foreign="templateid" cardinality="many" owner="local" />
    </object>

    <object class="modTemplateVar" table="site_tmplvars" extends="modElement">
        <field key="type" dbtype="nvarchar" precision="20" phptype="string" null="false" default="" />
        <field key="name" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="unique" />
        <field key="caption" dbtype="nvarchar" precision="80" phptype="string" null="false" default="" />
        <field key="description" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="editor_type" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="category" dbtype="int" phptype="integer" null="false" default="0" index="fk" />
        <field key="locked" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="elements" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="display" dbtype="nvarchar" precision="20" phptype="string" null="false" default="" />
        <field key="default_text" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="properties" dbtype="nvarchar" precision="max" phptype="array" null="true" />
        <field key="input_properties" dbtype="nvarchar" precision="max" phptype="array" null="false" default="" />
        <field key="output_properties" dbtype="nvarchar" precision="max" phptype="array" null="false" default="" />
        <field key="static" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="static_file" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />

        <alias key="content" field="default_text" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="category" name="category" primary="false" unique="false" type="BTREE">
            <column key="category" length="" collation="A" null="false" />
        </index>
        <index alias="locked" name="locked" primary="false" unique="false" type="BTREE">
            <column key="locked" length="" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>
        <index alias="static" name="static" primary="false" unique="false" type="BTREE">
            <column key="static" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Category" class="modCategory" local="category" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="PropertySets" class="modElementPropertySet" local="id" foreign="element" owner="local" cardinality="many">
            <criteria target="foreign"><![CDATA[
            {"element_class":"modTemplateVar"}
            ]]></criteria>
        </composite>
        <composite alias="TemplateVarTemplates" class="modTemplateVarTemplate" local="id" foreign="tmplvarid" cardinality="many" owner="local" />
        <composite alias="TemplateVarResources" class="modTemplateVarResource" local="id" foreign="tmplvarid" cardinality="many" owner="local" />
        <composite alias="TemplateVarResourceGroups" class="modTemplateVarResourceGroup" local="id" foreign="tmplvarid" cardinality="many" owner="local" />
        <validation>
            <rule field="name" name="invalid" type="preg_match" rule="/^(?!\s)[a-zA-Z0-9\x2d-\x2f\x7f-\xff-_\s]+(?!\s)$/" message="tv_err_invalid_name" />
            <rule field="name" name="reserved" type="preg_match" rule="/^(?!(id|type|contentType|pagetitle|longtitle|description|alias|link_attributes|published|pub_date|unpub_date|parent|isfolder|introtext|content|richtext|template|menuindex|searchable|cacheable|createdby|createdon|editedby|editedon|deleted|deletedby|deletedon|publishedon|publishedby|menutitle|donthit|privateweb|privatemgr|content_dispo|hidemenu|class_key|context_key|content_type|uri|uri_override|hide_children_in_tree|show_in_tree)$)/" message="tv_err_reserved_name" />
        </validation>
    </object>

    <object class="modTemplateVarResource" table="site_tmplvar_contentvalues" extends="xPDOSimpleObject">
        <field key="tmplvarid" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="contentid" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" null="false" />

        <index alias="tmplvarid" name="tmplvarid" primary="false" unique="false" type="BTREE">
            <column key="tmplvarid" length="" collation="A" null="false" />
        </index>
        <index alias="contentid" name="contentid" primary="false" unique="false" type="BTREE">
            <column key="contentid" length="" collation="A" null="false" />
        </index>
        <index alias="tv_cnt" name="tv_cnt" primary="false" unique="false" type="BTREE">
            <column key="tmplvarid" length="" collation="A" null="false" />
            <column key="contentid" length="" collation="A" null="false" />
        </index>

        <aggregate alias="TemplateVar" class="modTemplateVar" local="tmplvarid" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Resource" class="modResource" local="contentid" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modTemplateVarResourceGroup" table="site_tmplvar_access" extends="xPDOSimpleObject">
        <field key="tmplvarid" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="documentgroup" dbtype="int" phptype="integer" null="false" default="0" />

        <aggregate alias="TemplateVar" class="modTemplateVar" local="tmplvarid" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="ResourceGroup" class="modResourceGroup" local="documentgroup" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modTemplateVarTemplate" table="site_tmplvar_templates" extends="xPDOObject">
        <field key="tmplvarid" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="templateid" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="tmplvarid" length="" collation="A" null="false" />
            <column key="templateid" length="" collation="A" null="false" />
        </index>

        <aggregate alias="TemplateVar" class="modTemplateVar" key="id" local="tmplvarid" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Template" class="modTemplate" key="id" local="templateid" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modUser" table="users" extends="modPrincipal">
        <field key="username" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" index="unique" />
        <field key="password" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="cachepwd" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="class_key" dbtype="nvarchar" precision="100" phptype="string" null="false" default="modUser" index="index" />
        <field key="active" dbtype="bit" phptype="boolean" null="false" default="1" />
        <field key="remote_key" dbtype="nvarchar" precision="255" phptype="string" null="true" index="index" />
        <field key="remote_data" dbtype="nvarchar" precision="max" phptype="json" null="true" />
        <field key="hash_class" dbtype="nvarchar" precision="100" phptype="string" null="false" default="hashing.modPBKDF2" />
        <field key="salt" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="primary_group" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="session_stale" dbtype="nvarchar" precision="max" phptype="array" null="true" />
        <field key="sudo" dbtype="bit" phptype="boolean" null="false" default="0" />

        <index alias="username" name="username" primary="false" unique="true" type="BTREE">
            <column key="username" length="" collation="A" null="false" />
        </index>
        <index alias="class_key" name="class_key" primary="false" unique="false" type="BTREE">
            <column key="class_key" length="" collation="A" null="false" />
        </index>
        <index alias="remote_key" name="remote_key" primary="false" unique="false" type="BTREE">
            <column key="remote_key" length="" collation="A" null="false" />
        </index>
        <index alias="primary_group" name="primary_group" primary="false" unique="false" type="BTREE">
            <column key="primary_group" length="" collation="A" null="false" />
        </index>

        <aggregate alias="CreatedResources" class="modResource" local="id" foreign="createdby" cardinality="many" owner="local" />
        <aggregate alias="EditedResources" class="modResource" local="id" foreign="editedby" cardinality="many" owner="local" />
        <aggregate alias="DeletedResources" class="modResource" local="id" foreign="deletedby" cardinality="many" owner="local" />
        <aggregate alias="PublishedResources" class="modResource" local="id" foreign="publishedby" cardinality="many" owner="local" />
        <aggregate alias="SentMessages" class="modUserMessage" local="id" foreign="sender" cardinality="many" owner="local" />
        <aggregate alias="ReceivedMessages" class="modUserMessage" local="id" foreign="recipient" cardinality="many" owner="local" />
        <aggregate alias="PrimaryGroup" class="modUserGroup" local="primary_group" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="Profile" class="modUserProfile" local="id" foreign="internalKey" cardinality="one" owner="local" />
        <composite alias="UserSettings" class="modUserSetting" local="id" foreign="user" cardinality="many" owner="local" />
        <composite alias="UserGroupMembers" class="modUserGroupMember" local="id" foreign="member" cardinality="many" owner="local" />
    </object>

    <object class="modUserGroup" table="membergroup_names" extends="modPrincipal">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="unique" />
        <field key="description" dbtype="text" phptype="string" />
        <field key="parent" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" index="index" />
        <field key="dashboard" dbtype="int" phptype="integer" null="false" default="1" index="index" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="parent" name="parent" primary="false" unique="false" type="BTREE">
            <column key="parent" length="" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>
        <index alias="dashboard" name="dashboard" primary="false" unique="false" type="BTREE">
            <column key="dashboard" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Parent" class="modUserGroup" local="parent" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Children" class="modUserGroup" local="id" foreign="parent" cardinality="many" owner="local" />
        <aggregate alias="Dashboard" class="modDashboard" local="dashboard" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="UserGroupMembers" class="modUserGroupMember" local="id" foreign="user_group" cardinality="many" owner="local" />
        <composite alias="FormCustomizationProfiles" class="modFormCustomizationProfileUserGroup" local="id" foreign="usergroup" cardinality="many" owner="local" />
    </object>

    <object class="modUserGroupMember" table="member_groups" extends="xPDOSimpleObject">
        <field key="user_group" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="member" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="role" dbtype="int" phptype="integer" null="false" default="1" index="index" />
        <field key="rank" dbtype="int" phptype="integer" null="false" default="0" index="index" />

        <index alias="role" name="role" primary="false" unique="false" type="BTREE">
            <column key="role" length="" collation="A" null="false" />
        </index>
        <index alias="rank" name="rank" primary="false" unique="false" type="BTREE">
            <column key="rank" length="" collation="A" null="false" />
        </index>

        <aggregate alias="UserGroupRole" class="modUserGroupRole" local="role" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="UserGroup" class="modUserGroup" local="user_group" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="User" class="modUser" local="member" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modUserGroupRole" table="user_group_roles" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" index="unique" />
        <field key="description" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="authority" dbtype="int" phptype="integer" null="false" default="9999" index="index" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="authority" name="authority" primary="false" unique="false" type="BTREE">
            <column key="authority" length="" collation="A" null="false" />
        </index>

        <aggregate alias="UserGroupMembers" class="modUserGroupMember" local="id" foreign="role" cardinality="many" owner="local" />
    </object>

    <object class="modUserGroupSetting" table="user_group_settings" extends="xPDOObject">
        <field key="group" dbtype="integer" phptype="integer" null="false" default="0" index="pk" />
        <field key="key" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="pk" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="xtype" dbtype="nvarchar" precision="75" phptype="string" null="false" default="textfield" />
        <field key="namespace" dbtype="nvarchar" precision="40" phptype="string" null="false" default="core" />
        <field key="area" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="editedon" dbtype="datetime" phptype="timestamp" null="true" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="group" length="" collation="A" null="false" />
            <column key="key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="UserGroup" class="modUserGroup" local="group" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" cardinality="one" owner="foreign" />
    </object>

    <object class="modUserMessage" table="user_messages" extends="xPDOSimpleObject">
        <field key="type" dbtype="nvarchar" precision="15" phptype="string" null="false" default="" />
        <field key="subject" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="message" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="sender" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="recipient" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="private" dbtype="tinyint" precision="4" phptype="integer" null="false" default="0" />
        <field key="date_sent" dbtype="datetime" phptype="datetime" null="false" default="0000-00-00 00:00:00" />
        <field key="read" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />

        <aggregate alias="Sender" class="modUser" local="sender" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Recipient" class="modUser" local="recipient" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modUserProfile" table="user_attributes" extends="xPDOSimpleObject">
        <field key="internalKey" dbtype="int" phptype="integer" null="false" index="unique" />
        <field key="fullname" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="email" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="phone" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="mobilephone" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="blocked" dbtype="bit" phptype="boolean" null="false" default="0" />
        <field key="blockeduntil" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="blockedafter" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="logincount" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="lastlogin" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="thislogin" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="failedlogincount" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="sessionid" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="dob" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="gender" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0" />
        <field key="address" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="country" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="city" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="state" dbtype="nvarchar" precision="25" phptype="string" null="false" default="" />
        <field key="zip" dbtype="nvarchar" precision="25" phptype="string" null="false" default="" />
        <field key="fax" dbtype="nvarchar" precision="100" phptype="string" null="false" default="" />
        <field key="photo" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="comment" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
        <field key="website" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="extended" dbtype="nvarchar" precision="max" phptype="json" null="true" index="fulltext" indexgrp="extended" />

        <index alias="internalKey" name="internalKey" primary="false" unique="true" type="BTREE">
            <column key="internalKey" length="" collation="A" null="false" />
        </index>

        <aggregate alias="User" class="modUser" local="internalKey" foreign="id" cardinality="one" owner="foreign" />
    </object>

    <object class="modUserSetting" table="user_settings" extends="xPDOObject">
        <field key="user" dbtype="int" phptype="integer" null="false" default="0" index="pk" />
        <field key="key" dbtype="nvarchar" precision="50" phptype="string" null="false" default="" index="pk" />
        <field key="value" dbtype="nvarchar" precision="max" phptype="string" />
        <field key="xtype" dbtype="nvarchar" precision="75" phptype="string" null="false" default="textfield" />
        <field key="namespace" dbtype="nvarchar" precision="40" phptype="string" null="false" default="core" />
        <field key="area" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" />
        <field key="editedon" dbtype="datetime" phptype="timestamp" null="true" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="user" length="" collation="A" null="false" />
            <column key="key" length="" collation="A" null="false" />
        </index>

        <aggregate alias="User" class="modUser" local="user" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Namespace" class="modNamespace" local="namespace" foreign="name" cardinality="one" owner="foreign" />
    </object>

    <object class="modWebLink" extends="modResource" />

    <object class="modWorkspace" table="workspaces" extends="xPDOSimpleObject">
        <field key="name" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="index" />
        <field key="path" dbtype="nvarchar" precision="255" phptype="string" null="false" default="" index="unique" />
        <field key="created" dbtype="datetime" phptype="timestamp" null="false" />
        <field key="active" dbtype="bit" phptype="boolean" null="false" default="0" index="index" />
        <field key="attributes" dbtype="nvarchar" precision="max" phptype="array" />

        <index alias="name" name="name" primary="false" unique="false" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="path" name="path" primary="false" unique="true" type="BTREE">
            <column key="path" length="" collation="A" null="false" />
        </index>
        <index alias="active" name="active" primary="false" unique="false" type="BTREE">
            <column key="active" length="" collation="A" null="false" />
        </index>

        <composite alias="Packages" class="transport.modTransportPackage" local="id" foreign="workspace" cardinality="many" owner="local" />
    </object>

    <object class="modXMLRPCResource" extends="modResource" />

    <!-- MOVE DEPRECATED OBJECT DEFINITIONS BELOW HERE -->
</model>
