<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
  <base>CRM/Activity</base>
  <class>Activity</class>
  <name>civicrm_activity</name>
  <description>Past or future actions concerning one or more contacts.</description>
  <comment>Other Activity details stored here include contact, location, details.</comment>
  <add>1.1</add>
  <log>true</log>
  <icon>fa-tasks</icon>
  <labelField>subject</labelField>
  <paths>
    <add>civicrm/activity?reset=1&amp;action=add&amp;context=standalone</add>
    <view>civicrm/activity?reset=1&amp;action=view&amp;id=[id]</view>
    <update>civicrm/activity/add?reset=1&amp;action=update&amp;id=[id]</update>
    <delete>civicrm/activity?reset=1&amp;action=delete&amp;id=[id]</delete>
  </paths>
  <field>
    <name>id</name>
    <uniqueName>activity_id</uniqueName>
    <title>Activity ID</title>
    <import>true</import>
    <type>int unsigned</type>
    <required>true</required>
    <comment>Unique  Other Activity ID</comment>
    <html>
      <type>Number</type>
    </html>
    <add>1.1</add>
  </field>
  <primaryKey>
    <name>id</name>
    <autoincrement>true</autoincrement>
  </primaryKey>
  <field>
    <name>source_record_id</name>
    <type>int unsigned</type>
    <title>Source Record</title>
    <comment>Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Entity table is discovered by filtering by the appropriate activity_type_id.</comment>
    <readonly>true</readonly>
    <add>2.0</add>
  </field>
  <index>
    <name>UI_source_record_id</name>
    <fieldName>source_record_id</fieldName>
    <add>3.2</add>
  </index>
  <field>
    <name>activity_type_id</name>
    <title>Activity Type ID</title>
    <import>true</import>
    <type>int unsigned</type>
    <required>true</required>
    <export>true</export>
    <default>1</default>
    <headerPattern>/(activity.)?type(.id$)/i</headerPattern>
    <comment>FK to civicrm_option_value.id, that has to be valid, registered activity type.</comment>
    <add>1.1</add>
    <pseudoconstant>
      <optionGroupName>activity_type</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
      <label>Activity Type</label>
    </html>
  </field>
  <index>
    <name>UI_activity_type_id</name>
    <fieldName>activity_type_id</fieldName>
    <add>1.6</add>
  </index>
  <field>
    <name>subject</name>
    <uniqueName>activity_subject</uniqueName>
    <type>varchar</type>
    <title>Subject</title>
    <length>255</length>
    <comment>The subject/purpose/short description of the activity.</comment>
    <import>true</import>
    <headerPattern>/(activity.)?subject/i</headerPattern>
    <html>
      <type>Text</type>
    </html>
    <add>1.1</add>
    <change>2.0</change>
  </field>
  <field>
    <name>activity_date_time</name>
    <import>true</import>
    <required>false</required>
    <export>true</export>
    <default>CURRENT_TIMESTAMP</default>
    <title>Activity Date</title>
    <type>datetime</type>
    <headerPattern>/(activity.)?date(.time$)?/i</headerPattern>
    <comment>Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.</comment>
    <html>
      <type>Select Date</type>
      <formatType>activityDateTime</formatType>
    </html>
    <add>2.0</add>
  </field>
  <index>
    <name>index_activity_date_time</name>
    <fieldName>activity_date_time</fieldName>
    <add>4.7</add>
  </index>
  <field>
    <name>duration</name>
    <uniqueName>activity_duration</uniqueName>
    <title>Duration</title>
    <import>true</import>
    <type>int unsigned</type>
    <headerPattern>/(activity.)?duration(s)?$/i</headerPattern>
    <comment>Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.</comment>
    <add>2.0</add>
    <html>
      <type>Number</type>
    </html>
  </field>
  <field>
    <name>location</name>
    <uniqueName>activity_location</uniqueName>
    <title>Location</title>
    <import>true</import>
    <type>varchar</type>
    <length>255</length>
    <headerPattern>/(activity.)?location$/i</headerPattern>
    <comment>Location of the activity (optional, open text).</comment>
    <html>
      <type>Text</type>
    </html>
    <add>1.1</add>
  </field>
  <field>
    <name>phone_id</name>
    <type>int unsigned</type>
    <title>Phone ID (called)</title>
    <comment>Phone ID of the number called (optional - used if an existing phone number is selected).</comment>
    <add>2.0</add>
    <deprecated>true</deprecated>
    <html>
      <type>EntityRef</type>
      <label>Phone (called)</label>
    </html>
  </field>
  <foreignKey>
    <name>phone_id</name>
    <table>civicrm_phone</table>
    <key>id</key>
    <add>2.0</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>
  <field>
    <name>phone_number</name>
    <title>Phone (called) Number</title>
    <type>varchar</type>
    <length>64</length>
    <deprecated>true</deprecated>
    <comment>Phone number in case the number does not exist in the civicrm_phone table.</comment>
    <html>
      <type>Text</type>
    </html>
    <add>2.0</add>
  </field>
  <field>
    <name>details</name>
    <uniqueName>activity_details</uniqueName>
    <title>Details</title>
    <import>true</import>
    <type>longtext</type>
    <headerPattern>/(activity.)?detail(s)?$/i</headerPattern>
    <comment>Details about the activity (agenda, notes, etc).</comment>
    <html>
      <type>RichTextEditor</type>
      <rows>8</rows>
      <cols>60</cols>
    </html>
    <add>1.1</add>
  </field>
  <field>
    <name>status_id</name>
    <uniqueName>activity_status_id</uniqueName>
    <title>Activity Status</title>
    <import>true</import>
    <export>true</export>
    <headerPattern>/(activity.)?status(.label$)?/i</headerPattern>
    <type>int unsigned</type>
    <comment>ID of the status this activity is currently in. Foreign key to civicrm_option_value.</comment>
    <add>2.0</add>
    <pseudoconstant>
      <optionGroupName>activity_status</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
  </field>
  <index>
    <name>index_status_id</name>
    <fieldName>status_id</fieldName>
    <add>4.7</add>
  </index>
  <field>
    <name>priority_id</name>
    <type>int unsigned</type>
    <title>Priority</title>
    <export>true</export>
    <import>true</import>
    <comment>ID of the priority given to this activity. Foreign key to civicrm_option_value.</comment>
    <add>2.0</add>
    <pseudoconstant>
      <optionGroupName>priority</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
  </field>
  <field>
    <name>parent_id</name>
    <title>Parent Activity ID</title>
    <type>int unsigned</type>
    <comment>Parent meeting ID (if this is a follow-up item).</comment>
    <readonly>true</readonly>
    <html>
      <label>Parent Activity</label>
    </html>
    <add>1.1</add>
  </field>
  <foreignKey>
    <name>parent_id</name>
    <table>civicrm_activity</table>
    <key>id</key>
    <add>1.1</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>
  <field>
    <name>is_test</name>
    <title>Test</title>
    <uniqueName>activity_is_test</uniqueName>
    <type>boolean</type>
    <default>0</default>
    <required>true</required>
    <import>true</import>
    <headerPattern>/(is.)?test(.activity)?/i</headerPattern>
    <add>2.0</add>
    <html>
      <type>CheckBox</type>
    </html>
  </field>
  <field>
    <name>medium_id</name>
    <uniqueName>activity_medium_id</uniqueName>
    <title>Activity Medium</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.</comment>
    <pseudoconstant>
      <optionGroupName>encounter_medium</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
    <add>2.2</add>
  </field>
  <index>
    <name>index_medium_id</name>
    <fieldName>medium_id</fieldName>
    <add>2.2</add>
    <drop>5.28</drop>
  </index>
  <field>
    <name>is_auto</name>
    <title>Auto</title>
    <type>boolean</type>
    <default>0</default>
    <required>true</required>
    <add>2.2</add>
  </field>
  <field>
    <name>relationship_id</name>
    <title>Relationship ID</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>FK to Relationship ID</comment>
    <html>
      <label>Relationship</label>
    </html>
    <deprecated>true</deprecated>
    <add>2.2</add>
  </field>
  <foreignKey>
    <name>relationship_id</name>
    <table>civicrm_relationship</table>
    <key>id</key>
    <onDelete>SET NULL</onDelete>
  </foreignKey>
  <field>
    <name>is_current_revision</name>
    <title>Is current (unused)</title>
    <type>boolean</type>
    <default>1</default>
    <comment>Unused deprecated column.</comment>
    <required>true</required>
    <deprecated>true</deprecated>
    <add>2.2</add>
  </field>
  <index>
    <name>index_is_current_revision</name>
    <fieldName>is_current_revision</fieldName>
    <add>2.2</add>
  </index>
  <field>
    <name>original_id</name>
    <type>int unsigned</type>
    <title>Original ID (unused)</title>
    <comment>Unused deprecated column.</comment>
    <deprecated>true</deprecated>
    <readonly>true</readonly>
    <html>
      <label>Original Activity</label>
    </html>
    <add>2.2</add>
  </field>
  <foreignKey>
    <name>original_id</name>
    <table>civicrm_activity</table>
    <key>id</key>
    <add>2.2</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>
  <field>
    <name>result</name>
    <uniqueName>activity_result</uniqueName>
    <type>varchar</type>
    <title>Result</title>
    <length>255</length>
    <comment>Currently being used to store result id for survey activity, FK to option value.</comment>
    <add>3.3</add>
  </field>
  <field>
    <name>is_deleted</name>
    <uniqueName>activity_is_deleted</uniqueName>
    <title>Activity is in the Trash</title>
    <type>boolean</type>
    <default>0</default>
    <required>true</required>
    <import>true</import>
    <headerPattern>/(activity.)?(trash|deleted)/i</headerPattern>
    <add>2.2</add>
    <html>
      <type>CheckBox</type>
    </html>
  </field>
  <index>
    <name>index_is_deleted</name>
    <fieldName>is_deleted</fieldName>
    <add>2.2</add>
  </index>
  <field>
    <name>campaign_id</name>
    <component>CiviCampaign</component>
    <uniqueName>activity_campaign_id</uniqueName>
    <type>int unsigned</type>
    <title>Campaign ID</title>
    <import>true</import>
    <comment>The campaign for which this activity has been triggered.</comment>
    <add>3.4</add>
    <html>
      <type>EntityRef</type>
      <label>Campaign</label>
    </html>
    <pseudoconstant>
      <table>civicrm_campaign</table>
      <keyColumn>id</keyColumn>
      <labelColumn>title</labelColumn>
      <prefetch>disabled</prefetch>
    </pseudoconstant>
  </field>
  <foreignKey>
    <name>campaign_id</name>
    <table>civicrm_campaign</table>
    <key>id</key>
    <onDelete>SET NULL</onDelete>
  </foreignKey>
  <field>
    <name>engagement_level</name>
    <uniqueName>activity_engagement_level</uniqueName>
    <type>int unsigned</type>
    <title>Engagement Index</title>
    <import>true</import>
    <comment>Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.</comment>
    <pseudoconstant>
      <optionGroupName>engagement_index</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
    <add>3.4</add>
  </field>
  <field>
    <name>weight</name>
    <title>Order</title>
    <type>int</type>
    <add>4.1</add>
  </field>
  <field>
    <name>is_star</name>
    <title>Is Starred</title>
    <type>boolean</type>
    <default>0</default>
    <required>true</required>
    <import>true</import>
    <comment>Activity marked as favorite.</comment>
    <headerPattern>/(activity.)?(star|favorite)/i</headerPattern>
    <add>4.7</add>
    <html>
      <type>Checkbox</type>
    </html>
  </field>
  <field>
    <name>created_date</name>
    <uniqueName>activity_created_date</uniqueName>
    <type>timestamp</type>
    <comment>When was the activity was created.</comment>
    <required>false</required>
    <export>true</export>
    <default>CURRENT_TIMESTAMP</default>
    <html>
      <label>Created Date</label>
      <type>Select Date</type>
    </html>
    <add>4.7</add>
  </field>
  <field>
    <name>modified_date</name>
    <uniqueName>activity_modified_date</uniqueName>
    <type>timestamp</type>
    <comment>When was the activity (or closely related entity) was created or modified or deleted.</comment>
    <required>false</required>
    <export>true</export>
    <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
    <html>
      <label>Modified Date</label>
      <type>Select Date</type>
    </html>
    <readonly>true</readonly>
    <add>4.7</add>
  </field>
</table>
