Merge pull request #21612 from civicrm/5.42
[civicrm-core.git] / xml / schema / Core / Address.xml
CommitLineData
6a488035
TO
1<?xml version="1.0" encoding="iso-8859-1" ?>
2
3<table>
4 <base>CRM/Core</base>
5 <class>Address</class>
6 <name>civicrm_address</name>
046a1321 7 <comment>Stores the physical street / mailing address. This format should be capable of storing ALL international addresses.</comment>
6a488035
TO
8 <add>1.1</add>
9 <log>true</log>
449c4e6b 10 <icon>fa-map-marker</icon>
6a488035 11 <field>
8f069c03 12 <name>id</name>
7e18723f 13 <uniqueName>address_id</uniqueName>
8f069c03 14 <type>int unsigned</type>
7e18723f 15 <export>true</export>
8f069c03
EM
16 <title>Address ID</title>
17 <required>true</required>
18 <comment>Unique Address ID</comment>
0481e12c
A
19 <html>
20 <type>Number</type>
21 </html>
8f069c03 22 <add>1.1</add>
6a488035
TO
23 </field>
24 <primaryKey>
8f069c03
EM
25 <name>id</name>
26 <autoincrement>true</autoincrement>
6a488035
TO
27 </primaryKey>
28 <field>
8f069c03
EM
29 <name>contact_id</name>
30 <title>Contact ID</title>
31 <type>int unsigned</type>
32 <comment>FK to Contact ID</comment>
57e94608
A
33 <html>
34 <label>Contact</label>
35 </html>
8f069c03 36 <add>2.0</add>
6a488035
TO
37 </field>
38 <foreignKey>
8f069c03
EM
39 <name>contact_id</name>
40 <table>civicrm_contact</table>
41 <key>id</key>
42 <add>2.0</add>
43 <onDelete>CASCADE</onDelete>
6a488035
TO
44 </foreignKey>
45 <field>
8f069c03
EM
46 <name>location_type_id</name>
47 <title>Address Location Type</title>
48 <type>int unsigned</type>
49 <comment>Which Location does this address belong to.</comment>
50 <add>2.0</add>
51 <pseudoconstant>
52 <table>civicrm_location_type</table>
53 <keyColumn>id</keyColumn>
54 <labelColumn>display_name</labelColumn>
55 </pseudoconstant>
56 <html>
57 <type>Select</type>
58 </html>
6a488035
TO
59 </field>
60 <index>
61 <name>index_location_type</name>
62 <fieldName>location_type_id</fieldName>
63 <add>2.0</add>
64 </index>
65 <field>
8f069c03 66 <name>is_primary</name>
b6673dcd 67 <title>Primary address</title>
8f069c03
EM
68 <type>boolean</type>
69 <default>0</default>
70 <comment>Is this the primary address.</comment>
71 <add>2.0</add>
999ab5e1 72 <html>
b6673dcd 73 <type>Radio</type>
999ab5e1 74 </html>
6a488035
TO
75 </field>
76 <index>
77 <name>index_is_primary</name>
78 <fieldName>is_primary</fieldName>
79 <add>2.0</add>
80 </index>
81 <field>
8f069c03
EM
82 <name>is_billing</name>
83 <title>Is Billing Address</title>
84 <type>boolean</type>
85 <default>0</default>
86 <comment>Is this the billing address.</comment>
87 <add>2.0</add>
999ab5e1
TM
88 <html>
89 <type>CheckBox</type>
90 </html>
6a488035
TO
91 </field>
92 <index>
93 <name>index_is_billing</name>
94 <fieldName>is_billing</fieldName>
95 <add>2.0</add>
96 </index>
97 <field>
8f069c03
EM
98 <name>street_address</name>
99 <title>Street Address</title>
100 <type>varchar</type>
101 <length>96</length>
102 <import>true</import>
103 <headerPattern>/(street|address)/i</headerPattern>
104 <dataPattern>/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i</dataPattern>
105 <comment>Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
106 number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
fb607354 107 delivery, etc.).</comment>
8f069c03 108 <add>1.1</add>
999ab5e1
TM
109 <html>
110 <type>Text</type>
111 </html>
6a488035
TO
112 </field>
113 <field>
8f069c03
EM
114 <name>street_number</name>
115 <title>Street Number</title>
116 <type>int</type>
117 <export>true</export>
118 <comment>Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.</comment>
119 <add>1.1</add>
999ab5e1
TM
120 <html>
121 <type>Text</type>
122 </html>
6a488035
TO
123 </field>
124 <field>
8f069c03
EM
125 <name>street_number_suffix</name>
126 <title>Street Number Suffix</title>
127 <type>varchar</type>
128 <length>8</length>
129 <export>true</export>
fb607354 130 <comment>Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A</comment>
8f069c03 131 <add>1.1</add>
999ab5e1
TM
132 <html>
133 <type>Text</type>
134 </html>
6a488035
TO
135 </field>
136 <field>
8f069c03
EM
137 <name>street_number_predirectional</name>
138 <title>Street Direction Prefix</title>
139 <type>varchar</type>
140 <length>8</length>
141 <comment>Directional prefix, e.g. SE Main St, SE is the prefix.</comment>
142 <add>1.1</add>
999ab5e1
TM
143 <html>
144 <type>Text</type>
145 </html>
6a488035
TO
146 </field>
147 <field>
8f069c03
EM
148 <name>street_name</name>
149 <type>varchar</type>
150 <title>Street Name</title>
151 <length>64</length>
152 <export>true</export>
153 <comment>Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.</comment>
154 <add>1.1</add>
999ab5e1
TM
155 <html>
156 <type>Text</type>
157 </html>
6a488035
TO
158 </field>
159 <index>
8f069c03
EM
160 <name>index_street_name</name>
161 <fieldName>street_name</fieldName>
162 <add>1.1</add>
6a488035
TO
163 </index>
164 <field>
8f069c03
EM
165 <name>street_type</name>
166 <title>Street Type</title>
167 <type>varchar</type>
168 <length>8</length>
169 <comment>St, Rd, Dr, etc.</comment>
170 <add>1.1</add>
999ab5e1
TM
171 <html>
172 <type>Text</type>
173 </html>
6a488035
TO
174 </field>
175 <field>
8f069c03
EM
176 <name>street_number_postdirectional</name>
177 <title>Street Direction Suffix</title>
178 <type>varchar</type>
179 <length>8</length>
180 <comment>Directional prefix, e.g. Main St S, S is the suffix.</comment>
181 <add>1.1</add>
999ab5e1
TM
182 <html>
183 <type>Text</type>
184 </html>
6a488035
TO
185 </field>
186 <field>
8f069c03
EM
187 <name>street_unit</name>
188 <title>Street Unit</title>
189 <type>varchar</type>
190 <length>16</length>
191 <export>true</export>
192 <comment>Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200</comment>
193 <add>1.1</add>
999ab5e1
TM
194 <html>
195 <type>Text</type>
196 </html>
6a488035
TO
197 </field>
198 <field>
8f069c03
EM
199 <name>supplemental_address_1</name>
200 <title>Supplemental Address 1</title>
201 <type>varchar</type>
202 <length>96</length>
203 <import>true</import>
204 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
205 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
206 <comment>Supplemental Address Information, Line 1</comment>
207 <add>1.1</add>
999ab5e1
TM
208 <html>
209 <type>Text</type>
210 </html>
6a488035
TO
211 </field>
212 <field>
8f069c03
EM
213 <name>supplemental_address_2</name>
214 <title>Supplemental Address 2</title>
215 <type>varchar</type>
216 <length>96</length>
217 <import>true</import>
218 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
219 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
220 <comment>Supplemental Address Information, Line 2</comment>
221 <add>1.1</add>
999ab5e1
TM
222 <html>
223 <type>Text</type>
224 </html>
6a488035
TO
225 </field>
226 <field>
8f069c03
EM
227 <name>supplemental_address_3</name>
228 <title>Supplemental Address 3</title>
229 <type>varchar</type>
230 <length>96</length>
207f62c6
AS
231 <import>true</import>
232 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
233 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
8f069c03
EM
234 <comment>Supplemental Address Information, Line 3</comment>
235 <add>1.1</add>
999ab5e1
TM
236 <html>
237 <type>Text</type>
238 </html>
6a488035
TO
239 </field>
240 <field>
8f069c03
EM
241 <name>city</name>
242 <title>City</title>
243 <type>varchar</type>
244 <length>64</length>
245 <import>true</import>
246 <headerPattern>/city/i</headerPattern>
247 <dataPattern>/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/</dataPattern>
248 <comment>City, Town or Village Name.</comment>
249 <add>1.1</add>
999ab5e1
TM
250 <html>
251 <type>Text</type>
252 </html>
6a488035
TO
253 </field>
254 <index>
8f069c03
EM
255 <name>index_city</name>
256 <fieldName>city</fieldName>
257 <add>1.1</add>
6a488035
TO
258 </index>
259 <field>
8f069c03
EM
260 <name>county_id</name>
261 <type>int unsigned</type>
57e94608 262 <title>County ID</title>
8f069c03
EM
263 <comment>Which County does this address belong to.</comment>
264 <pseudoconstant>
265 <table>civicrm_county</table>
266 <keyColumn>id</keyColumn>
267 <labelColumn>name</labelColumn>
70c5cd97 268 <abbrColumn>abbreviation</abbrColumn>
8f069c03
EM
269 </pseudoconstant>
270 <html>
b248d52b 271 <type>ChainSelect</type>
8ada2bfd 272 <controlField>state_province_id</controlField>
57e94608 273 <label>County</label>
8f069c03
EM
274 </html>
275 <add>1.1</add>
6a488035
TO
276 </field>
277 <foreignKey>
8f069c03
EM
278 <name>county_id</name>
279 <table>civicrm_county</table>
280 <key>id</key>
281 <import>true</import>
282 <headerPattern>/county/i</headerPattern>
283 <dataPattern>/[A-Z]{2}/</dataPattern>
284 <add>1.1</add>
285 <onDelete>SET NULL</onDelete>
6a488035
TO
286 </foreignKey>
287 <field>
8f069c03 288 <name>state_province_id</name>
57e94608 289 <title>State/Province ID</title>
8f069c03
EM
290 <type>int unsigned</type>
291 <comment>Which State_Province does this address belong to.</comment>
292 <pseudoconstant>
293 <table>civicrm_state_province</table>
294 <keyColumn>id</keyColumn>
295 <labelColumn>name</labelColumn>
70c5cd97 296 <abbrColumn>abbreviation</abbrColumn>
8f069c03 297 </pseudoconstant>
65c86f7d 298 <localize_context>province</localize_context>
8f069c03 299 <html>
b248d52b 300 <type>ChainSelect</type>
8ada2bfd 301 <controlField>country_id</controlField>
57e94608 302 <label>State/Province</label>
8f069c03
EM
303 </html>
304 <add>1.1</add>
6a488035
TO
305 </field>
306 <foreignKey>
8f069c03
EM
307 <name>state_province_id</name>
308 <table>civicrm_state_province</table>
309 <key>id</key>
310 <import>true</import>
311 <headerPattern>/state|prov(ince)?/i</headerPattern>
312 <dataPattern>
313 /A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY]/i
314 </dataPattern>
315 <add>1.1</add>
316 <onDelete>SET NULL</onDelete>
6a488035 317 </foreignKey>
8f069c03
EM
318 <field>
319 <name>postal_code_suffix</name>
d79be26c 320 <title>Postal Code Suffix</title>
8f069c03
EM
321 <type>varchar</type>
322 <length>12</length>
323 <import>true</import>
324 <headerPattern>/p(ostal)\sc(ode)\ss(uffix)/i</headerPattern>
325 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
326 <comment>Store the suffix, like the +4 part in the USPS system.</comment>
327 <add>1.1</add>
999ab5e1
TM
328 <html>
329 <type>Text</type>
d79be26c 330 <size>3</size>
999ab5e1 331 </html>
3c7d2158 332 </field>
8f069c03
EM
333 <field>
334 <name>postal_code</name>
d79be26c 335 <title>Postal Code</title>
8f069c03 336 <type>varchar</type>
c5219185 337 <length>64</length>
8f069c03
EM
338 <import>true</import>
339 <headerPattern>/postal|zip/i</headerPattern>
340 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
d79be26c 341 <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.</comment>
8f069c03 342 <add>1.1</add>
999ab5e1
TM
343 <html>
344 <type>Text</type>
d79be26c 345 <size>6</size>
999ab5e1 346 </html>
6a488035
TO
347 </field>
348 <field>
8f069c03
EM
349 <name>usps_adc</name>
350 <title>USPS Code</title>
351 <type>varchar</type>
352 <length>32</length>
353 <comment>USPS Bulk mailing code.</comment>
354 <add>1.1</add>
6a488035
TO
355 </field>
356 <field>
8f069c03 357 <name>country_id</name>
57e94608 358 <title>Country ID</title>
8f069c03
EM
359 <type>int unsigned</type>
360 <comment>Which Country does this address belong to.</comment>
361 <pseudoconstant>
362 <table>civicrm_country</table>
363 <keyColumn>id</keyColumn>
364 <labelColumn>name</labelColumn>
365 <nameColumn>iso_code</nameColumn>
a8fdb24e 366 <abbrColumn>iso_code</abbrColumn>
8f069c03 367 </pseudoconstant>
65c86f7d 368 <localize_context>country</localize_context>
8f069c03
EM
369 <html>
370 <type>Select</type>
57e94608 371 <label>Country</label>
8f069c03
EM
372 </html>
373 <add>1.1</add>
6a488035
TO
374 </field>
375 <foreignKey>
8f069c03
EM
376 <name>country_id</name>
377 <table>civicrm_country</table>
378 <key>id</key>
379 <import>true</import>
380 <headerPattern>/country/i</headerPattern>
381 <dataPattern>/\w+(\s\w+)?/</dataPattern>
382 <add>1.1</add>
383 <onDelete>SET NULL</onDelete>
6a488035
TO
384 </foreignKey>
385 <field>
8f069c03
EM
386 <name>geo_code_1</name>
387 <title>Latitude</title>
388 <type>float</type>
389 <import>true</import>
390 <headerPattern>/geo/i</headerPattern>
391 <comment>Latitude</comment>
392 <add>1.1</add>
999ab5e1
TM
393 <html>
394 <type>Text</type>
395 <size>9</size>
396 </html>
6a488035
TO
397 </field>
398 <field>
8f069c03
EM
399 <name>geo_code_2</name>
400 <title>Longitude</title>
401 <type>float</type>
402 <comment>Longitude</comment>
403 <import>true</import>
404 <headerPattern>/geo/i</headerPattern>
405 <add>1.1</add>
999ab5e1
TM
406 <html>
407 <type>Text</type>
408 <size>9</size>
409 </html>
6a488035 410 </field>
d56bfd0e
SL
411 <index>
412 <name>index_geo_code_1_geo_code_2</name>
413 <fieldName>geo_code_1</fieldName>
414 <fieldName>geo_code_2</fieldName>
415 </index>
6a488035 416 <field>
8f069c03 417 <name>manual_geo_code</name>
4fcfc078 418 <title>Is Manually Geocoded</title>
8f069c03
EM
419 <type>boolean</type>
420 <default>0</default>
421 <comment>Is this a manually entered geo code</comment>
422 <add>4.3</add>
999ab5e1
TM
423 <html>
424 <type>CheckBox</type>
425 </html>
4fcfc078 426 <export>true</export>
6a488035
TO
427 </field>
428 <field>
8f069c03
EM
429 <name>timezone</name>
430 <title>Timezone</title>
431 <type>varchar</type>
432 <length>8</length>
433 <comment>Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".</comment>
434 <add>1.1</add>
999ab5e1
TM
435 <html>
436 <type>Text</type>
437 </html>
6a488035
TO
438 </field>
439 <field>
8f069c03
EM
440 <name>name</name>
441 <uniqueName>address_name</uniqueName>
442 <title>Address Name</title>
443 <type>varchar</type>
444 <length>255</length>
445 <import>true</import>
446 <headerPattern>/^location|(l(ocation\s)?name)$/i</headerPattern>
447 <dataPattern>/^\w+$/</dataPattern>
448 <add>2.1</add>
999ab5e1
TM
449 <html>
450 <type>Text</type>
451 </html>
6a488035
TO
452 </field>
453 <field>
8f069c03 454 <name>master_id</name>
57e94608 455 <title>Master Address ID</title>
8f069c03
EM
456 <type>int unsigned</type>
457 <import>true</import>
458 <comment>FK to Address ID</comment>
57e94608
A
459 <html>
460 <label>Master Address Belongs To</label>
461 </html>
8f069c03 462 <add>3.3</add>
6a488035
TO
463 </field>
464 <foreignKey>
8f069c03
EM
465 <name>master_id</name>
466 <table>civicrm_address</table>
467 <key>id</key>
468 <add>3.3</add>
469 <onDelete>SET NULL</onDelete>
6a488035
TO
470 </foreignKey>
471</table>