Merge pull request #22825 from MegaphoneJon/membership-41
[civicrm-core.git] / xml / schema / Contact / Relationship.xml
CommitLineData
6a488035
TO
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>
449c4e6b 10 <icon>fa-handshake-o</icon>
c5076889
CW
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
6a488035 16 <field>
8f069c03
EM
17 <name>id</name>
18 <type>int unsigned</type>
19 <title>Relationship ID</title>
20 <required>true</required>
21 <comment>Relationship ID</comment>
0481e12c
A
22 <html>
23 <type>Number</type>
24 </html>
8f069c03 25 <add>1.1</add>
6a488035
TO
26 </field>
27 <primaryKey>
8f069c03
EM
28 <name>id</name>
29 <autoincrement>true</autoincrement>
6a488035
TO
30 </primaryKey>
31 <field>
8f069c03
EM
32 <name>contact_id_a</name>
33 <type>int unsigned</type>
57e94608 34 <title>Contact A ID</title>
8f069c03
EM
35 <required>true</required>
36 <comment>id of the first contact</comment>
57e94608
A
37 <html>
38 <label>Contact A</label>
39 </html>
8f069c03 40 <add>1.1</add>
6a488035
TO
41 </field>
42 <foreignKey>
8f069c03
EM
43 <name>contact_id_a</name>
44 <table>civicrm_contact</table>
45 <key>id</key>
46 <add>1.1</add>
47 <onDelete>CASCADE</onDelete>
6a488035
TO
48 </foreignKey>
49 <field>
8f069c03
EM
50 <name>contact_id_b</name>
51 <type>int unsigned</type>
57e94608 52 <title>Contact B ID</title>
8f069c03
EM
53 <required>true</required>
54 <comment>id of the second contact</comment>
55 <add>1.1</add>
db3ec100
TM
56 <html>
57 <type>EntityRef</type>
57e94608 58 <label>Contact B</label>
db3ec100 59 </html>
6a488035
TO
60 </field>
61 <foreignKey>
8f069c03
EM
62 <name>contact_id_b</name>
63 <table>civicrm_contact</table>
64 <key>id</key>
65 <add>1.1</add>
66 <onDelete>CASCADE</onDelete>
6a488035
TO
67 </foreignKey>
68 <field>
8f069c03
EM
69 <name>relationship_type_id</name>
70 <type>int unsigned</type>
57e94608 71 <title>Relationship Type ID</title>
8f069c03 72 <required>true</required>
1ac9bb56 73 <comment>Type of relationship</comment>
8f069c03 74 <add>1.1</add>
db3ec100
TM
75 <html>
76 <type>Select</type>
57e94608 77 <label>Relationship Type</label>
db3ec100 78 </html>
1ac9bb56
CW
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>
6a488035
TO
85 </field>
86 <foreignKey>
8f069c03
EM
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>
6a488035
TO
92 </foreignKey>
93 <field>
8f069c03 94 <name>start_date</name>
cc1b27ee 95 <uniqueName>relationship_start_date</uniqueName>
8f069c03
EM
96 <type>date</type>
97 <title>Relationship Start Date</title>
98 <comment>date when the relationship started</comment>
99 <add>1.1</add>
db3ec100
TM
100 <html>
101 <type>Select Date</type>
425d6064 102 <formatType>activityDate</formatType>
db3ec100 103 </html>
6a488035
TO
104 </field>
105 <field>
8f069c03 106 <name>end_date</name>
cc1b27ee 107 <uniqueName>relationship_end_date</uniqueName>
8f069c03
EM
108 <type>date</type>
109 <title>Relationship End Date</title>
110 <comment>date when the relationship ended</comment>
111 <add>1.1</add>
db3ec100
TM
112 <html>
113 <type>Select Date</type>
425d6064 114 <formatType>activityDate</formatType>
db3ec100 115 </html>
6a488035
TO
116 </field>
117 <field>
8f069c03
EM
118 <name>is_active</name>
119 <type>boolean</type>
120 <title>Relationship Is Active</title>
121 <default>1</default>
122 <comment>is the relationship active ?</comment>
123 <add>1.1</add>
db3ec100
TM
124 <html>
125 <type>CheckBox</type>
126 </html>
6a488035
TO
127 </field>
128 <field>
8f069c03
EM
129 <name>description</name>
130 <type>varchar</type>
131 <title>Relationship Description</title>
132 <length>255</length>
133 <comment>Optional verbose description for the relationship.</comment>
134 <add>1.5</add>
db3ec100
TM
135 <html>
136 <type>Text</type>
137 </html>
6a488035
TO
138 </field>
139 <field>
8f069c03 140 <name>is_permission_a_b</name>
f871c3a9 141 <type>int unsigned</type>
8f069c03 142 <title>Contact A has Permission Over Contact B</title>
f871c3a9 143 <required>true</required>
8f069c03 144 <default>0</default>
f871c3a9 145 <comment>Permission that Contact A has to view/update Contact B</comment>
8f069c03 146 <add>2.1</add>
f871c3a9
AS
147 <pseudoconstant>
148 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
149 </pseudoconstant>
db3ec100 150 <html>
f871c3a9 151 <type>Radio</type>
db3ec100 152 </html>
6a488035
TO
153 </field>
154 <field>
8f069c03 155 <name>is_permission_b_a</name>
f871c3a9 156 <type>int unsigned</type>
8f069c03 157 <title>Contact B has Permission Over Contact A</title>
f871c3a9 158 <required>true</required>
8f069c03 159 <default>0</default>
f871c3a9 160 <comment>Permission that Contact B has to view/update Contact A</comment>
8f069c03 161 <add>2.1</add>
f871c3a9
AS
162 <pseudoconstant>
163 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
164 </pseudoconstant>
db3ec100 165 <html>
f871c3a9 166 <type>Radio</type>
db3ec100 167 </html>
6a488035
TO
168 </field>
169 <field>
8f069c03
EM
170 <name>case_id</name>
171 <type>int unsigned</type>
8269c13e 172 <component>CiviCase</component>
047c5009 173 <title>Case ID</title>
8f069c03
EM
174 <default>NULL</default>
175 <comment>FK to civicrm_case</comment>
57e94608
A
176 <html>
177 <label>Case</label>
178 </html>
8f069c03 179 <add>2.2</add>
6a488035 180 </field>
a0efcd4d
EM
181 <field>
182 <name>created_date</name>
183 <type>timestamp</type>
184 <comment>Relationship created date.</comment>
185 <required>true</required>
186 <default>CURRENT_TIMESTAMP</default>
187 <add>5.47</add>
188 </field>
189 <field>
190 <name>modified_date</name>
191 <title>Relationship Modified Date</title>
192 <type>timestamp</type>
193 <required>true</required>
194 <comment>Relationship last modified.</comment>
195 <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
196 <add>5.47</add>
197 <readonly>true</readonly>
198 </field>
3c7d2158 199 <foreignKey>
8f069c03
EM
200 <name>case_id</name>
201 <table>civicrm_case</table>
202 <key>id</key>
203 <add>2.2</add>
204 <onDelete>CASCADE</onDelete>
6a488035
TO
205 </foreignKey>
206</table>