<?xml version="1.0" encoding="iso-8859-1" ?>

<table>
  <base>CRM/Core</base>
  <class>CustomField</class>
  <name>civicrm_custom_field</name>
  <comment>Stores info about an extended (custom) property (data and form field info).</comment>
  <add>1.1</add>
  <log>true</log>
  <labelField>label</labelField>
  <paths>
    <add>civicrm/admin/custom/group/field/add?reset=1&amp;action=add&amp;gid=[custom_group_id]</add>
    <update>civicrm/admin/custom/group/field/update?action=update&amp;reset=1&amp;id=[id]&amp;gid=[custom_group_id]</update>
    <preview>civicrm/admin/custom/group/preview?reset=1&amp;fid=[id]</preview>
    <delete>civicrm/admin/custom/group/field/delete?reset=1&amp;id=[id]</delete>
    <detach>civicrm/admin/custom/group/field/move?reset=1&amp;fid=[id]</detach>
  </paths>
  <field>
    <name>id</name>
    <type>int unsigned</type>
    <title>Custom Field ID</title>
    <required>true</required>
    <comment>Unique Custom Field ID</comment>
    <html>
      <type>Number</type>
    </html>
    <add>1.1</add>
  </field>
  <primaryKey>
    <name>id</name>
    <autoincrement>true</autoincrement>
  </primaryKey>
  <field>
    <name>custom_group_id</name>
    <type>int unsigned</type>
    <title>Custom Group ID</title>
    <required>true</required>
    <comment>FK to civicrm_custom_group.</comment>
    <add>1.1</add>
    <pseudoconstant>
      <table>civicrm_custom_group</table>
      <keyColumn>id</keyColumn>
      <labelColumn>title</labelColumn>
    </pseudoconstant>
    <html>
      <type>Select</type>
      <label>Custom Group</label>
    </html>
  </field>
  <foreignKey>
    <name>custom_group_id</name>
    <table>civicrm_custom_group</table>
    <key>id</key>
    <add>1.1</add>
    <onDelete>CASCADE</onDelete>
  </foreignKey>
  <field>
    <name>name</name>
    <type>varchar</type>
    <title>Custom Field Name</title>
    <length>64</length>
    <comment>Variable name/programmatic handle for this field.</comment>
    <add>3.3</add>
  </field>
  <field>
    <name>label</name>
    <type>varchar</type>
    <title>Custom Field Label</title>
    <length>255</length>
    <required>true</required>
    <localizable>true</localizable>
    <comment>Text for form field label (also friendly name for administering this custom property).</comment>
    <add>1.1</add>
    <html>
      <type>Text</type>
    </html>
  </field>
  <field>
    <name>data_type</name>
    <type>varchar</type>
    <title>Data Type</title>
    <length>16</length>
    <required>true</required>
    <comment>Controls location of data storage in extended_data table.</comment>
    <pseudoconstant>
      <callback>CRM_Core_BAO_CustomField::dataType</callback>
    </pseudoconstant>
    <add>1.1</add>
    <html>
      <type>Select</type>
      <label>Data Type</label>
    </html>
  </field>
  <field>
    <name>html_type</name>
    <type>varchar</type>
    <title>HTML Type</title>
    <length>32</length>
    <required>true</required>
    <comment>HTML types plus several built-in extended types.</comment>
    <pseudoconstant>
      <callback>CRM_Core_SelectValues::customHtmlType</callback>
    </pseudoconstant>
    <html>
      <type>Select</type>
      <label>Field Input Type</label>
    </html>
    <add>1.1</add>
  </field>
  <field>
    <name>default_value</name>
    <type>varchar</type>
    <title>Custom Field Default</title>
    <length>255</length>
    <comment>Use form_options.is_default for field_types which use options.</comment>
    <add>1.1</add>
  </field>
  <field>
    <name>is_required</name>
    <title>Custom Field Is Required?</title>
    <type>boolean</type>
    <comment>Is a value required for this property.</comment>
    <default>0</default>
    <required>true</required>
    <add>1.1</add>
  </field>
  <field>
    <name>is_searchable</name>
    <title>Allow Searching on Field?</title>
    <type>boolean</type>
    <comment>Is this property searchable.</comment>
    <default>0</default>
    <required>true</required>
    <add>1.1</add>
  </field>
  <field>
    <name>is_search_range</name>
    <type>boolean</type>
    <title>Search as a Range</title>
    <comment>Is this property range searchable.</comment>
    <add>1.4</add>
    <default>0</default>
    <required>true</required>
  </field>
  <field>
    <name>weight</name>
    <type>int</type>
    <title>Order</title>
    <required>true</required>
    <default>1</default>
    <comment>Controls field display order within an extended property group.</comment>
    <add>1.1</add>
  </field>
  <field>
    <name>help_pre</name>
    <type>text</type>
    <title>Custom Field Pre Text</title>
    <localizable>true</localizable>
    <comment>Description and/or help text to display before this field.</comment>
    <add>1.1</add>
  </field>
  <field>
    <name>help_post</name>
    <type>text</type>
    <title>Custom Field Post Text</title>
    <localizable>true</localizable>
    <comment>Description and/or help text to display after this field.</comment>
    <add>1.1</add>
  </field>
  <field>
    <name>mask</name>
    <type>varchar</type>
    <title>Custom Field Formatting</title>
    <length>64</length>
    <comment>Unused</comment>
    <add>1.1</add>
    <drop>5.59</drop>
  </field>
  <field>
    <name>attributes</name>
    <type>varchar</type>
    <title>Custom Field Attributes</title>
    <length>255</length>
    <comment>Store collection of type-appropriate attributes, e.g. textarea  needs rows/cols attributes</comment>
    <add>1.1</add>
  </field>
  <field>
    <name>javascript</name>
    <type>varchar</type>
    <title>Custom Field Javascript</title>
    <length>255</length>
    <comment>Unused</comment>
    <add>1.1</add>
    <drop>5.61</drop>
  </field>
  <field>
    <name>is_active</name>
    <type>boolean</type>
    <title>Custom Field Is Active?</title>
    <comment>Is this property active?</comment>
    <html>
      <type>CheckBox</type>
      <label>Enabled</label>
    </html>
    <default>1</default>
    <add>1.1</add>
  </field>
  <field>
    <name>is_view</name>
    <type>boolean</type>
    <title>Field is Viewable</title>
    <default>0</default>
    <required>true</required>
    <comment>Is this property set by PHP Code? A code field is viewable but not editable</comment>
    <add>1.1</add>
  </field>
  <field>
    <name>options_per_line</name>
    <type>int unsigned</type>
    <title>Field Options Per Line</title>
    <comment>number of options per line for checkbox and radio</comment>
  </field>
  <field>
    <name>text_length</name>
    <type>int unsigned</type>
    <title>Field Length</title>
    <comment>field length if alphanumeric</comment>
    <add>2.2</add>
  </field>
  <field>
    <name>start_date_years</name>
    <type>int</type>
    <title>Field Start Date</title>
    <comment>Date may be up to start_date_years years prior to the current date.</comment>
    <add>1.4</add>
  </field>
  <field>
    <name>end_date_years</name>
    <type>int</type>
    <title>Field End Date</title>
    <comment>Date may be up to end_date_years years after the current date.</comment>
    <add>1.4</add>
  </field>
  <field>
    <name>date_format</name>
    <type>varchar</type>
    <title>Field Data Format</title>
    <length>64</length>
    <comment>date format for custom date</comment>
    <add>3.1</add>
    <pseudoconstant>
      <callback>CRM_Core_SelectValues::getDatePluginInputFormats</callback>
    </pseudoconstant>
  </field>
  <field>
    <name>time_format</name>
    <type>int unsigned</type>
    <title>Field Time Format</title>
    <comment>time format for custom date</comment>
    <add>3.1</add>
    <pseudoconstant>
      <callback>CRM_Core_SelectValues::getTimeFormats</callback>
    </pseudoconstant>
  </field>
  <field>
    <name>note_columns</name>
    <type>int unsigned</type>
    <title>Field Note Columns</title>
    <comment>Number of columns in Note Field</comment>
    <add>1.4</add>
  </field>
  <field>
    <name>note_rows</name>
    <type>int unsigned</type>
    <title>Field Note Rows</title>
    <comment>Number of rows in Note Field</comment>
    <add>1.4</add>
  </field>
  <field>
    <name>column_name</name>
    <type>varchar</type>
    <title>Field Column Name</title>
    <length>255</length>
    <comment>Name of the column that holds the values for this field.</comment>
    <add>2.0</add>
  </field>
  <field>
    <name>option_group_id</name>
    <type>int unsigned</type>
    <title>Field Option Group ID</title>
    <comment>For elements with options, the option group id that is used</comment>
    <html>
      <label>Field Option Group</label>
    </html>
    <add>1.4</add>
    <pseudoconstant>
      <table>civicrm_option_group</table>
      <keyColumn>id</keyColumn>
      <labelColumn>title</labelColumn>
    </pseudoconstant>
  </field>
  <foreignKey>
    <name>option_group_id</name>
    <table>civicrm_option_group</table>
    <key>id</key>
    <add>5.6</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>
  <field>
    <name>serialize</name>
    <type>int unsigned</type>
    <title>Serialize</title>
    <length>255</length>
    <comment>Serialization method - a non-zero value indicates a multi-valued field.</comment>
    <pseudoconstant>
      <callback>CRM_Core_SelectValues::fieldSerialization</callback>
    </pseudoconstant>
    <add>5.27</add>
    <required>true</required>
    <default>0</default>
  </field>
  <field>
    <name>filter</name>
    <type>varchar</type>
    <title>Field Filter</title>
    <length>255</length>
    <comment>Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.</comment>
    <add>4.1</add>
  </field>
  <field>
    <name>in_selector</name>
    <type>boolean</type>
    <title>Field Display</title>
    <default>0</default>
    <required>true</required>
    <comment>Should the multi-record custom field values be displayed in tab table listing</comment>
    <add>4.5</add>
  </field>
  <field>
    <name>fk_entity</name>
    <type>varchar</type>
    <title>Entity</title>
    <length>255</length>
    <default>NULL</default>
    <comment>Name of entity being referenced.</comment>
    <add>5.60</add>
  </field>
  <field>
    <name>fk_entity_on_delete</name>
    <type>varchar</type>
    <title>On Referenced Entity Delete</title>
    <length>255</length>
    <default>'set_null'</default>
    <required>true</required>
    <comment>Behavior if referenced entity is deleted.</comment>
    <pseudoconstant>
      <callback>CRM_Core_BAO_CustomField::getFkEntityOnDeleteOptions</callback>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
    <add>5.71</add>
  </field>
  <index>
    <name>UI_label_custom_group_id</name>
    <fieldName>label</fieldName>
    <fieldName>custom_group_id</fieldName>
    <unique>true</unique>
    <add>1.1</add>
  </index>
  <index>
    <name>UI_name_custom_group_id</name>
    <fieldName>name</fieldName>
    <fieldName>custom_group_id</fieldName>
    <unique>true</unique>
    <add>4.3</add>
  </index>
</table>
