Merge pull request #12732 from eileenmcnaughton/setting_form1
[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>
207f62c6
AS
224 <import>true</import>
225 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
226 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
8f069c03
EM
227 <comment>Supplemental Address Information, Line 3</comment>
228 <add>1.1</add>
999ab5e1
TM
229 <html>
230 <type>Text</type>
231 </html>
6a488035
TO
232 </field>
233 <field>
8f069c03
EM
234 <name>city</name>
235 <title>City</title>
236 <type>varchar</type>
237 <length>64</length>
238 <import>true</import>
239 <headerPattern>/city/i</headerPattern>
240 <dataPattern>/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/</dataPattern>
241 <comment>City, Town or Village Name.</comment>
242 <add>1.1</add>
999ab5e1
TM
243 <html>
244 <type>Text</type>
245 </html>
6a488035
TO
246 </field>
247 <index>
8f069c03
EM
248 <name>index_city</name>
249 <fieldName>city</fieldName>
250 <add>1.1</add>
6a488035
TO
251 </index>
252 <field>
8f069c03
EM
253 <name>county_id</name>
254 <type>int unsigned</type>
255 <title>County</title>
256 <comment>Which County does this address belong to.</comment>
257 <pseudoconstant>
258 <table>civicrm_county</table>
259 <keyColumn>id</keyColumn>
260 <labelColumn>name</labelColumn>
261 </pseudoconstant>
262 <html>
b248d52b 263 <type>ChainSelect</type>
8f069c03
EM
264 </html>
265 <add>1.1</add>
6a488035
TO
266 </field>
267 <foreignKey>
8f069c03
EM
268 <name>county_id</name>
269 <table>civicrm_county</table>
270 <key>id</key>
271 <import>true</import>
272 <headerPattern>/county/i</headerPattern>
273 <dataPattern>/[A-Z]{2}/</dataPattern>
274 <add>1.1</add>
275 <onDelete>SET NULL</onDelete>
6a488035
TO
276 </foreignKey>
277 <field>
8f069c03 278 <name>state_province_id</name>
b248d52b 279 <title>State/Province</title>
8f069c03
EM
280 <type>int unsigned</type>
281 <comment>Which State_Province does this address belong to.</comment>
282 <pseudoconstant>
283 <table>civicrm_state_province</table>
284 <keyColumn>id</keyColumn>
285 <labelColumn>name</labelColumn>
286 </pseudoconstant>
287 <html>
b248d52b 288 <type>ChainSelect</type>
8f069c03
EM
289 </html>
290 <add>1.1</add>
6a488035
TO
291 </field>
292 <foreignKey>
8f069c03
EM
293 <name>state_province_id</name>
294 <table>civicrm_state_province</table>
295 <key>id</key>
296 <import>true</import>
297 <headerPattern>/state|prov(ince)?/i</headerPattern>
298 <dataPattern>
299 /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
300 </dataPattern>
301 <add>1.1</add>
302 <onDelete>SET NULL</onDelete>
6a488035 303 </foreignKey>
8f069c03
EM
304 <field>
305 <name>postal_code_suffix</name>
d79be26c 306 <title>Postal Code Suffix</title>
8f069c03
EM
307 <type>varchar</type>
308 <length>12</length>
309 <import>true</import>
310 <headerPattern>/p(ostal)\sc(ode)\ss(uffix)/i</headerPattern>
311 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
312 <comment>Store the suffix, like the +4 part in the USPS system.</comment>
313 <add>1.1</add>
999ab5e1
TM
314 <html>
315 <type>Text</type>
d79be26c 316 <size>3</size>
999ab5e1 317 </html>
3c7d2158 318 </field>
8f069c03
EM
319 <field>
320 <name>postal_code</name>
d79be26c 321 <title>Postal Code</title>
8f069c03 322 <type>varchar</type>
c5219185 323 <length>64</length>
8f069c03
EM
324 <import>true</import>
325 <headerPattern>/postal|zip/i</headerPattern>
326 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
d79be26c 327 <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.</comment>
8f069c03 328 <add>1.1</add>
999ab5e1
TM
329 <html>
330 <type>Text</type>
d79be26c 331 <size>6</size>
999ab5e1 332 </html>
6a488035
TO
333 </field>
334 <field>
8f069c03
EM
335 <name>usps_adc</name>
336 <title>USPS Code</title>
337 <type>varchar</type>
338 <length>32</length>
339 <comment>USPS Bulk mailing code.</comment>
340 <add>1.1</add>
6a488035
TO
341 </field>
342 <field>
8f069c03
EM
343 <name>country_id</name>
344 <title>Country</title>
345 <type>int unsigned</type>
346 <comment>Which Country does this address belong to.</comment>
347 <pseudoconstant>
348 <table>civicrm_country</table>
349 <keyColumn>id</keyColumn>
350 <labelColumn>name</labelColumn>
351 <nameColumn>iso_code</nameColumn>
352 </pseudoconstant>
353 <html>
354 <type>Select</type>
355 </html>
356 <add>1.1</add>
6a488035
TO
357 </field>
358 <foreignKey>
8f069c03
EM
359 <name>country_id</name>
360 <table>civicrm_country</table>
361 <key>id</key>
362 <import>true</import>
363 <headerPattern>/country/i</headerPattern>
364 <dataPattern>/\w+(\s\w+)?/</dataPattern>
365 <add>1.1</add>
366 <onDelete>SET NULL</onDelete>
6a488035
TO
367 </foreignKey>
368 <field>
8f069c03
EM
369 <name>geo_code_1</name>
370 <title>Latitude</title>
371 <type>float</type>
372 <import>true</import>
373 <headerPattern>/geo/i</headerPattern>
374 <comment>Latitude</comment>
375 <add>1.1</add>
999ab5e1
TM
376 <html>
377 <type>Text</type>
378 <size>9</size>
379 </html>
6a488035
TO
380 </field>
381 <field>
8f069c03
EM
382 <name>geo_code_2</name>
383 <title>Longitude</title>
384 <type>float</type>
385 <comment>Longitude</comment>
386 <import>true</import>
387 <headerPattern>/geo/i</headerPattern>
388 <add>1.1</add>
999ab5e1
TM
389 <html>
390 <type>Text</type>
391 <size>9</size>
392 </html>
6a488035
TO
393 </field>
394 <field>
8f069c03
EM
395 <name>manual_geo_code</name>
396 <title>Is manually geocoded</title>
397 <type>boolean</type>
398 <default>0</default>
399 <comment>Is this a manually entered geo code</comment>
400 <add>4.3</add>
999ab5e1
TM
401 <html>
402 <type>CheckBox</type>
403 </html>
6a488035
TO
404 </field>
405 <field>
8f069c03
EM
406 <name>timezone</name>
407 <title>Timezone</title>
408 <type>varchar</type>
409 <length>8</length>
410 <comment>Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".</comment>
411 <add>1.1</add>
999ab5e1
TM
412 <html>
413 <type>Text</type>
414 </html>
6a488035
TO
415 </field>
416 <field>
8f069c03
EM
417 <name>name</name>
418 <uniqueName>address_name</uniqueName>
419 <title>Address Name</title>
420 <type>varchar</type>
421 <length>255</length>
422 <import>true</import>
423 <headerPattern>/^location|(l(ocation\s)?name)$/i</headerPattern>
424 <dataPattern>/^\w+$/</dataPattern>
425 <add>2.1</add>
999ab5e1
TM
426 <html>
427 <type>Text</type>
428 </html>
6a488035
TO
429 </field>
430 <field>
8f069c03
EM
431 <name>master_id</name>
432 <title>Master Address Belongs To</title>
433 <type>int unsigned</type>
434 <import>true</import>
435 <comment>FK to Address ID</comment>
436 <add>3.3</add>
6a488035
TO
437 </field>
438 <foreignKey>
8f069c03
EM
439 <name>master_id</name>
440 <table>civicrm_address</table>
441 <key>id</key>
442 <add>3.3</add>
443 <onDelete>SET NULL</onDelete>
6a488035
TO
444 </foreignKey>
445</table>