Merge pull request #19740 from agh1/notnotnull
[civicrm-core.git] / xml / schema / Activity / Activity.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2 <table>
3 <base>CRM/Activity</base>
4 <class>Activity</class>
5 <name>civicrm_activity</name>
6 <comment>Other Activity details stored here include contact, location, details.</comment>
7 <add>1.1</add>
8 <log>true</log>
9 <icon>fa-tasks</icon>
10 <labelField>subject</labelField>
11 <paths>
12 <add>civicrm/activity?reset=1&amp;action=add&amp;context=standalone</add>
13 <view>civicrm/activity?reset=1&amp;action=view&amp;id=[id]</view>
14 <update>civicrm/activity/add?reset=1&amp;action=update&amp;id=[id]</update>
15 <delete>civicrm/activity?reset=1&amp;action=delete&amp;id=[id]</delete>
16 </paths>
17 <field>
18 <name>id</name>
19 <uniqueName>activity_id</uniqueName>
20 <title>Activity ID</title>
21 <import>true</import>
22 <type>int unsigned</type>
23 <required>true</required>
24 <comment>Unique Other Activity ID</comment>
25 <html>
26 <type>Number</type>
27 </html>
28 <add>1.1</add>
29 </field>
30 <primaryKey>
31 <name>id</name>
32 <autoincrement>true</autoincrement>
33 </primaryKey>
34 <field>
35 <name>source_record_id</name>
36 <type>int unsigned</type>
37 <title>Source Record</title>
38 <comment>Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.</comment>
39 <add>2.0</add>
40 </field>
41 <index>
42 <name>UI_source_record_id</name>
43 <fieldName>source_record_id</fieldName>
44 <add>3.2</add>
45 </index>
46 <field>
47 <name>activity_type_id</name>
48 <title>Activity Type ID</title>
49 <import>true</import>
50 <type>int unsigned</type>
51 <required>true</required>
52 <export>true</export>
53 <default>1</default>
54 <headerPattern>/(activity.)?type(.id$)/i</headerPattern>
55 <comment>FK to civicrm_option_value.id, that has to be valid, registered activity type.</comment>
56 <add>1.1</add>
57 <pseudoconstant>
58 <optionGroupName>activity_type</optionGroupName>
59 </pseudoconstant>
60 <html>
61 <type>Select</type>
62 <label>Activity Type</label>
63 </html>
64 </field>
65 <index>
66 <name>UI_activity_type_id</name>
67 <fieldName>activity_type_id</fieldName>
68 <add>1.6</add>
69 </index>
70 <field>
71 <name>subject</name>
72 <uniqueName>activity_subject</uniqueName>
73 <type>varchar</type>
74 <title>Subject</title>
75 <length>255</length>
76 <comment>The subject/purpose/short description of the activity.</comment>
77 <import>true</import>
78 <headerPattern>/(activity.)?subject/i</headerPattern>
79 <html>
80 <type>Text</type>
81 </html>
82 <add>1.1</add>
83 <change>2.0</change>
84 </field>
85 <field>
86 <name>activity_date_time</name>
87 <import>true</import>
88 <required>false</required>
89 <export>true</export>
90 <default>CURRENT_TIMESTAMP</default>
91 <title>Activity Date</title>
92 <type>datetime</type>
93 <headerPattern>/(activity.)?date(.time$)?/i</headerPattern>
94 <comment>Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.</comment>
95 <html>
96 <type>Select Date</type>
97 <formatType>activityDateTime</formatType>
98 </html>
99 <add>2.0</add>
100 </field>
101 <index>
102 <name>index_activity_date_time</name>
103 <fieldName>activity_date_time</fieldName>
104 <add>4.7</add>
105 </index>
106 <field>
107 <name>duration</name>
108 <uniqueName>activity_duration</uniqueName>
109 <title>Duration</title>
110 <import>true</import>
111 <type>int unsigned</type>
112 <headerPattern>/(activity.)?duration(s)?$/i</headerPattern>
113 <comment>Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.</comment>
114 <add>2.0</add>
115 <html>
116 <type>Number</type>
117 </html>
118 </field>
119 <field>
120 <name>location</name>
121 <uniqueName>activity_location</uniqueName>
122 <title>Location</title>
123 <import>true</import>
124 <type>varchar</type>
125 <length>255</length>
126 <headerPattern>/(activity.)?location$/i</headerPattern>
127 <comment>Location of the activity (optional, open text).</comment>
128 <html>
129 <type>Text</type>
130 </html>
131 <add>1.1</add>
132 </field>
133 <field>
134 <name>phone_id</name>
135 <type>int unsigned</type>
136 <title>Phone ID (called)</title>
137 <comment>Phone ID of the number called (optional - used if an existing phone number is selected).</comment>
138 <add>2.0</add>
139 <html>
140 <type>EntityRef</type>
141 <label>Phone (called)</label>
142 </html>
143 </field>
144 <foreignKey>
145 <name>phone_id</name>
146 <table>civicrm_phone</table>
147 <key>id</key>
148 <add>2.0</add>
149 <onDelete>SET NULL</onDelete>
150 </foreignKey>
151 <field>
152 <name>phone_number</name>
153 <title>Phone (called) Number</title>
154 <type>varchar</type>
155 <length>64</length>
156 <comment>Phone number in case the number does not exist in the civicrm_phone table.</comment>
157 <html>
158 <type>Text</type>
159 </html>
160 <add>2.0</add>
161 </field>
162 <field>
163 <name>details</name>
164 <uniqueName>activity_details</uniqueName>
165 <title>Details</title>
166 <import>true</import>
167 <type>longtext</type>
168 <headerPattern>/(activity.)?detail(s)?$/i</headerPattern>
169 <comment>Details about the activity (agenda, notes, etc).</comment>
170 <html>
171 <type>RichTextEditor</type>
172 <rows>8</rows>
173 <cols>60</cols>
174 </html>
175 <add>1.1</add>
176 </field>
177 <field>
178 <name>status_id</name>
179 <uniqueName>activity_status_id</uniqueName>
180 <title>Activity Status</title>
181 <import>true</import>
182 <export>true</export>
183 <headerPattern>/(activity.)?status(.label$)?/i</headerPattern>
184 <type>int unsigned</type>
185 <comment>ID of the status this activity is currently in. Foreign key to civicrm_option_value.</comment>
186 <add>2.0</add>
187 <pseudoconstant>
188 <optionGroupName>activity_status</optionGroupName>
189 </pseudoconstant>
190 <html>
191 <type>Select</type>
192 </html>
193 </field>
194 <index>
195 <name>index_status_id</name>
196 <fieldName>status_id</fieldName>
197 <add>4.7</add>
198 </index>
199 <field>
200 <name>priority_id</name>
201 <type>int unsigned</type>
202 <title>Priority</title>
203 <export>true</export>
204 <import>true</import>
205 <comment>ID of the priority given to this activity. Foreign key to civicrm_option_value.</comment>
206 <add>2.0</add>
207 <pseudoconstant>
208 <optionGroupName>priority</optionGroupName>
209 </pseudoconstant>
210 <html>
211 <type>Select</type>
212 </html>
213 </field>
214 <field>
215 <name>parent_id</name>
216 <title>Parent Activity ID</title>
217 <type>int unsigned</type>
218 <comment>Parent meeting ID (if this is a follow-up item). This is not currently implemented</comment>
219 <html>
220 <label>Parent Activity</label>
221 </html>
222 <add>1.1</add>
223 </field>
224 <foreignKey>
225 <name>parent_id</name>
226 <table>civicrm_activity</table>
227 <key>id</key>
228 <add>1.1</add>
229 <onDelete>CASCADE</onDelete>
230 </foreignKey>
231 <field>
232 <name>is_test</name>
233 <title>Test</title>
234 <uniqueName>activity_is_test</uniqueName>
235 <type>boolean</type>
236 <default>0</default>
237 <import>true</import>
238 <headerPattern>/(is.)?test(.activity)?/i</headerPattern>
239 <add>2.0</add>
240 <html>
241 <type>CheckBox</type>
242 </html>
243 </field>
244 <field>
245 <name>medium_id</name>
246 <uniqueName>activity_medium_id</uniqueName>
247 <title>Activity Medium</title>
248 <type>int unsigned</type>
249 <default>NULL</default>
250 <comment>Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.</comment>
251 <pseudoconstant>
252 <optionGroupName>encounter_medium</optionGroupName>
253 </pseudoconstant>
254 <html>
255 <type>Select</type>
256 </html>
257 <add>2.2</add>
258 </field>
259 <index>
260 <name>index_medium_id</name>
261 <fieldName>medium_id</fieldName>
262 <add>2.2</add>
263 <drop>5.28</drop>
264 </index>
265 <field>
266 <name>is_auto</name>
267 <title>Auto</title>
268 <type>boolean</type>
269 <default>0</default>
270 <add>2.2</add>
271 </field>
272 <field>
273 <name>relationship_id</name>
274 <title>Relationship ID</title>
275 <type>int unsigned</type>
276 <default>NULL</default>
277 <comment>FK to Relationship ID</comment>
278 <html>
279 <label>Relationship</label>
280 </html>
281 <add>2.2</add>
282 </field>
283 <foreignKey>
284 <name>relationship_id</name>
285 <table>civicrm_relationship</table>
286 <key>id</key>
287 <onDelete>SET NULL</onDelete>
288 </foreignKey>
289 <field>
290 <name>is_current_revision</name>
291 <title>Is this activity a current revision in versioning chain?</title>
292 <type>boolean</type>
293 <default>1</default>
294 <import>true</import>
295 <headerPattern>/(is.)?(current.)?(revision|version(ing)?)/i</headerPattern>
296 <add>2.2</add>
297 </field>
298 <index>
299 <name>index_is_current_revision</name>
300 <fieldName>is_current_revision</fieldName>
301 <add>2.2</add>
302 </index>
303 <field>
304 <name>original_id</name>
305 <type>int unsigned</type>
306 <title>Original Activity ID</title>
307 <comment>Activity ID of the first activity record in versioning chain.</comment>
308 <html>
309 <label>Original Activity</label>
310 </html>
311 <add>2.2</add>
312 </field>
313 <foreignKey>
314 <name>original_id</name>
315 <table>civicrm_activity</table>
316 <key>id</key>
317 <add>2.2</add>
318 <onDelete>CASCADE</onDelete>
319 </foreignKey>
320 <field>
321 <name>result</name>
322 <uniqueName>activity_result</uniqueName>
323 <type>varchar</type>
324 <title>Result</title>
325 <length>255</length>
326 <comment>Currently being used to store result id for survey activity, FK to option value.</comment>
327 <add>3.3</add>
328 </field>
329 <field>
330 <name>is_deleted</name>
331 <uniqueName>activity_is_deleted</uniqueName>
332 <title>Activity is in the Trash</title>
333 <type>boolean</type>
334 <default>0</default>
335 <import>true</import>
336 <headerPattern>/(activity.)?(trash|deleted)/i</headerPattern>
337 <add>2.2</add>
338 <html>
339 <type>CheckBox</type>
340 </html>
341 </field>
342 <index>
343 <name>index_is_deleted</name>
344 <fieldName>is_deleted</fieldName>
345 <add>2.2</add>
346 </index>
347 <field>
348 <name>campaign_id</name>
349 <uniqueName>activity_campaign_id</uniqueName>
350 <type>int unsigned</type>
351 <title>Campaign ID</title>
352 <import>true</import>
353 <comment>The campaign for which this activity has been triggered.</comment>
354 <add>3.4</add>
355 <html>
356 <type>Select</type>
357 <label>Campaign</label>
358 </html>
359 </field>
360 <foreignKey>
361 <name>campaign_id</name>
362 <table>civicrm_campaign</table>
363 <key>id</key>
364 <onDelete>SET NULL</onDelete>
365 </foreignKey>
366 <field>
367 <name>engagement_level</name>
368 <uniqueName>activity_engagement_level</uniqueName>
369 <type>int unsigned</type>
370 <title>Engagement Index</title>
371 <import>true</import>
372 <comment>Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.</comment>
373 <pseudoconstant>
374 <optionGroupName>engagement_index</optionGroupName>
375 </pseudoconstant>
376 <html>
377 <type>Select</type>
378 </html>
379 <add>3.4</add>
380 </field>
381 <field>
382 <name>weight</name>
383 <title>Order</title>
384 <type>int</type>
385 <add>4.1</add>
386 </field>
387 <field>
388 <name>is_star</name>
389 <title>Is Starred</title>
390 <type>boolean</type>
391 <default>0</default>
392 <import>true</import>
393 <comment>Activity marked as favorite.</comment>
394 <headerPattern>/(activity.)?(star|favorite)/i</headerPattern>
395 <add>4.7</add>
396 <html>
397 <type>Checkbox</type>
398 </html>
399 </field>
400 <field>
401 <name>created_date</name>
402 <uniqueName>activity_created_date</uniqueName>
403 <type>timestamp</type>
404 <comment>When was the activity was created.</comment>
405 <required>false</required>
406 <export>true</export>
407 <default>CURRENT_TIMESTAMP</default>
408 <html>
409 <label>Created Date</label>
410 </html>
411 <add>4.7</add>
412 </field>
413 <field>
414 <name>modified_date</name>
415 <uniqueName>activity_modified_date</uniqueName>
416 <type>timestamp</type>
417 <comment>When was the activity (or closely related entity) was created or modified or deleted.</comment>
418 <required>false</required>
419 <export>true</export>
420 <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
421 <html>
422 <label>Modified Date</label>
423 </html>
424 <add>4.7</add>
425 </field>
426 </table>