Merge pull request #1 from civicrm/master
[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 <field>
11 <name>id</name>
12 <type>int unsigned</type>
13 <title>Relationship ID</title>
14 <required>true</required>
15 <comment>Relationship ID</comment>
16 <add>1.1</add>
17 </field>
18 <primaryKey>
19 <name>id</name>
20 <autoincrement>true</autoincrement>
21 </primaryKey>
22 <field>
23 <name>contact_id_a</name>
24 <type>int unsigned</type>
25 <title>Contact A</title>
26 <required>true</required>
27 <comment>id of the first contact</comment>
28 <add>1.1</add>
29 </field>
30 <foreignKey>
31 <name>contact_id_a</name>
32 <table>civicrm_contact</table>
33 <key>id</key>
34 <add>1.1</add>
35 <onDelete>CASCADE</onDelete>
36 </foreignKey>
37 <field>
38 <name>contact_id_b</name>
39 <type>int unsigned</type>
40 <title>Contact B</title>
41 <required>true</required>
42 <comment>id of the second contact</comment>
43 <add>1.1</add>
44 <html>
45 <type>EntityRef</type>
46 </html>
47 </field>
48 <foreignKey>
49 <name>contact_id_b</name>
50 <table>civicrm_contact</table>
51 <key>id</key>
52 <add>1.1</add>
53 <onDelete>CASCADE</onDelete>
54 </foreignKey>
55 <field>
56 <name>relationship_type_id</name>
57 <type>int unsigned</type>
58 <title>Relationship Type</title>
59 <required>true</required>
60 <comment>id of the relationship</comment>
61 <add>1.1</add>
62 <html>
63 <type>Select</type>
64 </html>
65 </field>
66 <foreignKey>
67 <name>relationship_type_id</name>
68 <table>civicrm_relationship_type</table>
69 <key>id</key>
70 <add>1.1</add>
71 <onDelete>CASCADE</onDelete>
72 </foreignKey>
73 <field>
74 <name>start_date</name>
75 <type>date</type>
76 <title>Relationship Start Date</title>
77 <comment>date when the relationship started</comment>
78 <add>1.1</add>
79 <html>
80 <type>Select Date</type>
81 <formatType>activityDate</formatType>
82 </html>
83 </field>
84 <field>
85 <name>end_date</name>
86 <type>date</type>
87 <title>Relationship End Date</title>
88 <comment>date when the relationship ended</comment>
89 <add>1.1</add>
90 <html>
91 <type>Select Date</type>
92 <formatType>activityDate</formatType>
93 </html>
94 </field>
95 <field>
96 <name>is_active</name>
97 <type>boolean</type>
98 <title>Relationship Is Active</title>
99 <default>1</default>
100 <comment>is the relationship active ?</comment>
101 <add>1.1</add>
102 <html>
103 <type>CheckBox</type>
104 </html>
105 </field>
106 <field>
107 <name>description</name>
108 <type>varchar</type>
109 <title>Relationship Description</title>
110 <length>255</length>
111 <comment>Optional verbose description for the relationship.</comment>
112 <add>1.5</add>
113 <html>
114 <type>Text</type>
115 </html>
116 </field>
117 <field>
118 <name>is_permission_a_b</name>
119 <type>int unsigned</type>
120 <title>Contact A has Permission Over Contact B</title>
121 <required>true</required>
122 <default>0</default>
123 <comment>Permission that Contact A has to view/update Contact B</comment>
124 <add>2.1</add>
125 <pseudoconstant>
126 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
127 </pseudoconstant>
128 <html>
129 <type>Radio</type>
130 </html>
131 </field>
132 <field>
133 <name>is_permission_b_a</name>
134 <type>int unsigned</type>
135 <title>Contact B has Permission Over Contact A</title>
136 <required>true</required>
137 <default>0</default>
138 <comment>Permission that Contact B has to view/update Contact A</comment>
139 <add>2.1</add>
140 <pseudoconstant>
141 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
142 </pseudoconstant>
143 <html>
144 <type>Radio</type>
145 </html>
146 </field>
147 <field>
148 <name>case_id</name>
149 <type>int unsigned</type>
150 <title>Relationship Case</title>
151 <default>NULL</default>
152 <comment>FK to civicrm_case</comment>
153 <add>2.2</add>
154 </field>
155 <foreignKey>
156 <name>case_id</name>
157 <table>civicrm_case</table>
158 <key>id</key>
159 <add>2.2</add>
160 <onDelete>CASCADE</onDelete>
161 </foreignKey>
162 </table>