<?xml version="1.0" encoding="utf-8"?>
<database name="default" defaultIdMethod="native" defaultPhpNamingMethod="underscore" nameSpace="ChurchCRM\model\ChurchCRM">

    <table name="version_ver" idMethod="native" phpName="Version" description="History of all version upgrades applied to this database">
        <column name="ver_ID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="ver_version" phpName="Version" type="VARCHAR" size="50" required="true" defaultValue=""/>
        <column name="ver_update_start" phpName="UpdateStart" type="TIMESTAMP"/>
        <column name="ver_update_end" phpName="UpdateEnd" type="TIMESTAMP"/>
        <unique name="ver_version">
            <unique-column name="ver_version"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="person_per" idMethod="native" phpName="Person" description="This contains the main person data, including person names, person addresses, person phone numbers, and foreign keys to the family table">
        <column name="per_ID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="per_Title" phpName="Title" type="VARCHAR" size="50"/>
        <column name="per_FirstName" phpName="FirstName" type="VARCHAR" size="50"/>
        <column name="per_MiddleName" phpName="MiddleName" type="VARCHAR" size="50"/>
        <column name="per_LastName" phpName="LastName" type="VARCHAR" size="50"/>
        <column name="per_Suffix" phpName="Suffix" type="VARCHAR" size="50"/>
        <column name="per_Address1" phpName="Address1" type="VARCHAR" size="50"/>
        <column name="per_Address2" phpName="Address2" type="VARCHAR" size="50"/>
        <column name="per_City" phpName="City" type="VARCHAR" size="50"/>
        <column name="per_State" phpName="State" type="VARCHAR" size="50"/>
        <column name="per_Zip" phpName="Zip" type="VARCHAR" size="50"/>
        <column name="per_Country" phpName="Country" type="VARCHAR" size="50"/>
        <column name="per_HomePhone" phpName="HomePhone" type="VARCHAR" size="30"/>
        <column name="per_WorkPhone" phpName="WorkPhone" type="VARCHAR" size="30"/>
        <column name="per_CellPhone" phpName="CellPhone" type="VARCHAR" size="30"/>
        <column name="per_Email" phpName="Email" type="VARCHAR" size="50"/>
        <column name="per_WorkEmail" phpName="WorkEmail" type="VARCHAR" size="50"/>
        <column name="per_BirthMonth" phpName="BirthMonth" type="TINYINT" size="3" sqlType="tinyint(3) unsigned"
                required="true" defaultValue="0"/>
        <column name="per_BirthDay" phpName="BirthDay" type="TINYINT" size="3" sqlType="tinyint(3) unsigned"
                required="true" defaultValue="0"/>
        <column name="per_BirthYear" phpName="BirthYear" type="SMALLINT" size="4" sqlType="smallint(4)"/>
        <column name="per_MembershipDate" phpName="MembershipDate" type="DATE"/>
        <column name="per_Gender" phpName="Gender" type="TINYINT" size="1" sqlType="tinyint(1) unsigned" required="true"
                defaultValue="false"/>
        <column name="per_fmr_ID" phpName="FmrId" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true"
                defaultValue="0"/>
        <column name="per_cls_ID" phpName="ClsId" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true"
                defaultValue="0"/>
        <column name="per_fam_ID" phpName="FamId" type="SMALLINT" size="5" sqlType="smallint(5) unsigned"
                required="true" defaultValue="0"/>
        <column name="per_Envelope" phpName="Envelope" type="SMALLINT" size="5" sqlType="smallint(5) unsigned"/>
        <column name="per_DateLastEdited" phpName="DateLastEdited" type="TIMESTAMP"/>
        <column name="per_DateEntered" phpName="DateEntered" type="TIMESTAMP" required="true" />
        <column name="per_EnteredBy" phpName="EnteredBy" type="SMALLINT" size="5" sqlType="smallint(5)"
                required="true" defaultValue="0"/>
        <column name="per_EditedBy" phpName="EditedBy" type="SMALLINT" size="5" sqlType="smallint(5) unsigned"
                defaultValue="0"/>
        <column name="per_FriendDate" phpName="FriendDate" type="DATE"/>
        <column name="per_Flags" phpName="Flags" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <column name="per_Facebook" phpName="Facebook" type="VARCHAR" size="50" Description="Facebook username" />
        <column name="per_Twitter" phpName="Twitter" type="VARCHAR" size="50" Description="Twitter username" />
        <column name="per_LinkedIn" phpName="LinkedIn" type="VARCHAR" size="50" Description="LinkedIn name" />
        <index name="per_ID">
            <index-column name="per_ID"/>
        </index>
        <foreign-key foreignTable="family_fam">
            <reference local="per_fam_ID" foreign="fam_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
        <behavior name="validate">
            <parameter name="rule1" value="{column: per_firstname, validator: NotNull}" />
            <parameter name="rule2" value="{column: per_firstname, validator: NotBlank}" />
            <parameter name="rule3" value="{column: per_firstname, validator: Length, options: {min: 2, max: 50}}" />
            <parameter name="rule4" value="{column: per_lastname, validator: NotNull}" />
            <parameter name="rule5" value="{column: per_lastname, validator: NotBlank}" />
            <parameter name="rule6" value="{column: per_lastname, validator: Length, options: {min: 2, max: 50}}" />
        </behavior>
    </table>

    <table name="menu_links" idMethod="native" phpName="MenuLink">
        <column name="linkId" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="linkName" phpName="Name" type="VARCHAR" size="50"/>
        <column name="linkUri" phpName="Uri" type="VARCHAR" size="500"/>
        <column name="linkOrder" phpName="Order" type="SMALLINT"/>
        <index name="linkId">
            <index-column name="linkId"/>
        </index>
        <behavior name="validate">
            <parameter name="rule1" value="{column: linkname, validator: NotNull}" />
            <parameter name="rule2" value="{column: linkname, validator: NotBlank}" />
            <parameter name="rule3" value="{column: linkname, validator: Length, options: {min: 2, max: 50}}" />
            <parameter name="rule4" value="{column: linkuri, validator: Url}" />
        </behavior>
    </table>

    <table name="whycame_why" idMethod="native" phpName="WhyCame" description="This contains the comments related to why people came">
        <column name="why_ID" phpName="Id" type="SMALLINT" size="9" primaryKey="true" autoIncrement="true"
                required="true"/>
        <column name="why_per_ID" phpName="PerId" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <column name="why_join" phpName="Join" type="LONGVARCHAR" required="true"/>
        <column name="why_come" phpName="Come" type="LONGVARCHAR" required="true"/>
        <column name="why_suggest" phpName="Suggest" type="LONGVARCHAR" required="true"/>
        <column name="why_hearOfUs" phpName="HearOfUs" type="LONGVARCHAR" required="true"/>
        <foreign-key foreignTable="person_per">
            <reference local="why_per_ID" foreign="per_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="person_custom" idMethod="native" phpName="PersonCustom" description="Person custom fields">
        <column name="per_ID" phpName="PerId" type="SMALLINT" size="9" primaryKey="true" required="true"
                defaultValue="0"/>
        <foreign-key foreignTable="person_per">
            <reference local="per_ID" foreign="per_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="person_custom_master" idMethod="native" phpName="PersonCustomMaster" description="This contains definitions for the custom person fields">
        <column name="custom_Order" phpName="Order" type="SMALLINT" required="true" defaultValue="0"/>
        <column name="custom_Field" phpName="Id" type="VARCHAR" primaryKey="true" size="5" required="true" defaultValue=""/>
        <column name="custom_Name" phpName="Name" type="VARCHAR" size="40" required="true" defaultValue=""/>
        <column name="custom_Special" phpName="Special" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"/>
        <column name="custom_FieldSec" phpName="FieldSecurity" type="TINYINT" required="true"/>
        <column name="type_ID" phpName="TypeId" type="TINYINT" required="true" defaultValue="0"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="family_fam" idMethod="native" phpName="Family" description="This contains the main family data, including family name, family addresses, and family phone numbers">
        <column name="fam_ID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="fam_Name" phpName="Name" type="VARCHAR" size="50"/>
        <column name="fam_Address1" phpName="Address1" type="VARCHAR" size="255"/>
        <column name="fam_Address2" phpName="Address2" type="VARCHAR" size="255"/>
        <column name="fam_City" phpName="City" type="VARCHAR" size="50"/>
        <column name="fam_State" phpName="State" type="VARCHAR" size="50"/>
        <column name="fam_Zip" phpName="Zip" type="VARCHAR" size="50"/>
        <column name="fam_Country" phpName="Country" type="VARCHAR" size="50"/>
        <column name="fam_HomePhone" phpName="HomePhone" type="VARCHAR" size="30"/>
        <column name="fam_Email" phpName="Email" type="VARCHAR" size="100"/>
        <column name="fam_WeddingDate" phpName="Weddingdate" type="DATE"/>
        <column name="fam_DateEntered" phpName="DateEntered" type="TIMESTAMP" required="true"/>
        <column name="fam_DateLastEdited" phpName="DateLastEdited" type="TIMESTAMP"/>
        <column name="fam_EnteredBy" phpName="EnteredBy" type="SMALLINT" size="5" sqlType="smallint(5)"
                required="true" defaultValue="0"/>
        <column name="fam_EditedBy" phpName="EditedBy" type="SMALLINT" size="5" sqlType="smallint(5) unsigned"
                defaultValue="0"/>
        <column name="fam_scanCheck" phpName="ScanCheck" type="LONGVARCHAR"/>
        <column name="fam_scanCredit" phpName="ScanCredit" type="LONGVARCHAR"/>
        <column name="fam_SendNewsLetter" phpName="SendNewsletter" type="CHAR" sqlType="enum('FALSE','TRUE')"
                required="true" defaultValue="FALSE"/>
        <column name="fam_DateDeactivated" phpName="DateDeactivated" type="DATE"/>
        <column name="fam_Latitude" phpName="Latitude" type="DOUBLE"/>
        <column name="fam_Longitude" phpName="Longitude" type="DOUBLE"/>
        <column name="fam_Envelope" phpName="Envelope" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <index name="fam_ID">
            <index-column name="fam_ID"/>
        </index>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
        <behavior name="validate">
            <parameter name="rule1" value="{column: fam_name, validator: NotNull}" />
            <parameter name="rule2" value="{column: fam_name, validator: NotBlank}" />
            <parameter name="rule3" value="{column: fam_name, validator: Length, options: {min: 2, max: 50}}" />
        </behavior>
    </table>
    <table name="family_custom_master" idMethod="native" phpName="FamilyCustomMaster">
        <column name="fam_custom_Order" phpName="Order" type="SMALLINT" required="true" defaultValue="0"/>
        <column name="fam_custom_Field" phpName="Field" type="VARCHAR" size="5" required="true" defaultValue="" primaryKey="true"/>
        <column name="fam_custom_Name" phpName="Name" type="VARCHAR" size="40" required="true" defaultValue=""/>
        <column name="fam_custom_Special" phpName="CustomSpecial" type="SMALLINT" size="8"
                sqlType="mediumint(8) unsigned"/>
        <column name="fam_custom_FieldSec" phpName="FieldSecurity" type="TINYINT" required="true" defaultValue="1"/>
        <column name="type_ID" phpName="TypeId" type="TINYINT" required="true" defaultValue="0"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="family_custom" idMethod="native" phpName="FamilyCustom">
        <column name="fam_ID" phpName="FamId" type="SMALLINT" size="9" primaryKey="true" required="true"
                defaultValue="0"/>
        <foreign-key foreignTable="family_fam">
          <reference local="fam_ID" foreign="fam_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="note_nte" idMethod="native" phpName="Note" description="Contains all person and family notes, including the date, time, and person who entered the note">
        <column name="nte_ID" phpName="Id" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="nte_per_ID" phpName="PerId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                required="true" defaultValue="0"/>
        <column name="nte_fam_ID" phpName="FamId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                required="true" defaultValue="0"/>
        <column name="nte_Private" phpName="Private" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                required="true" defaultValue="0"/>
        <column name="nte_Text" phpName="Text" type="LONGVARCHAR"/>
        <column name="nte_DateEntered" phpName="DateEntered" type="TIMESTAMP" required="true" />
        <column name="nte_DateLastEdited" phpName="DateLastEdited" type="TIMESTAMP"/>
        <column name="nte_EnteredBy" phpName="EnteredBy" type="SMALLINT" size="8" sqlType="mediumint(8)"
                required="true" defaultValue="0"/>
        <column name="nte_EditedBy" phpName="EditedBy" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                required="true" defaultValue="0"/>
        <column name="nte_Type" phpName="Type" type="VARCHAR" size="50"/>
        <foreign-key foreignTable="person_per">
            <reference local="nte_per_ID" foreign="per_ID"/>
        </foreign-key>
        <foreign-key foreignTable="family_fam">
            <reference local="nte_fam_ID" foreign="fam_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="config_cfg" idMethod="none" phpName="Config" description="This table contains all non-default configuration parameter names and values">
        <column name="cfg_name" phpName="Name" type="VARCHAR" size="50" primaryKey="true" required="true" defaultValue=""/>
        <column name="cfg_value" phpName="Value" type="LONGVARCHAR"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="group_grp" idMethod="native" phpName="Group" description="This contains the name and description for each group, as well as foreign keys to the list of group roles">
        <column name="grp_ID" phpName="Id" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="grp_Type" phpName="Type" type="TINYINT" required="true" defaultValue="0" description="The group type.  This is defined in list_lst.OptionId where lst_ID=3"/>
        <column name="grp_RoleListID" phpName="RoleListId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                required="true" defaultValue="0" description="The lst_ID containing the names of the roles for this group"/>
        <column name="grp_DefaultRole" phpName="DefaultRole" type="SMALLINT" size="9" required="true" defaultValue="0" description="The ID of the default role in this group's RoleList" />
        <column name="grp_Name" phpName="Name" type="VARCHAR" size="50" required="true" defaultValue=""/>
        <column name="grp_Description" phpName="Description" type="LONGVARCHAR"/>
        <column name="grp_hasSpecialProps" phpName="HasSpecialProps" type="BOOLEAN" defaultValue="0"/>
        <column name="grp_active" phpName="Active" type="BOOLEAN" size="1" required="true"/>
        <column name="grp_include_email_export" phpName="IncludeInEmailExport" type="BOOLEAN" size="1" required="true" description="Should members of this group be included in MailChimp Export"/>
        <foreign-key foreignTable="list_lst">
            <reference local="grp_RoleListID" foreign="lst_ID"/>
            <reference local="grp_Type" foreign="lst_OptionID"/>
        </foreign-key>
        <index name="grp_ID_2">
            <index-column name="grp_ID"/>
        </index>
        <unique name="grp_ID">
            <unique-column name="grp_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="groupprop_master" idMethod="native" phpName="GroupPropMaster" description="This contains definitions for the group-specific fields">
        <column name="grp_ID" phpName="GrpId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" required="true"
                defaultValue="0"/>
        <column name="prop_ID" phpName="PropId" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true"
                defaultValue="0"/>
        <column name="prop_Field" phpName="Field" type="VARCHAR" size="5" required="true" defaultValue="0"/>
        <column name="prop_Name" phpName="Name" type="VARCHAR" size="40"/>
        <column name="prop_Description" phpName="Description" type="VARCHAR" size="60"/>
        <column name="type_ID" phpName="TypeId" type="SMALLINT" size="5" sqlType="smallint(5) unsigned" required="true"
                defaultValue="0"/>
        <column name="prop_Special" phpName="Special" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned"/>
        <column name="prop_PersonDisplay" phpName="PersonDisplay" type="CHAR" sqlType="enum('false','true')"
                required="true" defaultValue="false"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="person2group2role_p2g2r" isCrossRef="true" description="This table stores the information of which people are in which groups, and what group role each person holds in that group">
        <column name="p2g2r_per_ID" phpName="PersonId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                primaryKey="true" required="true" defaultValue="0"/>
        <column name="p2g2r_grp_ID" phpName="GroupId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                primaryKey="true" required="true" defaultValue="0"/>
        <column name="p2g2r_rle_ID" phpName="RoleId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned"
                required="true" defaultValue="0"/>
        <index name="p2g2r_per_ID">
            <index-column name="p2g2r_per_ID"/>
            <index-column name="p2g2r_grp_ID"/>
            <index-column name="p2g2r_rle_ID"/>
        </index>
        <foreign-key foreignTable="person_per">
            <reference local="p2g2r_per_ID" foreign="per_ID"/>
        </foreign-key>
        <foreign-key foreignTable="group_grp">
            <reference local="p2g2r_grp_ID" foreign="grp_ID"/>
        </foreign-key>

        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="deposit_dep" idMethod="native" phpName="Deposit" description="This records deposits / payments">
        <column name="dep_ID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="dep_Date" phpName="Date" type="DATE"/>
        <column name="dep_Comment" phpName="Comment" type="LONGVARCHAR"/>
        <column name="dep_EnteredBy" phpName="Enteredby" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned"/>
        <column name="dep_Closed" phpName="Closed" type="BOOLEAN" size="1" required="true" defaultValue="false"/>
        <column name="dep_Type" phpName="Type" type="CHAR" sqlType="enum('Bank','CreditCard','BankDraft')"
                required="true" defaultValue="Bank"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="donateditem_di" idMethod="native" phpName="DonatedItem">
        <column name="di_ID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="di_item" phpName="Item" type="VARCHAR" size="32" required="true"/>
        <column name="di_FR_ID" phpName="FrId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned"
                required="true"/>
        <column name="di_donor_ID" phpName="DonorId" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <column name="di_buyer_ID" phpName="BuyerId" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <column name="di_multibuy" phpName="Multibuy" type="SMALLINT" size="1" required="true" defaultValue="0"/>
        <column name="di_title" phpName="Title" type="VARCHAR" size="128" required="true"/>
        <column name="di_description" phpName="Description" type="LONGVARCHAR"/>
        <column name="di_sellprice" phpName="Sellprice" type="DECIMAL" size="8" scale="2"/>
        <column name="di_estprice" phpName="Estprice" type="DECIMAL" size="8" scale="2"/>
        <column name="di_minimum" phpName="Minimum" type="DECIMAL" size="8" scale="2"/>
        <column name="di_materialvalue" phpName="MaterialValue" type="DECIMAL" size="8" scale="2"/>
        <column name="di_EnteredBy" phpName="Enteredby" type="SMALLINT" size="5" sqlType="smallint(5) unsigned"
                required="true" defaultValue="0"/>
        <column name="di_EnteredDate" phpName="Entereddate" type="DATE" required="true"/>
        <column name="di_picture" phpName="Picture" type="LONGVARCHAR"/>
        <unique name="di_ID">
            <unique-column name="di_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="donationfund_fun" idMethod="native" phpName="DonationFund" description="This contains the defined donation funds">
        <column name="fun_ID" phpName="Id" type="TINYINT" size="3" primaryKey="true" autoIncrement="true"
                required="true"/>
        <column name="fun_Active" phpName="Active" type="CHAR" sqlType="enum('true','false')" required="true"
                defaultValue="true"/>
        <column name="fun_Name" phpName="Name" type="VARCHAR" size="30"/>
        <column name="fun_Description" phpName="Description" type="VARCHAR" size="100"/>
        <column name="fun_Order" phpName="Order" type="INTEGER" required="true" defaultValue="0"/>
        <unique name="fun_ID">
            <unique-column name="fun_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="event_attend" idMethod="native" phpName="EventAttend" description="this indicates which people attended which events">
        <column name="attend_id" phpName="AttendId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="event_id" phpName="EventId" type="INTEGER" required="true" defaultValue="0"/>
        <column name="person_id" phpName="PersonId" type="INTEGER" required="true" defaultValue="0"/>
        <column name="checkin_date" phpName="CheckinDate" type="TIMESTAMP"/>
        <column name="checkin_id" phpName="CheckinId" type="INTEGER"/>
        <column name="checkout_date" phpName="CheckoutDate" type="TIMESTAMP"/>
        <column name="checkout_id" phpName="CheckoutId" type="INTEGER"/>
        <foreign-key foreignTable="events_event">
            <reference local="event_id" foreign="event_id"/>
        </foreign-key>
        <foreign-key foreignTable="person_per">
            <reference local="person_id" foreign="per_ID"/>
        </foreign-key>
        <unique name="event_id">
            <unique-column name="event_id"/>
            <unique-column name="person_id"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="event_types" idMethod="native" phpName="EventType">
        <column name="type_id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="type_name" phpName="Name" type="VARCHAR" size="255" required="true" defaultValue=""/>
        <column name="type_defstarttime" phpName="DefStartTime" type="TIME" required="true" defaultValue="00:00:00"/>
        <column name="type_defrecurtype" phpName="DefRecurType" type="CHAR"
                sqlType="enum('none','weekly','monthly','yearly')" required="true" defaultValue="none"/>
        <column name="type_defrecurDOW" phpName="DefRecurDOW" type="CHAR"
                sqlType="enum('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')" required="true"
                defaultValue="Sunday"/>
        <column name="type_defrecurDOM" phpName="DefRecurDOM" type="CHAR" size="2" required="true" defaultValue="0"/>
        <column name="type_defrecurDOY" phpName="DefRecurDOY" type="DATE" required="true" defaultValue="2016-01-01"/>
        <column name="type_active" phpName="Active" type="INTEGER" size="1" required="true" defaultValue="1"/>
        <column name="type_grpid" phpName="GroupId" type="INTEGER" required="false" defaultValue="0"/>
        <foreign-key foreignTable="group_grp">
            <reference local="type_grpid" foreign="grp_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="eventcountnames_evctnm" idMethod="native" phpName="EventCountName">
        <column name="evctnm_countid" phpName="Id" type="INTEGER" size="5" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="evctnm_eventtypeid" phpName="TypeId" type="SMALLINT" size="5" required="true" defaultValue="0"/>
        <column name="evctnm_countname" phpName="Name" type="VARCHAR" size="20" required="true" defaultValue=""/>
        <unique name="evctnm_eventtypeid">
            <unique-column name="evctnm_eventtypeid"/>
            <unique-column name="evctnm_countname"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="eventcounts_evtcnt" idMethod="native" phpName="EventCounts">
        <column name="evtcnt_eventid" phpName="EvtcntEventid" type="INTEGER" size="5" primaryKey="true" required="true"
                defaultValue="0"/>
        <column name="evtcnt_countid" phpName="EvtcntCountid" type="INTEGER" size="5" primaryKey="true" required="true"
                defaultValue="0"/>
        <column name="evtcnt_countname" phpName="EvtcntCountname" type="VARCHAR" size="20"/>
        <column name="evtcnt_countcount" phpName="EvtcntCountcount" type="INTEGER" size="6"/>
        <column name="evtcnt_notes" phpName="EvtcntNotes" type="VARCHAR" size="20"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
    <table name="events_event" idMethod="native" phpName="Event" description="This contains events">
        <column name="event_id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="event_type" phpName="Type" type="INTEGER" required="true" defaultValue="0"/>
        <column name="event_title" phpName="Title" type="VARCHAR" size="255" required="true" defaultValue=""/>
        <column name="event_desc" phpName="Desc" type="VARCHAR" size="255"/>
        <column name="event_text" phpName="Text" type="LONGVARCHAR"/>
        <column name="event_start" phpName="Start" type="TIMESTAMP" required="true"/>
        <column name="event_end" phpName="End" type="TIMESTAMP" required="true"/>
        <column name="inactive" phpName="InActive" type="INTEGER" size="1" required="true" defaultValue="0"/>
        <column name="location_id" phpName="LocationId" type="INTEGER" required="true" defaultValue="0"/>
        <column name="primary_contact_person_id" phpName="PrimaryContactPersonId" type="INTEGER" required="true" defaultValue="0"/>
        <column name="secondary_contact_person_id" phpName="SecondaryContactPersonId" type="INTEGER" required="true" defaultValue="0"/>
        <column name="event_url" phpName="URL" type="LONGVARCHAR"/>

        <foreign-key foreignTable="event_types" name="EventType" refPhpName="EventType">
            <reference local="event_type" foreign="type_id"/>
        </foreign-key>

        <foreign-key foreignTable="person_per" name="PrimaryContact" refPhpName="PrimaryContactPerson" skipSql = "true">
            <reference local="event_type" foreign="per_ID"/>
        </foreign-key>

        <foreign-key foreignTable="person_per" name="SecondaryContact" refPhpName="SecondaryContactPerson" skipSql = "true">
            <reference local="secondary_contact_person_id" foreign="per_ID"/>
        </foreign-key>
        <foreign-key foreignTable="locations">
            <reference local="location_id" foreign="location_id"/>
        </foreign-key>
        <index name="event_txt">
            <index-column name="event_text"/>
        </index>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="fundraiser_fr" idMethod="native" phpName="FundRaiser">
        <column name="fr_ID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true"
                autoIncrement="true" required="true"/>
        <column name="fr_date" phpName="Date" type="DATE"/>
        <column name="fr_title" phpName="Title" type="VARCHAR" size="128" required="true"/>
        <column name="fr_description" phpName="Description" type="LONGVARCHAR"/>
        <column name="fr_EnteredBy" phpName="EnteredBy" type="SMALLINT" size="5" sqlType="smallint(5) unsigned"
                required="true" defaultValue="0"/>
        <column name="fr_EnteredDate" phpName="EnteredDate" type="DATE" required="true"/>
        <unique name="fr_ID">
            <unique-column name="fr_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="pledge_plg" idMethod="native" phpName="Pledge" description="This contains all payment/pledge information">
        <column name="plg_plgID" phpName="Id" type="SMALLINT" size="9" sqlType="mediumint(9)" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="plg_FamID" phpName="FamId" type="SMALLINT" size="9" sqlType="mediumint(9)"/>
        <column name="plg_FYID" phpName="FyId" type="SMALLINT" size="9" sqlType="mediumint(9)"/>
        <column name="plg_date" phpName="Date" type="DATE"/>
        <column name="plg_amount" phpName="Amount" type="DECIMAL" size="8" scale="2"/>
        <column name="plg_schedule" phpName="Schedule" type="CHAR" sqlType="enum('Weekly','Monthly','Quarterly','Once','Other')"/>
        <column name="plg_method" phpName="Method" type="CHAR" sqlType="enum('CREDITCARD','CHECK','CASH','BANKDRAFT')"/>
        <column name="plg_comment" phpName="Comment" type="LONGVARCHAR"/>
        <column name="plg_DateLastEdited" phpName="DateLastEdited" type="DATE" required="true" defaultValue="2016-01-01"/>
        <column name="plg_EditedBy" phpName="EditedBy" type="SMALLINT" size="9" sqlType="mediumint(9)" required="true" defaultValue="0"/>
        <column name="plg_PledgeOrPayment" phpName="PledgeOrPayment" type="CHAR" sqlType="enum('Pledge','Payment')" required="true" defaultValue="Pledge"/>
        <column name="plg_fundID" phpName="FundId" type="TINYINT" size="3" sqlType="tinyint(3) unsigned"/>
        <column name="plg_depID" phpName="DepId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned"/>
        <column name="plg_CheckNo" phpName="CheckNo" type="BIGINT" size="16" sqlType="bigint(16) unsigned"/>
        <column name="plg_Problem" phpName="Problem" type="BOOLEAN" size="1"/>
        <column name="plg_scanString" phpName="ScanString" type="LONGVARCHAR"/>
        <column name="plg_aut_ID" phpName="AutId" type="SMALLINT" size="9" sqlType="mediumint(9)" required="true" defaultValue="0"/>
        <column name="plg_aut_Cleared" phpName="AutCleared" type="BOOLEAN" size="1" required="true" defaultValue="false"/>
        <column name="plg_aut_ResultID" phpName="AutResultId" type="SMALLINT" size="9" sqlType="mediumint(9)" required="true" defaultValue="0"/>
        <column name="plg_NonDeductible" phpName="Nondeductible" type="DECIMAL" size="8" scale="2" required="true"/>
        <column name="plg_GroupKey" phpName="GroupKey" type="VARCHAR" size="64" required="true"/>
        <foreign-key foreignTable="deposit_dep">
            <reference local="plg_depID" foreign="dep_ID"/>
        </foreign-key>
        <foreign-key foreignTable="donationfund_fun">
            <reference local="plg_fundID" foreign="fun_ID"/>
        </foreign-key>
        <foreign-key foreignTable="family_fam">
            <reference local="plg_FamID" foreign="fam_ID"/>
        </foreign-key>
        <foreign-key foreignTable="person_per">
            <reference local="plg_EditedBy" foreign="per_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="list_lst" idMethod="native" phpName="ListOption" description="This table stores the options for most of the drop down lists in churchCRM, including person classifications, family roles, group types, group roles, group-specific property types, and custom field value lists.">
        <column name="lst_ID" phpName="Id" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true" defaultValue="0" primaryKey="true" description="The ID of the list.  Since this is a composite primary key, there may be multiple List IDs"/>
        <column name="lst_OptionID" phpName="OptionId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true" defaultValue="0" primaryKey="true" description="The ID of the option in this list.  ***List ID + List Option ID must be unique***"/>
        <column name="lst_OptionSequence" phpName="OptionSequence" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="0" description="The order in which to display items in this list" />
        <column name="lst_OptionName" phpName="OptionName" type="VARCHAR" size="50" required="true" defaultValue="" description="The actual value for this list option"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="user_usr" idMethod="native" phpName="User" description="This contains the login information and specific settings for each ChurchCRM user">
        <column name="usr_per_ID" phpName="PersonId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" required="true" defaultValue="0"/>
        <column name="usr_Password" phpName="Password" type="VARCHAR" size="500" required="true" defaultValue=""/>
        <column name="usr_NeedPasswordChange" phpName="NeedPasswordChange" type="BOOLEAN" size="1" sqlType="tinyint(3) unsigned" required="true" defaultValue="1"/>
        <column name="usr_LastLogin" phpName="LastLogin" type="TIMESTAMP" required="true" defaultValue="2016-01-01 00:00:00"/>
        <column name="usr_LoginCount" phpName="LoginCount" type="SMALLINT" size="5" sqlType="smallint(5) unsigned" required="true" defaultValue="0"/>
        <column name="usr_FailedLogins" phpName="FailedLogins" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="0"/>
        <column name="usr_AddRecords" phpName="AddRecords" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_EditRecords" phpName="EditRecords" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_DeleteRecords" phpName="DeleteRecords" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_MenuOptions" phpName="MenuOptions" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_ManageGroups" phpName="ManageGroups" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_Finance" phpName="Finance" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_Notes" phpName="Notes" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_Admin" phpName="Admin" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_defaultFY" phpName="DefaultFY" type="SMALLINT" size="9" required="true" defaultValue="10"/>
        <column name="usr_currentDeposit" phpName="CurrentDeposit" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <column name="usr_UserName" phpName="UserName" type="VARCHAR" size="32" required="true"/>
        <column name="usr_Style" phpName="UserStyle" type="VARCHAR" size="50" />
        <column name="usr_ApiKey" phpName="ApiKey" type="VARCHAR" size="255" />
        <column name="usr_TwoFactorAuthSecret" phpName="TwoFactorAuthSecret" type="VARCHAR" size="255" />
        <column name="usr_TwoFactorAuthLastKeyTimestamp" phpName="TwoFactorAuthLastKeyTimestamp" type="SMALLINT" size="9" />
        <column name="usr_TwoFactorAuthRecoveryCodes" phpName="TwoFactorAuthRecoveryCodes" type="LONGVARCHAR"/>
        <column name="usr_EditSelf" phpName="EditSelf" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="0"/>
        <column name="usr_CalStart" phpName="CalStart" type="DATE"/>
        <column name="usr_CalEnd" phpName="CalEnd" type="DATE"/>
        <column name="usr_CalNoSchool1" phpName="CalNoSchool1" type="DATE"/>
        <column name="usr_CalNoSchool2" phpName="CalNoSchool2" type="DATE"/>
        <column name="usr_CalNoSchool3" phpName="CalNoSchool3" type="DATE"/>
        <column name="usr_CalNoSchool4" phpName="CalNoSchool4" type="DATE"/>
        <column name="usr_CalNoSchool5" phpName="CalNoSchool5" type="DATE"/>
        <column name="usr_CalNoSchool6" phpName="CalNoSchool6" type="DATE"/>
        <column name="usr_CalNoSchool7" phpName="CalNoSchool7" type="DATE"/>
        <column name="usr_CalNoSchool8" phpName="CalNoSchool8" type="DATE"/>
        <column name="usr_SearchFamily" phpName="Searchfamily" type="TINYINT" size="3"/>
        <index name="usr_per_ID">
            <index-column name="usr_per_ID"/>
        </index>
        <unique name="usr_UserName">
            <unique-column name="usr_UserName"/>
        </unique>
        <unique name="usr_ApiKey">
            <unique-column name="usr_ApiKey"/>
        </unique>
        <foreign-key foreignTable="person_per">
            <reference local="usr_per_ID" foreign="per_ID"/>
        </foreign-key>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="userconfig_ucfg" idMethod="native" phpName="UserConfig">
        <column name="ucfg_per_id" phpName="PeronId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" required="true"/>
        <column name="ucfg_id" phpName="Id" type="INTEGER" primaryKey="true" required="true" defaultValue="0"/>
        <column name="ucfg_name" phpName="Name" type="VARCHAR" size="50" required="true" defaultValue=""/>
        <column name="ucfg_value" phpName="Value" type="LONGVARCHAR"/>
        <column name="ucfg_type" phpName="Type" type="CHAR" sqlType="enum('text','number','date','boolean','textarea')" required="true" defaultValue="text"/>
        <column name="ucfg_tooltip" phpName="Tooltip" type="LONGVARCHAR" required="true"/>
        <column name="ucfg_permission" phpName="Permission" type="CHAR" sqlType="enum('FALSE','TRUE')" required="true" defaultValue="FALSE"/>
        <column name="ucfg_cat" phpName="Cat" type="VARCHAR" size="20" required="true"/>

        <foreign-key foreignTable="user_usr">
            <reference local="ucfg_per_id" foreign="usr_per_ID"/>
        </foreign-key>

        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="user_settings" idMethod="native" phpName="UserSetting">
        <column name="user_id" phpName="UserId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" required="true"/>
        <column name="setting_name" phpName="Name" type="VARCHAR" size="50" primaryKey="true" required="true"/>
        <column name="setting_value" phpName="Value" type="VARCHAR" size="50" />

        <foreign-key foreignTable="user_usr">
            <reference local="user_id" foreign="usr_per_ID"/>
        </foreign-key>

        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="volunteeropportunity_vol" idMethod="native" phpName="VolunteerOpportunity" description="This contains the names and descriptions of volunteer opportunities">
        <column name="vol_ID" phpName="Id" type="INTEGER" size="3" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="vol_Order" phpName="Order" type="INTEGER" size="3" required="true" defaultValue="0"/>
        <column name="vol_Active" phpName="Active" type="CHAR" sqlType="enum('true','false')" required="true" defaultValue="true"/>
        <column name="vol_Name" phpName="Name" type="VARCHAR" size="30"/>
        <column name="vol_Description" phpName="Description" type="VARCHAR" size="100"/>
        <unique name="vol_ID">
            <unique-column name="vol_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="queryparameters_qrp" idMethod="native" phpName="QueryParameters" description="defines the parameters for each query">
        <column name="qrp_ID" phpName="Id" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="qrp_qry_ID" phpName="QryId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true" defaultValue="0"/>
        <column name="qrp_Type" phpName="Type" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="0"/>
        <column name="qrp_OptionSQL" phpName="OptionSQL" type="LONGVARCHAR"/>
        <column name="qrp_Name" phpName="Name" type="VARCHAR" size="25"/>
        <column name="qrp_Description" phpName="Description" type="LONGVARCHAR"/>
        <column name="qrp_Alias" phpName="Alias" type="VARCHAR" size="25"/>
        <column name="qrp_Default" phpName="Default" type="VARCHAR" size="25"/>
        <column name="qrp_Required" phpName="Required" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="0"/>
        <column name="qrp_InputBoxSize" phpName="InputBoxSize" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="0"/>
        <column name="qrp_Validation" phpName="Validation" type="VARCHAR" size="5" required="true" defaultValue=""/>
        <column name="qrp_NumericMax" phpName="NumericMax" type="INTEGER"/>
        <column name="qrp_NumericMin" phpName="NumericMin" type="INTEGER"/>
        <column name="qrp_AlphaMinLength" phpName="AlphaMinLength" type="INTEGER"/>
        <column name="qrp_AlphaMaxLength" phpName="AlphaMaxLength" type="INTEGER"/>
        <index name="qrp_ID_2">
            <index-column name="qrp_ID"/>
        </index>
        <index name="qrp_qry_ID">
            <index-column name="qrp_qry_ID"/>
        </index>
        <unique name="qrp_ID">
            <unique-column name="qrp_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

     <table name="kioskdevice_kdev" idMethod="native" phpName="KioskDevice" description="This contains a list of all (un)registered kiosk devices">
      <column name="kdev_ID" phpName="Id" type="INTEGER" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
      <column name="kdev_GUIDHash" phpName="GUIDHash" type="VARCHAR" size="36" description="SHA256 Hash of the GUID stored in the kiosk's cookie"/>
      <column name="kdev_Name" phpName="Name" type="VARCHAR" size="50" description="Name of the kiosk" />
      <column name="kdev_deviceType" phpName="DeviceType" type="LONGVARCHAR" description="Kiosk device type" />
      <column name="kdev_lastHeartbeat" phpName="LastHeartbeat" type="LONGVARCHAR" description="Last time the kiosk sent a heartbeat" />
      <column name="kdev_Accepted" phpName="Accepted" type="BOOLEAN" description="Has the admin accepted the kiosk after initial registration?" />
      <column name="kdev_PendingCommands" phpName="PendingCommands" type="LONGVARCHAR" description="Commands waiting to be sent to the kiosk" />
      <index name="kdev_ID">
        <index-column name="kdev_ID"/>
      </index>
     </table>

    <table name="kioskassginment_kasm" idMethod="native" phpName="KioskAssignment">
      <column name="kasm_ID" phpName="Id" type="INTEGER" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
      <column name="kasm_kdevId" phpName="KioskId" type="INTEGER" size="9" />
      <column name="kasm_AssignmentType" phpName="AssignmentType" type="INTEGER" size="9" description="The kiosk's current role."/>
      <column name="kasm_EventId" phpName="EventId" type="INTEGER" size="9" description="Optional.  If the current role is for event check-in, populate this value" />
      <index name="kasm_ID">
        <index-column name="kasm_ID"/>
      </index>

      <foreign-key foreignTable="kioskdevice_kdev">
        <reference local="kasm_kdevId" foreign="kdev_ID"/>
      </foreign-key>

      <foreign-key foreignTable="events_event">
        <reference local="kasm_EventId" foreign="event_id"/>
      </foreign-key>
     </table>

    <table name="tokens" idMethod="native" phpName="Token">
        <column name="token" phpName="Token" type="VARCHAR" primaryKey="true" required="true"/>
        <column name="type" phpName="Type" type="VARCHAR" required="true"/>
        <column name="valid_until_date" phpName="ValidUntilDate" type="DATE"/>
        <column name="reference_id" phpName="ReferenceId" type="INTEGER" defaultValue=""/>
        <column name="remainingUses" phpName="RemainingUses" type="INTEGER" defaultValue="0"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="record2property_r2p" idMethod="native" phpName="RecordProperty" isCrossRef="true" description="This table indicates which persons, families, or groups are assigned specific properties and what the values of those properties are.">
        <column name="r2p_pro_ID" phpName="PropertyId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>
        <column name="r2p_record_ID" phpName="RecordId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>
        <column name="r2p_Value" phpName="PropertyValue" type="LONGVARCHAR" required="true" />

        <foreign-key foreignTable="property_pro" description="This contains the definition of all person, family, and group properties">
            <reference local="r2p_pro_ID" foreign="pro_ID"/>
        </foreign-key>

        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="property_pro" idMethod="native" phpName="Property" >
        <column name="pro_ID" phpName="ProId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" primaryKey="true"
        autoIncrement="true" required="true"/>
        <column name="pro_Class" phpName="ProClass" type="VARCHAR" size="10" required="true" defaultValue=""/>
        <column name="pro_prt_ID" phpName="ProPrtId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true" defaultValue="0"/>
        <column name="pro_Name" phpName="ProName" type="VARCHAR" size="200" required="true" defaultValue="0"/>
        <column name="pro_Description" phpName="ProDescription" type="LONGVARCHAR" required="true"/>
        <column name="pro_Prompt" phpName="ProPrompt" type="VARCHAR" size="255"/>
        <foreign-key foreignTable="propertytype_prt">
            <reference local="pro_prt_ID" foreign="prt_ID"/>
        </foreign-key>
        <index name="pro_ID_2">
            <index-column name="pro_ID"/>
        </index>
        <unique name="pro_ID">
            <unique-column name="pro_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="propertytype_prt" idMethod="native" phpName="PropertyType" description="This contains all the defined property types">
        <column name="prt_ID" phpName="PrtId" type="SMALLINT" size="9" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="prt_Class" phpName="PrtClass" type="VARCHAR" size="10" required="true" defaultValue=""/>
        <column name="prt_Name" phpName="PrtName" type="VARCHAR" size="50" required="true" defaultValue=""/>
        <column name="prt_Description" phpName="PrtDescription" type="LONGVARCHAR" required="true"/>
        <index name="prt_ID_2">
            <index-column name="prt_ID"/>
        </index>
        <unique name="prt_ID">
            <unique-column name="prt_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="person2volunteeropp_p2vo" idMethod="native" phpName="PersonVolunteerOpportunity" description="This table indicates which people are tied to which volunteer opportunities">
        <column name="p2vo_ID" phpName="Id" type="SMALLINT" size="9" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="p2vo_per_ID" phpName="PersonId" type="SMALLINT" size="9"/>
        <column name="p2vo_vol_ID" phpName="VolunteerOpportunityId" type="SMALLINT" size="9"/>
        <unique name="p2vo_ID">
            <unique-column name="p2vo_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="event_audience" idMethod="native" phpName="EventAudience" isCrossRef="true" description="This is a join-table to link an event with a prospective audience for the purpose of advertising / outreach">
        <column name="event_id" phpName="EventId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>
        <column name="group_id" phpName="GroupId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>

        <foreign-key foreignTable="events_event">
          <reference local="event_id" foreign="event_id"/>
        </foreign-key>
        <foreign-key foreignTable="group_grp">
          <reference local="group_id" foreign="grp_ID"/>
        </foreign-key>

        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="locations" idMethod="native" phpName="Location"  description="This is a table for storing all physical locations (Church Offices, Events, etc) ">
        <column name="location_id" phpName="LocationId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>
        <column name="location_typeID" phpName="LocationType" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"/>
        <column name="location_name" type="VARCHAR" size="256" required="true" defaultValue="" description="Location Name (e.g 'Main Campus')"/>
        <column name="location_address" type="VARCHAR" size="45" required="true" defaultValue="" />
        <column name="location_city" type="VARCHAR" size="45" required="true" defaultValue="" />
        <column name="location_state" type="VARCHAR" size="45" required="true" defaultValue=""/>
        <column name="location_zip" type="VARCHAR" size="45" required="true" defaultValue=""/>
        <column name="location_country" type="VARCHAR" size="45" required="true" defaultValue=""/>
        <column name="location_phone" type="VARCHAR" size="45" required="true" defaultValue=""/>
        <column name="location_email" type="VARCHAR" size="45" required="true" defaultValue=""/>
        <column name="location_timzezone" type="VARCHAR" size="45" required="true" defaultValue="" />

        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="calendars" idMethod="native" phpName="Calendar"  description="">
      <column name="calendar_id" phpName="Id" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" autoIncrement="true" required="true"  primaryKey="true"/>
      <column name="name" phpName="Name" type="VARCHAR" size="99" required="true"/>
      <column name="accesstoken" phpName="AccessToken" type="VARCHAR" size="255"/>
      <column name="backgroundColor" phpName="BackgroundColor" type="VARCHAR" size="6"/>
      <column name="foregroundColor" phpName="ForegroundColor" type="VARCHAR" size="6"/>

      <unique name="accesstoken">
        <unique-column name="accesstoken"/>
      </unique>

      <vendor type="mysql">
          <parameter name="Engine" value="InnoDB"/>
      </vendor>
    </table>

    <table name="calendar_events" idMethod="native" phpName="CalendarEvent" isCrossRef="true" description="This is a join-table to link an event with a calendar">
      <column name="calendar_id" phpName="CalendarId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>
      <column name="event_id" phpName="EventId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true"  primaryKey="true"/>

      <foreign-key foreignTable="calendars">
        <reference local="calendar_id" foreign="calendar_id"/>
      </foreign-key>
      <foreign-key foreignTable="events_event">
        <reference local="event_id" foreign="event_id"/>
      </foreign-key>

      <vendor type="mysql">
          <parameter name="Engine" value="InnoDB"/>
      </vendor>
    </table>

    <table name="query_qry" idMethod="native" phpName="PredefinedReports" description="This contains all the predefined queries that appear in the queries page">
        <column name="qry_ID" phpName="QryId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="qry_SQL" phpName="QrySql" type="LONGVARCHAR" required="true"/>
        <column name="qry_Name" phpName="QryName" type="VARCHAR" size="255" required="true" defaultValue=""/>
        <column name="qry_Description" phpName="QryDescription" type="LONGVARCHAR" required="true"/>
        <column name="qry_Count" phpName="QryCount" type="BOOLEAN" size="1" sqlType="tinyint(1) unsigned" required="true" defaultValue="false"/>
        <index name="qry_ID_2">
            <index-column name="qry_ID"/>
        </index>
        <unique name="qry_ID">
            <unique-column name="qry_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <table name="queryparameteroptions_qpo" idMethod="native" phpName="QueryParameterOptions" description="Defines the values for the parameters for each query">
        <column name="qpo_ID" phpName="QpoId" type="SMALLINT" size="5" sqlType="smallint(5) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="qpo_qrp_ID" phpName="QpoQrpId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true" defaultValue="0"/>
        <column name="qpo_Display" phpName="QpoDisplay" type="VARCHAR" size="50" required="true" defaultValue=""/>
        <column name="qpo_Value" phpName="QpoValue" type="VARCHAR" size="50" required="true" defaultValue=""/>
        <unique name="qpo_ID">
            <unique-column name="qpo_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <!--
 <table name="multibuy_mb" idMethod="native" phpName="MultibuyMb" >
   <column name="mb_ID" phpName="MbId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
   <column name="mb_per_ID" phpName="MbPerId" type="SMALLINT" size="9" required="true" defaultValue="0"/>
   <column name="mb_item_ID" phpName="MbItemId" type="SMALLINT" size="9" required="true" defaultValue="0"/>
   <column name="mb_count" phpName="MbCount" type="DECIMAL" size="8" scale="0"/>
   <unique name="mb_ID">
     <unique-column name="mb_ID"/>
   </unique>
   <vendor type="mysql">
     <parameter name="Engine" value="InnoDB"/>
   </vendor>
 </table>
 -->

    <table name="paddlenum_pn" idMethod="native" phpName="PaddlenumPn" >
        <column name="pn_ID" phpName="PnId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="pn_fr_ID" phpName="PnFrId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned"/>
        <column name="pn_Num" phpName="PnNum" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned"/>
        <column name="pn_per_ID" phpName="PnPerId" type="SMALLINT" size="9" required="true" defaultValue="0"/>
        <unique name="pn_ID">
            <unique-column name="pn_ID"/>
        </unique>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>

    <!--
 <table name="queryparameteroptions_qpo" idMethod="native" phpName="QueryparameteroptionsQpo" description="Defines the values for the parameters for each query">
   <column name="qpo_ID" phpName="QpoId" type="SMALLINT" size="5" sqlType="smallint(5) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
   <column name="qpo_qrp_ID" phpName="QpoQrpId" type="SMALLINT" size="8" sqlType="mediumint(8) unsigned" required="true" defaultValue="0"/>
   <column name="qpo_Display" phpName="QpoDisplay" type="VARCHAR" size="50" required="true" defaultValue=""/>
   <column name="qpo_Value" phpName="QpoValue" type="VARCHAR" size="50" required="true" defaultValue=""/>
   <unique name="qpo_ID">
     <unique-column name="qpo_ID"/>
   </unique>
   <vendor type="mysql">
     <parameter name="Engine" value="InnoDB"/>
   </vendor>
 </table>

 <table name="result_res" idMethod="native" phpName="ResultRes" description="contains the results of authorizations from electronic payments">
   <column name="res_ID" phpName="ResId" type="SMALLINT" size="9" primaryKey="true" autoIncrement="true" required="true"/>
   <column name="res_echotype1" phpName="ResEchotype1" type="LONGVARCHAR" required="true"/>
   <column name="res_echotype2" phpName="ResEchotype2" type="LONGVARCHAR" required="true"/>
   <column name="res_echotype3" phpName="ResEchotype3" type="LONGVARCHAR" required="true"/>
   <column name="res_authorization" phpName="ResAuthorization" type="LONGVARCHAR" required="true"/>
   <column name="res_order_number" phpName="ResOrderNumber" type="LONGVARCHAR" required="true"/>
   <column name="res_reference" phpName="ResReference" type="LONGVARCHAR" required="true"/>
   <column name="res_status" phpName="ResStatus" type="LONGVARCHAR" required="true"/>
   <column name="res_avs_result" phpName="ResAvsResult" type="LONGVARCHAR" required="true"/>
   <column name="res_security_result" phpName="ResSecurityResult" type="LONGVARCHAR" required="true"/>
   <column name="res_mac" phpName="ResMac" type="LONGVARCHAR" required="true"/>
   <column name="res_decline_code" phpName="ResDeclineCode" type="LONGVARCHAR" required="true"/>
   <column name="res_tran_date" phpName="ResTranDate" type="LONGVARCHAR" required="true"/>
   <column name="res_merchant_name" phpName="ResMerchantName" type="LONGVARCHAR" required="true"/>
   <column name="res_version" phpName="ResVersion" type="LONGVARCHAR" required="true"/>
   <column name="res_EchoServer" phpName="ResEchoserver" type="LONGVARCHAR" required="true"/>
   <vendor type="mysql">
     <parameter name="Engine" value="InnoDB"/>
   </vendor>
 </table>
 -->

</database>
