Add html tag to all files in xml/schema
[civicrm-core.git] / xml / schema / Contact / RelationshipCache.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Contact</base>
5 <class>RelationshipCache</class>
6 <name>civicrm_relationship_cache</name>
7 <comment>The cache permutes information from the relationship table to facilitate querying. Every relationship is mapped to multiple records in the cache. Joins should begin on the near side and extract info from the far side.</comment>
8 <add>5.29</add>
9 <log>false</log>
10 <icon>fa-handshake-o</icon>
11 <title>Related Contact</title>
12 <field>
13 <name>id</name>
14 <type>int unsigned</type>
15 <title>Relationship Cache ID</title>
16 <required>true</required>
17 <comment>Relationship Cache ID</comment>
18 <html>
19 <type>Number</type>
20 </html>
21 <add>5.29</add>
22 </field>
23 <primaryKey>
24 <name>id</name>
25 <autoincrement>true</autoincrement>
26 </primaryKey>
27
28 <field>
29 <name>relationship_id</name>
30 <type>int unsigned</type>
31 <title>Relationship</title>
32 <required>true</required>
33 <comment>id of the relationship (FK to civicrm_relationship.id)</comment>
34 <add>5.29</add>
35 </field>
36 <foreignKey>
37 <name>relationship_id</name>
38 <table>civicrm_relationship</table>
39 <key>id</key>
40 <add>5.29</add>
41 <onDelete>CASCADE</onDelete>
42 </foreignKey>
43
44 <field>
45 <name>relationship_type_id</name>
46 <type>int unsigned</type>
47 <title>Relationship Type</title>
48 <required>true</required>
49 <comment>id of the relationship type</comment>
50 <add>5.29</add>
51 </field>
52 <foreignKey>
53 <name>relationship_type_id</name>
54 <table>civicrm_relationship_type</table>
55 <key>id</key>
56 <add>5.29</add>
57 <onDelete>CASCADE</onDelete>
58 </foreignKey>
59
60 <field>
61 <name>orientation</name>
62 <type>char</type>
63 <length>3</length>
64 <title>Orientation (a_b or b_a)</title>
65 <required>true</required>
66 <pseudoconstant>
67 <callback>CRM_Core_SelectValues::relationshipOrientation</callback>
68 </pseudoconstant>
69 <comment>The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.</comment>
70 <add>5.29</add>
71 </field>
72
73 <field>
74 <name>near_contact_id</name>
75 <type>int unsigned</type>
76 <title>Contact ID (Near side)</title>
77 <required>true</required>
78 <comment>id of the first contact</comment>
79 <add>5.29</add>
80 <html>
81 <type>EntityRef</type>
82 </html>
83 </field>
84 <foreignKey>
85 <name>near_contact_id</name>
86 <table>civicrm_contact</table>
87 <key>id</key>
88 <add>5.29</add>
89 <onDelete>CASCADE</onDelete>
90 </foreignKey>
91
92 <field>
93 <name>near_relation</name>
94 <type>varchar</type>
95 <title>Relationship Name (to related contact)</title>
96 <length>64</length>
97 <comment>name for relationship of near_contact to far_contact.</comment>
98 <add>5.29</add>
99 <html>
100 <label>Relationship to contact</label>
101 </html>
102 <pseudoconstant>
103 <callback>CRM_Core_PseudoConstant::relationshipTypeOptions</callback>
104 </pseudoconstant>
105 </field>
106
107 <field>
108 <name>far_contact_id</name>
109 <type>int unsigned</type>
110 <title>Contact ID (Far side)</title>
111 <required>true</required>
112 <comment>id of the second contact</comment>
113 <add>5.29</add>
114 <html>
115 <type>EntityRef</type>
116 </html>
117 </field>
118 <foreignKey>
119 <name>far_contact_id</name>
120 <table>civicrm_contact</table>
121 <key>id</key>
122 <add>5.29</add>
123 <onDelete>CASCADE</onDelete>
124 </foreignKey>
125
126 <field>
127 <name>far_relation</name>
128 <type>varchar</type>
129 <title>Relationship Name (from related contact)</title>
130 <length>64</length>
131 <comment>name for relationship of far_contact to near_contact.</comment>
132 <add>5.29</add>
133 <html>
134 <label>Relationship from contact</label>
135 </html>
136 <pseudoconstant>
137 <callback>CRM_Core_PseudoConstant::relationshipTypeOptions</callback>
138 </pseudoconstant>
139 </field>
140
141 <index>
142 <name>UI_relationship</name>
143 <fieldName>relationship_id</fieldName>
144 <fieldName>orientation</fieldName>
145 <unique>true</unique>
146 <add>5.29</add>
147 </index>
148 <index>
149 <!-- Ex: select ... from contact inner join relcache on contact.id=relcache.near_contact_id and near_relation = 'Parent of' -->
150 <name>index_nearid_nearrelation</name>
151 <fieldName>near_contact_id</fieldName>
152 <fieldName>near_relation</fieldName>
153 <add>5.29</add>
154 </index>
155 <index>
156 <!-- Ex: select ... from contact inner join relcache on contact.id=relcache.near_contact_id and far_relation = 'Child of' -->
157 <name>index_nearid_farrelation</name>
158 <fieldName>near_contact_id</fieldName>
159 <fieldName>far_relation</fieldName>
160 <add>5.29</add>
161 </index>
162 <index>
163 <!-- Ex: select relation, count(*) from relcache group by near_relation -->
164 <name>index_near_relation</name>
165 <fieldName>near_relation</fieldName>
166 <add>5.29</add>
167 </index>
168
169 <!-- Passive mirror fields -->
170
171 <field>
172 <name>is_active</name>
173 <type>boolean</type>
174 <title>Relationship Is Active</title>
175 <default>1</default>
176 <comment>is the relationship active ?</comment>
177 <add>5.29</add>
178 <html>
179 <type>CheckBox</type>
180 </html>
181 </field>
182 <field>
183 <name>start_date</name>
184 <uniqueName>relationship_start_date</uniqueName>
185 <type>date</type>
186 <title>Relationship Start Date</title>
187 <comment>date when the relationship started</comment>
188 <add>5.29</add>
189 <html>
190 <type>Select Date</type>
191 <formatType>activityDate</formatType>
192 </html>
193 </field>
194 <field>
195 <name>end_date</name>
196 <uniqueName>relationship_end_date</uniqueName>
197 <type>date</type>
198 <title>Relationship End Date</title>
199 <comment>date when the relationship ended</comment>
200 <add>5.29</add>
201 <html>
202 <type>Select Date</type>
203 <formatType>activityDate</formatType>
204 </html>
205 </field>
206 </table>