<?xml version="1.0" encoding="utf-8" ?>
<table>
  <base>CRM/Case</base>
  <class>CaseContact</class>
  <name>civicrm_case_contact</name>
  <comment>Joining table for case-contact associations.</comment>
  <add>2.1</add>
  <log>true</log>
  <component>CiviCase</component>
  <field>
    <name>id</name>
    <title>Case Contact ID</title>
    <type>int unsigned</type>
    <required>true</required>
    <comment>Unique case-contact association id</comment>
    <html>
      <type>Number</type>
    </html>
    <add>2.1</add>
  </field>
  <primaryKey>
    <name>id</name>
    <autoincrement>true</autoincrement>
  </primaryKey>
  <field>
    <name>case_id</name>
    <title>Case ID</title>
    <type>int unsigned</type>
    <required>true</required>
    <comment>Case ID of case-contact association.</comment>
    <html>
      <label>Case</label>
    </html>
    <add>2.1</add>
  </field>
  <foreignKey>
    <name>case_id</name>
    <table>civicrm_case</table>
    <key>id</key>
    <add>2.1</add>
    <onDelete>CASCADE</onDelete>
  </foreignKey>
  <field>
    <name>contact_id</name>
    <title>Contact ID</title>
    <type>int unsigned</type>
    <required>true</required>
    <comment>Contact ID of contact record given case belongs to.</comment>
    <html>
      <type>EntityRef</type>
      <label>Contact</label>
    </html>
    <add>2.1</add>
  </field>
  <foreignKey>
    <name>contact_id</name>
    <table>civicrm_contact</table>
    <key>id</key>
    <add>2.1</add>
    <onDelete>CASCADE</onDelete>
  </foreignKey>
  <index>
    <name>UI_case_contact_id</name>
    <fieldName>case_id</fieldName>
    <fieldName>contact_id</fieldName>
    <unique>true</unique>
    <add>2.1</add>
  </index>
</table>
