Refactored Contact Page Summary tab to use CRM_Core_DAO::buildOptions() method. CRM...
[civicrm-core.git] / xml / schema / Contact / Contact.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Contact</base>
5 <class>Contact</class>
6 <name>civicrm_contact</name>
7 <comment>Contact objects are defined by a civicrm_contact record plus a related civicrm_contact_type record.</comment>
8 <add>1.1</add>
9 <log>true</log>
10 <field>
11 <name>id</name>
12 <type>int unsigned</type>
13 <title>Internal Contact ID</title>
14 <import>true</import>
15 <headerPattern>/internal|contact?|id$/i</headerPattern>
16 <required>true</required>
17 <comment>Unique Contact ID</comment>
18 <add>1.1</add>
19 </field>
20 <primaryKey>
21 <name>id</name>
22 <autoincrement>true</autoincrement>
23 </primaryKey>
24 <field>
25 <name>contact_type</name>
26 <title>Contact Type</title>
27 <type>varchar</type>
28 <length>64</length>
29 <comment>Type of Contact.</comment>
30 <export>true</export>
31 <pseudoconstant>
32 <table>civicrm_contact_type</table>
33 <keyColumn>name</keyColumn>
34 <labelColumn>label</labelColumn>
35 <condition>parent_id IS NULL</condition>
36 </pseudoconstant>
37 <add>1.1</add>
38 <change>3.1</change>
39 </field>
40 <index>
41 <name>index_contact_type</name>
42 <fieldName>contact_type</fieldName>
43 <add>2.1</add>
44 </index>
45 <field>
46 <name>contact_sub_type</name>
47 <title>Contact Subtype</title>
48 <type>varchar</type>
49 <length>255</length>
50 <export>true</export>
51 <import>true</import>
52 <headerPattern>/C(ontact )?(subtype|sub-type|sub type)/i</headerPattern>
53 <comment>May be used to over-ride contact view and edit templates.</comment>
54 <pseudoconstant>
55 <table>civicrm_contact_type</table>
56 <keyColumn>name</keyColumn>
57 <labelColumn>label</labelColumn>
58 <condition>parent_id IS NOT NULL</condition>
59 </pseudoconstant>
60 <add>1.5</add>
61 </field>
62 <index>
63 <name>index_contact_sub_type</name>
64 <fieldName>contact_sub_type</fieldName>
65 <add>2.1</add>
66 </index>
67 <field>
68 <name>do_not_email</name>
69 <type>boolean</type>
70 <import>true</import>
71 <headerPattern>/d(o )?(not )?(email)/i</headerPattern>
72 <dataPattern>/^\d{1,}$/</dataPattern>
73 <default>0</default>
74 <add>1.1</add>
75 </field>
76 <field>
77 <name>do_not_phone</name>
78 <type>boolean</type>
79 <default>0</default>
80 <import>true</import>
81 <headerPattern>/d(o )?(not )?(call|phone)/i</headerPattern>
82 <dataPattern>/^\d{1,}$/</dataPattern>
83 <add>1.1</add>
84 </field>
85 <field>
86 <name>do_not_mail</name>
87 <type>boolean</type>
88 <import>true</import>
89 <headerPattern>/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i</headerPattern>
90 <dataPattern>/^\d{1,}$/</dataPattern>
91 <default>0</default>
92 <add>1.1</add>
93 </field>
94 <field>
95 <name>do_not_sms</name>
96 <type>boolean</type>
97 <import>true</import>
98 <headerPattern>/d(o )?(not )?(sms)/i</headerPattern>
99 <dataPattern>/^\d{1,}$/</dataPattern>
100 <default>0</default>
101 <add>3.0</add>
102 </field>
103 <field>
104 <name>do_not_trade</name>
105 <type>boolean</type>
106 <import>true</import>
107 <headerPattern>/d(o )?(not )?(trade)/i</headerPattern>
108 <dataPattern>/^\d{1,}$/</dataPattern>
109 <default>0</default>
110 <add>1.1</add>
111 </field>
112 <field>
113 <name>is_opt_out</name>
114 <type>boolean</type>
115 <title>No Bulk Emails (User Opt Out)</title>
116 <default>0</default>
117 <import>true</import>
118 <required>true</required>
119 <comment>Has the contact opted out from receiving all bulk email from the organization or site domain?</comment>
120 <add>1.1</add>
121 </field>
122 <field>
123 <name>legal_identifier</name>
124 <type>varchar</type>
125 <length>32</length>
126 <import>true</import>
127 <headerPattern>/legal\s?id/i</headerPattern>
128 <dataPattern>/\w+?\d{5,}/</dataPattern>
129 <comment>May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.</comment>
130 <add>1.1</add>
131 </field>
132 <field>
133 <name>external_identifier</name>
134 <type>varchar</type>
135 <length>32</length>
136 <size>EIGHT</size>
137 <import>true</import>
138 <headerPattern>/external\s?id/i</headerPattern>
139 <dataPattern>/^\d{11,}$/</dataPattern>
140 <comment>Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.</comment>
141 <add>1.1</add>
142 </field>
143 <index>
144 <name>UI_external_identifier</name>
145 <unique>true</unique>
146 <fieldName>external_identifier</fieldName>
147 <add>1.7</add>
148 </index>
149 <field>
150 <name>sort_name</name>
151 <title>Sort Name</title>
152 <type>varchar</type>
153 <length>128</length>
154 <size>BIG</size>
155 <export>true</export>
156 <comment>Name used for sorting different contact types</comment>
157 <add>1.1</add>
158 </field>
159 <index>
160 <name>index_sort_name</name>
161 <fieldName>sort_name</fieldName>
162 <add>2.1</add>
163 </index>
164 <field>
165 <name>display_name</name>
166 <title>Display Name</title>
167 <type>varchar</type>
168 <length>128</length>
169 <size>BIG</size>
170 <export>true</export>
171 <comment>Formatted name representing preferred format for display/print/other output.</comment>
172 <add>1.1</add>
173 </field>
174 <field>
175 <name>nick_name</name>
176 <title>Nickname</title>
177 <type>varchar</type>
178 <length>128</length>
179 <size>BIG</size>
180 <import>true</import>
181 <headerPattern>/n(ick\s)name|nick$/i</headerPattern>
182 <dataPattern>/^\w+$/</dataPattern>
183 <comment>Nickname.</comment>
184 <fulltext/>
185 <add>1.1</add>
186 </field>
187 <field>
188 <name>legal_name</name>
189 <type>varchar</type>
190 <length>128</length>
191 <size>BIG</size>
192 <import>true</import>
193 <headerPattern>/^legal|(l(egal\s)?name)$/i</headerPattern>
194 <comment>Legal Name.</comment>
195 <fulltext/>
196 <add>1.1</add>
197 </field>
198 <field>
199 <name>home_URL</name>
200 <rule>url</rule>
201 <title>Website</title>
202 <type>varchar</type>
203 <length>128</length>
204 <size>BIG</size>
205 <import>true</import>
206 <headerPattern>/^(home\sURL)|URL|web|site/i</headerPattern>
207 <dataPattern>/^[\w\/\:\.]+$/</dataPattern>
208 <comment>optional "home page" URL for this contact.</comment>
209 <add>1.1</add>
210 <drop>3.2</drop>
211 </field>
212 <field>
213 <name>image_URL</name>
214 <type>varchar</type>
215 <length>255</length>
216 <import>true</import>
217 <comment>optional URL for preferred image (photo, logo, etc.) to display for this contact.</comment>
218 <add>1.1</add>
219 </field>
220 <field>
221 <name>preferred_communication_method</name>
222 <title>Preferred Communication Method</title>
223 <type>varchar</type>
224 <length>255</length>
225 <import>true</import>
226 <headerPattern>/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i</headerPattern>
227 <dataPattern>/^\w+$/</dataPattern>
228 <comment>What is the preferred mode of communication.</comment>
229 <add>1.1</add>
230 <pseudoconstant>
231 <optionGroupName>preferred_communication_method</optionGroupName>
232 </pseudoconstant>
233 </field>
234 <index>
235 <name>index_preferred_communication_method</name>
236 <fieldName>preferred_communication_method</fieldName>
237 <add>1.6</add>
238 </index>
239 <field>
240 <name>preferred_language</name>
241 <title>Preferred Language</title>
242 <type>varchar</type>
243 <length>5</length>
244 <comment>Which language is preferred for communication. FK to languages in civicrm_option_value.</comment>
245 <headerPattern>/^lang/i</headerPattern>
246 <import>true</import>
247 <add>3.2</add>
248 </field>
249 <field>
250 <name>preferred_mail_format</name>
251 <type>enum</type>
252 <values>Text, HTML, Both</values>
253 <default>"Both"</default>
254 <import>true</import>
255 <headerPattern>/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i</headerPattern>
256 <comment>What is the preferred mode of sending an email.</comment>
257 <add>1.1</add>
258 </field>
259 <field>
260 <name>hash</name>
261 <title>Contact Hash</title>
262 <type>varchar</type>
263 <length>32</length>
264 <comment>Key for validating requests related to this contact.</comment>
265 <add>1.1</add>
266 <change>1.5</change>
267 <export>true</export>
268 </field>
269 <index>
270 <name>index_hash</name>
271 <fieldName>hash</fieldName>
272 <add>2.1</add>
273 </index>
274 <field>
275 <name>api_key</name>
276 <type>varchar</type>
277 <length>32</length>
278 <comment>API Key for validating requests related to this contact.</comment>
279 <add>2.2</add>
280 </field>
281 <index>
282 <name>index_api_key</name>
283 <fieldName>api_key</fieldName>
284 <add>2.1</add>
285 </index>
286 <field>
287 <name>source</name>
288 <title>Source of Contact Data</title>
289 <uniqueName>contact_source</uniqueName>
290 <type>varchar</type>
291 <length>255</length>
292 <size>BIG</size>
293 <import>true</import>
294 <headerPattern>/(S(ource\s)?o(f\s)?C(ontact\s)?Data)$/i</headerPattern>
295 <comment>where contact come from, e.g. import, donate module insert...</comment>
296 <add>1.1</add>
297 </field>
298 <field>
299 <name>first_name</name>
300 <type>varchar</type>
301 <length>64</length>
302 <size>BIG</size>
303 <import>true</import>
304 <headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
305 <dataPattern>/^\w+$/</dataPattern>
306 <fulltext/>
307 <comment>First Name.</comment>
308 <add>1.1</add>
309 </field>
310 <index>
311 <name>index_first_name</name>
312 <fieldName>first_name</fieldName>
313 <add>1.8</add>
314 </index>
315 <field>
316 <name>middle_name</name>
317 <type>varchar</type>
318 <length>64</length>
319 <size>MEDIUM</size>
320 <import>true</import>
321 <headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
322 <dataPattern>/^\w+$/</dataPattern>
323 <fulltext/>
324 <comment>Middle Name.</comment>
325 <add>1.1</add>
326 </field>
327 <field>
328 <name>last_name</name>
329 <type>varchar</type>
330 <length>64</length>
331 <size>BIG</size>
332 <import>true</import>
333 <headerPattern>/^last|(l(ast\s)?name)$/i</headerPattern>
334 <dataPattern>/^\w+(\s\w+)?+$/</dataPattern>
335 <comment>Last Name.</comment>
336 <fulltext/>
337 <add>1.1</add>
338 </field>
339 <index>
340 <name>index_last_name</name>
341 <fieldName>last_name</fieldName>
342 <add>1.8</add>
343 </index>
344 <field>
345 <name>prefix_id</name>
346 <title>Individual Prefix</title>
347 <type>int unsigned</type>
348 <comment>Prefix or Title for name (Ms, Mr...). FK to prefix ID</comment>
349 <pseudoconstant>
350 <optionGroupName>individual_prefix</optionGroupName>
351 </pseudoconstant>
352 <headerPattern>/^(prefix|title)/i</headerPattern>
353 <dataPattern>/^(mr|ms|mrs|sir|dr)\.?$/i</dataPattern>
354 <import>true</import>
355 <add>1.2</add>
356 </field>
357 <index>
358 <name>UI_prefix</name>
359 <fieldName>prefix_id</fieldName>
360 <add>1.6</add>
361 </index>
362 <field>
363 <name>suffix_id</name>
364 <title>Individual Suffix</title>
365 <type>int unsigned</type>
366 <pseudoconstant>
367 <optionGroupName>individual_suffix</optionGroupName>
368 </pseudoconstant>
369 <import>true</import>
370 <comment>Suffix for name (Jr, Sr...). FK to suffix ID</comment>
371 <headerPattern>/^suffix$/i</headerPattern>
372 <dataPattern>/^(sr|jr)\.?|i{2,}$/</dataPattern>
373 <add>1.2</add>
374 </field>
375 <index>
376 <name>UI_suffix</name>
377 <fieldName>suffix_id</fieldName>
378 <add>1.6</add>
379 </index>
380 <field>
381 <name>greeting_type</name>
382 <type>varchar</type>
383 <length>128</length>
384 <import>true</import>
385 <comment>Preferred greeting format.</comment>
386 <add>1.1</add>
387 <drop>2.2</drop>
388 </field>
389 <field>
390 <name>greeting_type_id</name>
391 <title>Greeting Type</title>
392 <type>int unsigned</type>
393 <comment>FK to civicrm_option_value.id, that has to be valid, registered Greeting type.</comment>
394 <add>2.2</add>
395 <drop>3.0</drop>
396 </field>
397 <field>
398 <name>custom_greeting</name>
399 <type>varchar</type>
400 <length>128</length>
401 <import>true</import>
402 <comment>Custom greeting message.</comment>
403 <add>1.1</add>
404 <drop>3.0</drop>
405 </field>
406 <field>
407 <name>email_greeting_id</name>
408 <type>int unsigned</type>
409 <title>Email Greeting ID</title>
410 <comment>FK to civicrm_option_value.id, that has to be valid registered Email Greeting.</comment>
411 <add>3.0</add>
412 </field>
413 <field>
414 <name>email_greeting_custom</name>
415 <type>varchar</type>
416 <length>128</length>
417 <import>true</import>
418 <export>false</export>
419 <comment>Custom Email Greeting.</comment>
420 <add>3.0</add>
421 </field>
422 <field>
423 <name>email_greeting_display</name>
424 <title>Email Greeting</title>
425 <type>varchar</type>
426 <length>255</length>
427 <comment>Cache Email Greeting.</comment>
428 <add>3.0</add>
429 </field>
430 <field>
431 <name>postal_greeting_id</name>
432 <type>int unsigned</type>
433 <title>Postal Greeting ID</title>
434 <comment>FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.</comment>
435 <add>3.0</add>
436 </field>
437 <field>
438 <name>postal_greeting_custom</name>
439 <type>varchar</type>
440 <length>128</length>
441 <import>true</import>
442 <export>false</export>
443 <comment>Custom Postal greeting.</comment>
444 <add>3.0</add>
445 </field>
446 <field>
447 <name>postal_greeting_display</name>
448 <title>Postal Greeting</title>
449 <type>varchar</type>
450 <length>255</length>
451 <comment>Cache Postal greeting.</comment>
452 <add>3.0</add>
453 </field>
454 <field>
455 <name>addressee_id</name>
456 <type>int unsigned</type>
457 <title>Addressee ID</title>
458 <comment>FK to civicrm_option_value.id, that has to be valid registered Addressee.</comment>
459 <add>3.0</add>
460 </field>
461 <field>
462 <name>addressee_custom</name>
463 <type>varchar</type>
464 <length>128</length>
465 <import>true</import>
466 <export>false</export>
467 <comment>Custom Addressee.</comment>
468 <add>3.0</add>
469 </field>
470 <field>
471 <name>addressee_display</name>
472 <title>Addressee</title>
473 <type>varchar</type>
474 <length>255</length>
475 <comment>Cache Addressee.</comment>
476 <add>3.0</add>
477 </field>
478 <field>
479 <name>job_title</name>
480 <type>varchar</type>
481 <length>255</length>
482 <size>MEDIUM</size>
483 <import>true</import>
484 <headerPattern>/^job|(j(ob\s)?title)$/i</headerPattern>
485 <dataPattern>//</dataPattern>
486 <comment>Job Title</comment>
487 <add>1.1</add>
488 </field>
489 <field>
490 <name>gender_id</name>
491 <title>Gender</title>
492 <type>int unsigned</type>
493 <pseudoconstant>
494 <optionGroupName>gender</optionGroupName>
495 </pseudoconstant>
496 <headerPattern>/^gender$/i</headerPattern>
497 <comment>FK to gender ID</comment>
498 <import>true</import>
499 <add>1.2</add>
500 </field>
501 <index>
502 <name>UI_gender</name>
503 <fieldName>gender_id</fieldName>
504 <add>1.6</add>
505 </index>
506 <field>
507 <name>birth_date</name>
508 <type>date</type>
509 <import>true</import>
510 <headerPattern>/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i</headerPattern>
511 <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
512 <comment>Date of birth</comment>
513 <add>1.1</add>
514 </field>
515 <field>
516 <name>is_deceased</name>
517 <title>Is Deceased</title>
518 <import>true</import>
519 <export>true</export>
520 <headerPattern>/i(s\s)?d(eceased)$/i</headerPattern>
521 <type>boolean</type>
522 <default>0</default>
523 <add>1.1</add>
524 </field>
525 <field>
526 <name>deceased_date</name>
527 <type>date</type>
528 <import>true</import>
529 <export>true</export>
530 <headerPattern>/^deceased|(d(eceased\s)?date)$/i</headerPattern>
531 <comment>Date of deceased</comment>
532 <add>1.5</add>
533 </field>
534 <field>
535 <name>mail_to_household_id</name>
536 <title>Mail to Household ID</title>
537 <type>int unsigned</type>
538 <comment>OPTIONAL FK to civicrm_contact_household record. If NOT NULL, direct mail communications to household rather than individual location.</comment>
539 <export>true</export>
540 <add>1.1</add>
541 <drop>3.3</drop>
542 </field>
543 <foreignKey>
544 <name>mail_to_household_id</name>
545 <table>civicrm_contact</table>
546 <key>id</key>
547 <add>2.1</add>
548 <onDelete>SET NULL</onDelete>
549 <drop>3.3</drop>
550 </foreignKey>
551 <field>
552 <name>household_name</name>
553 <type>varchar</type>
554 <length>128</length>
555 <size>BIG</size>
556 <import>true</import>
557 <headerPattern>/^household|(h(ousehold\s)?name)$/i</headerPattern>
558 <dataPattern>/^\w+$/</dataPattern>
559 <comment>Household Name.</comment>
560 <fulltext/>
561 <add>1.1</add>
562 </field>
563 <index>
564 <name>index_household_name</name>
565 <fieldName>household_name</fieldName>
566 <add>1.8</add>
567 </index>
568 <field>
569 <name>primary_contact_id</name>
570 <type>int unsigned</type>
571 <title>Household Primary Contact ID</title>
572 <comment>Optional FK to Primary Contact for this household.</comment>
573 <add>1.1</add>
574 </field>
575 <foreignKey>
576 <name>primary_contact_id</name>
577 <table>civicrm_contact</table>
578 <key>id</key>
579 <add>1.1</add>
580 <onDelete>SET NULL</onDelete>
581 </foreignKey>
582 <field>
583 <name>organization_name</name>
584 <type>varchar</type>
585 <length>128</length>
586 <size>BIG</size>
587 <import>true</import>
588 <headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>
589 <dataPattern>/^\w+$/</dataPattern>
590 <comment>Organization Name.</comment>
591 <fulltext/>
592 <add>1.1</add>
593 </field>
594 <index>
595 <name>index_organization_name</name>
596 <fieldName>organization_name</fieldName>
597 <add>1.8</add>
598 </index>
599 <field>
600 <name>sic_code</name>
601 <type>varchar</type>
602 <length>8</length>
603 <import>true</import>
604 <headerPattern>/^sic|(s(ic\s)?code)$/i</headerPattern>
605 <comment>Standard Industry Classification Code.</comment>
606 <add>1.1</add>
607 </field>
608 <field>
609 <name>user_unique_id</name>
610 <rule>url</rule>
611 <title>Unique ID (OpenID)</title>
612 <type>varchar</type>
613 <length>255</length>
614 <import>true</import>
615 <headerPattern>/^Open\s?ID|u(niq\w*)?\s?ID/i</headerPattern>
616 <dataPattern>/^[\w\/\:\.]+$/</dataPattern>
617 <comment>the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM</comment>
618 <add>2.0</add>
619 </field>
620 <field>
621 <name>employer_id</name>
622 <title>Current Employer ID</title>
623 <uniqueName>current_employer_id</uniqueName>
624 <type>int unsigned</type>
625 <comment>OPTIONAL FK to civicrm_contact record.</comment>
626 <export>true</export>
627 <add>2.1</add>
628 </field>
629 <foreignKey>
630 <name>employer_id</name>
631 <table>civicrm_contact</table>
632 <key>id</key>
633 <add>2.1</add>
634 <onDelete>SET NULL</onDelete>
635 </foreignKey>
636 <field>
637 <name>is_deleted</name>
638 <title>Contact is in Trash</title>
639 <uniqueName>contact_is_deleted</uniqueName>
640 <type>boolean</type>
641 <default>0</default>
642 <required>true</required>
643 <export>true</export>
644 <add>3.2</add>
645 </field>
646 <index>
647 <name>index_is_deleted</name>
648 <fieldName>is_deleted</fieldName>
649 <add>3.2</add>
650 <drop>4.4</drop>
651 </index>
652 <index>
653 <name>index_is_deleted_sort_name</name>
654 <fieldName>is_deleted</fieldName>
655 <fieldName>sort_name</fieldName>
656 <fieldName>id</fieldName>
657 <add>4.4</add>
658 </index>
659 <field>
660 <name>created_date</name>
661 <type>timestamp</type>
662 <comment>When was the contact was created.</comment>
663 <required>false</required>
664 <default>NULL</default>
665 <add>4.3</add>
666 </field>
667 <field>
668 <name>modified_date</name>
669 <type>timestamp</type>
670 <comment>When was the contact (or closely related entity) was created or modified or deleted.</comment>
671 <required>false</required>
672 <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
673 <add>4.3</add>
674 </field>
675 </table>