Merge pull request #23181 from civicrm/5.49
[civicrm-core.git] / xml / schema / Contact / Relationship.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Contact</base>
5 <class>Relationship</class>
6 <name>civicrm_relationship</name>
7 <comment>Relationship between any 2 types of contacts.</comment>
8 <add>1.1</add>
9 <log>true</log>
10 <icon>fa-handshake-o</icon>
11 <paths>
12 <view>civicrm/contact/view/rel?action=view&amp;reset=1&amp;cid=[contact_id_a]&amp;id=[id]</view>
13 <delete>civicrm/contact/view/rel?action=delete&amp;reset=1&amp;cid=[contact_id_a]&amp;id=[id]</delete>
14 </paths>
15
16 <field>
17 <name>id</name>
18 <type>int unsigned</type>
19 <title>Relationship ID</title>
20 <required>true</required>
21 <comment>Relationship ID</comment>
22 <html>
23 <type>Number</type>
24 </html>
25 <add>1.1</add>
26 </field>
27 <primaryKey>
28 <name>id</name>
29 <autoincrement>true</autoincrement>
30 </primaryKey>
31 <field>
32 <name>contact_id_a</name>
33 <type>int unsigned</type>
34 <title>Contact A ID</title>
35 <required>true</required>
36 <comment>id of the first contact</comment>
37 <html>
38 <label>Contact A</label>
39 </html>
40 <add>1.1</add>
41 </field>
42 <foreignKey>
43 <name>contact_id_a</name>
44 <table>civicrm_contact</table>
45 <key>id</key>
46 <add>1.1</add>
47 <onDelete>CASCADE</onDelete>
48 </foreignKey>
49 <field>
50 <name>contact_id_b</name>
51 <type>int unsigned</type>
52 <title>Contact B ID</title>
53 <required>true</required>
54 <comment>id of the second contact</comment>
55 <add>1.1</add>
56 <html>
57 <type>EntityRef</type>
58 <label>Contact B</label>
59 </html>
60 </field>
61 <foreignKey>
62 <name>contact_id_b</name>
63 <table>civicrm_contact</table>
64 <key>id</key>
65 <add>1.1</add>
66 <onDelete>CASCADE</onDelete>
67 </foreignKey>
68 <field>
69 <name>relationship_type_id</name>
70 <type>int unsigned</type>
71 <title>Relationship Type ID</title>
72 <required>true</required>
73 <comment>Type of relationship</comment>
74 <add>1.1</add>
75 <html>
76 <type>Select</type>
77 <label>Relationship Type</label>
78 </html>
79 <pseudoconstant>
80 <table>civicrm_relationship_type</table>
81 <keyColumn>id</keyColumn>
82 <nameColumn>name_a_b</nameColumn>
83 <labelColumn>label_a_b</labelColumn>
84 </pseudoconstant>
85 </field>
86 <foreignKey>
87 <name>relationship_type_id</name>
88 <table>civicrm_relationship_type</table>
89 <key>id</key>
90 <add>1.1</add>
91 <onDelete>CASCADE</onDelete>
92 </foreignKey>
93 <field>
94 <name>start_date</name>
95 <uniqueName>relationship_start_date</uniqueName>
96 <type>date</type>
97 <title>Relationship Start Date</title>
98 <comment>date when the relationship started</comment>
99 <add>1.1</add>
100 <html>
101 <type>Select Date</type>
102 <formatType>activityDate</formatType>
103 </html>
104 </field>
105 <field>
106 <name>end_date</name>
107 <uniqueName>relationship_end_date</uniqueName>
108 <type>date</type>
109 <title>Relationship End Date</title>
110 <comment>date when the relationship ended</comment>
111 <add>1.1</add>
112 <html>
113 <type>Select Date</type>
114 <formatType>activityDate</formatType>
115 </html>
116 </field>
117 <field>
118 <name>is_active</name>
119 <type>boolean</type>
120 <title>Relationship Is Active</title>
121 <default>1</default>
122 <required>true</required>
123 <comment>is the relationship active ?</comment>
124 <add>1.1</add>
125 <html>
126 <type>CheckBox</type>
127 </html>
128 </field>
129 <field>
130 <name>description</name>
131 <type>varchar</type>
132 <title>Relationship Description</title>
133 <length>255</length>
134 <comment>Optional verbose description for the relationship.</comment>
135 <add>1.5</add>
136 <html>
137 <type>Text</type>
138 </html>
139 </field>
140 <field>
141 <name>is_permission_a_b</name>
142 <type>int unsigned</type>
143 <title>Contact A has Permission Over Contact B</title>
144 <required>true</required>
145 <default>0</default>
146 <comment>Permission that Contact A has to view/update Contact B</comment>
147 <add>2.1</add>
148 <pseudoconstant>
149 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
150 </pseudoconstant>
151 <html>
152 <type>Radio</type>
153 </html>
154 </field>
155 <field>
156 <name>is_permission_b_a</name>
157 <type>int unsigned</type>
158 <title>Contact B has Permission Over Contact A</title>
159 <required>true</required>
160 <default>0</default>
161 <comment>Permission that Contact B has to view/update Contact A</comment>
162 <add>2.1</add>
163 <pseudoconstant>
164 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
165 </pseudoconstant>
166 <html>
167 <type>Radio</type>
168 </html>
169 </field>
170 <field>
171 <name>case_id</name>
172 <type>int unsigned</type>
173 <component>CiviCase</component>
174 <title>Case ID</title>
175 <default>NULL</default>
176 <comment>FK to civicrm_case</comment>
177 <html>
178 <label>Case</label>
179 </html>
180 <add>2.2</add>
181 </field>
182 <field>
183 <name>created_date</name>
184 <type>timestamp</type>
185 <comment>Relationship created date.</comment>
186 <required>true</required>
187 <default>CURRENT_TIMESTAMP</default>
188 <add>5.47</add>
189 </field>
190 <field>
191 <name>modified_date</name>
192 <title>Relationship Modified Date</title>
193 <type>timestamp</type>
194 <required>true</required>
195 <comment>Relationship last modified.</comment>
196 <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
197 <add>5.47</add>
198 <readonly>true</readonly>
199 </field>
200 <foreignKey>
201 <name>case_id</name>
202 <table>civicrm_case</table>
203 <key>id</key>
204 <add>2.2</add>
205 <onDelete>CASCADE</onDelete>
206 </foreignKey>
207 </table>