<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
 * This file is part of the MODX Revolution package.
 *
 * Copyright (c) MODX, LLC
 *
 * For complete copyright and license information, see the COPYRIGHT and LICENSE
 * files found in the top-level directory of this distribution.
 */
 -->
<!-- The following xPDO model represents an object-relational map structure of the MODX transport package -->
<model package="MODX\Revolution\Transport" baseClass="xPDO\Om\xPDOObject" platform="mysql" defaultEngine="InnoDB" phpdoc-package="MODX\Revolution\Transport" version="3.0">
    <object class="modTransportProvider" table="transport_providers" extends="xPDO\Om\xPDOSimpleObject">
        <field key="name" dbtype="varchar" precision="191" phptype="string" null="false" index="unique" />
        <field key="description" dbtype="mediumtext" phptype="string" />
        <field key="service_url" dbtype="tinytext" phptype="string" />
        <field key="username" dbtype="varchar" precision="191" phptype="string" null="false" default="" index="index" />
        <field key="api_key" dbtype="varchar" precision="191" phptype="string" null="false" default="" index="index" />
        <field key="created" dbtype="datetime" phptype="datetime" null="false" />
        <field key="updated" dbtype="timestamp" phptype="timestamp" attributes="ON UPDATE CURRENT_TIMESTAMP" />
        <field key="active" dbtype="tinyint" precision="1" phptype="boolean" null="false" default="1" index="index" />
        <field key="priority" dbtype="tinyint" precision="4" phptype="integer" null="false" default="10" index="index" />
        <field key="properties" dbtype="mediumtext" phptype="json" null="false" default="" />

        <index alias="name" name="name" primary="false" unique="true" type="BTREE">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="api_key" name="api_key" primary="false" unique="false" type="BTREE">
            <column key="api_key" length="" collation="A" null="false" />
        </index>
        <index alias="username" name="username" primary="false" unique="false" type="BTREE">
            <column key="username" 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="priority" name="priority" primary="false" unique="false" type="BTREE">
            <column key="priority" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Packages" class="MODX\Revolution\Transport\modTransportPackage" local="id" foreign="provider" cardinality="many" owner="local" />
    </object>
    <object class="modTransportPackage" table="transport_packages" extends="xPDO\Om\xPDOObject">
        <field key="signature" dbtype="varchar" precision="191" phptype="string" null="false" index="pk" />
        <field key="created" dbtype="datetime" phptype="datetime" null="false" />
        <field key="updated" dbtype="timestamp" phptype="timestamp" attributes="ON UPDATE CURRENT_TIMESTAMP" />
        <field key="installed" dbtype="datetime" phptype="datetime" />
        <field key="state" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="1" />
        <field key="workspace" dbtype="integer" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="fk" />
        <field key="provider" dbtype="integer" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="fk" />
        <field key="disabled" dbtype="tinyint" precision="1" attributes="unsigned" phptype="boolean" null="false" default="0" index="index" />
        <field key="source" dbtype="tinytext" phptype="string" />
        <field key="manifest" dbtype="text" phptype="array" />
        <field key="attributes" dbtype="mediumtext" phptype="array" />
        <field key="package_name" dbtype="varchar" precision="191" phptype="string" null="false" index="index" />
        <field key="metadata" dbtype="text" phptype="array" />
        <field key="version_major" dbtype="smallint" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
        <field key="version_minor" dbtype="smallint" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
        <field key="version_patch" dbtype="smallint" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
        <field key="release" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
        <field key="release_index" dbtype="smallint" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
            <column key="signature" length="" collation="A" null="false" />
        </index>
        <index alias="workspace" name="workspace" primary="false" unique="false" type="BTREE">
            <column key="workspace" length="" collation="A" null="false" />
        </index>
        <index alias="provider" name="provider" primary="false" unique="false" type="BTREE">
            <column key="provider" 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>
        <index alias="package_name" name="package_name" primary="false" unique="false" type="BTREE">
            <column key="package_name" length="" collation="A" null="false" />
        </index>
        <index alias="version_major" name="version_major" primary="false" unique="false" type="BTREE">
            <column key="version_major" length="" collation="A" null="false" />
        </index>
        <index alias="version_minor" name="version_minor" primary="false" unique="false" type="BTREE">
            <column key="version_minor" length="" collation="A" null="false" />
        </index>
        <index alias="version_patch" name="version_patch" primary="false" unique="false" type="BTREE">
            <column key="version_patch" length="" collation="A" null="false" />
        </index>
        <index alias="release" name="release" primary="false" unique="false" type="BTREE">
            <column key="release" length="" collation="A" null="false" />
        </index>
        <index alias="release_index" name="release_index" primary="false" unique="false" type="BTREE">
            <column key="release_index" length="" collation="A" null="false" />
        </index>

        <aggregate alias="Workspace" class="MODX\Revolution\modWorkspace" local="workspace" foreign="id" cardinality="one" owner="foreign" />
        <aggregate alias="Provider" class="MODX\Revolution\Transport\modTransportProvider" local="provider" foreign="id" cardinality="one" owner="foreign" />
    </object>
</model>
