CRM-14181, more clean and fixes to support callback
[civicrm-core.git] / xml / schema / Contact / GroupContact.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Contact</base>
5 <class>GroupContact</class>
6 <name>civicrm_group_contact</name>
7 <comment>Join table sets membership for 'static' groups. Also used to store 'opt-out' entries for 'query' type groups (status = 'OUT')</comment>
8 <add>1.1</add>
9 <log>true</log>
10 <field>
11 <name>id</name>
12 <type>int unsigned</type>
13 <title>Group Contact ID</title>
14 <required>true</required>
15 <comment>primary key</comment>
16 <add>1.1</add>
17 </field>
18 <primaryKey>
19 <name>id</name>
20 <autoincrement>true</autoincrement>
21 </primaryKey>
22 <field>
23 <name>group_id</name>
24 <type>int unsigned</type>
25 <title>Group ID</title>
26 <required>true</required>
27 <comment>FK to civicrm_group</comment>
28 <add>1.1</add>
29 <pseudoconstant>
30 <table>civicrm_group</table>
31 <keyColumn>id</keyColumn>
32 <labelColumn>title</labelColumn>
33 </pseudoconstant>
34 <html>
35 <type>Select</type>
36 </html>
37 </field>
38 <foreignKey>
39 <name>group_id</name>
40 <table>civicrm_group</table>
41 <key>id</key>
42 <add>1.1</add>
43 <onDelete>CASCADE</onDelete>
44 </foreignKey>
45 <field>
46 <name>contact_id</name>
47 <type>int unsigned</type>
48 <title>Contact ID</title>
49 <required>true</required>
50 <comment>FK to civicrm_contact</comment>
51 <add>1.1</add>
52 </field>
53 <foreignKey>
54 <name>contact_id</name>
55 <table>civicrm_contact</table>
56 <key>id</key>
57 <add>1.1</add>
58 <onDelete>CASCADE</onDelete>
59 </foreignKey>
60 <field>
61 <name>status</name>
62 <type>varchar</type>
63 <length>8</length>
64 <title>Group Contact Status</title>
65 <comment>status of contact relative to membership in group</comment>
66 <pseudoconstant>
67 <callback>CRM_Core_SelectValues::groupContactStatus</callback>
68 </pseudoconstant>
69 <add>1.1</add>
70 <html>
71 <type>Select</type>
72 </html>
73 </field>
74 <field>
75 <name>location_id</name>
76 <type>int unsigned</type>
77 <title>Group Contact Location</title>
78 <comment>Optional location to associate with this membership</comment>
79 <add>1.1</add>
80 </field>
81 <foreignKey>
82 <name>location_id</name>
83 <table>civicrm_loc_block</table>
84 <key>id</key>
85 <add>1.1</add>
86 <onDelete>SET NULL</onDelete>
87 </foreignKey>
88 <field>
89 <name>email_id</name>
90 <type>int unsigned</type>
91 <title>Group Contact Email</title>
92 <comment>Optional email to associate with this membership</comment>
93 <add>1.1</add>
94 </field>
95 <foreignKey>
96 <name>email_id</name>
97 <table>civicrm_email</table>
98 <key>id</key>
99 <add>1.1</add>
100 </foreignKey>
101 <index>
102 <name>UI_contact_group</name>
103 <fieldName>contact_id</fieldName>
104 <fieldName>group_id</fieldName>
105 <unique>true</unique>
106 <add>1.6</add>
107 </index>
108 </table>