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