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