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