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

<table>
  <base>CRM/Mailing</base>
  <class>MailingGroup</class>
  <name>civicrm_mailing_group</name>
  <comment>Stores information about the groups that participate in this mailing..</comment>
  <archive>true</archive>
  <component>CiviMail</component>
  <field>
    <name>id</name>
    <title>Mailing Group ID</title>
    <type>int unsigned</type>
    <required>true</required>
    <html>
      <type>Number</type>
    </html>
  </field>
  <primaryKey>
    <name>id</name>
    <autoincrement>true</autoincrement>
  </primaryKey>
  <field>
    <name>mailing_id</name>
    <title>Mailing ID</title>
    <type>int unsigned</type>
    <required>true</required>
    <comment>The ID of a previous mailing to include/exclude recipients.</comment>
    <html>
      <label>Mailing</label>
    </html>
  </field>
  <foreignKey>
    <name>mailing_id</name>
    <table>civicrm_mailing</table>
    <key>id</key>
    <onDelete>CASCADE</onDelete>
  </foreignKey>
  <field>
    <name>group_type</name>
    <title>Mailing Group Type</title>
    <type>varchar</type>
    <length>8</length>
    <comment>Are the members of the group included or excluded?.</comment>
    <pseudoconstant>
      <callback>CRM_Core_SelectValues::getMailingGroupTypes</callback>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
  </field>
  <field>
    <name>entity_table</name>
    <title>Mailing Group Entity Table</title>
    <type>varchar</type>
    <length>64</length>
    <required>true</required>
    <comment>Name of table where item being referenced is stored.</comment>
    <pseudoconstant>
      <callback>CRM_Mailing_BAO_Mailing::mailingGroupEntityTables</callback>
    </pseudoconstant>
  </field>
  <field>
    <name>entity_id</name>
    <title>Mailing Group Entity</title>
    <type>int unsigned</type>
    <required>true</required>
    <comment>Foreign key to the referenced item.</comment>
  </field>
  <dynamicForeignKey>
    <idColumn>entity_id</idColumn>
    <typeColumn>entity_table</typeColumn>
  </dynamicForeignKey>
  <field>
    <name>search_id</name>
    <title>Mailing Group Search</title>
    <type>int</type>
    <comment>The filtering search. custom search id or -1 for civicrm api search</comment>
  </field>
  <field>
    <name>search_args</name>
    <title>Mailing Group Search Arguments</title>
    <type>text</type>
    <comment>The arguments to be sent to the search function</comment>
  </field>
</table>
