Merge pull request #16799 from pradpnayak/priceSetSchema
[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 11 <name>id</name>
7e18723f 12 <uniqueName>address_id</uniqueName>
8f069c03 13 <type>int unsigned</type>
7e18723f 14 <export>true</export>
8f069c03
EM
15 <title>Address ID</title>
16 <required>true</required>
17 <comment>Unique Address ID</comment>
18 <add>1.1</add>
6a488035
TO
19 </field>
20 <primaryKey>
8f069c03
EM
21 <name>id</name>
22 <autoincrement>true</autoincrement>
6a488035
TO
23 </primaryKey>
24 <field>
8f069c03
EM
25 <name>contact_id</name>
26 <title>Contact ID</title>
27 <type>int unsigned</type>
28 <comment>FK to Contact ID</comment>
29 <add>2.0</add>
6a488035
TO
30 </field>
31 <foreignKey>
8f069c03
EM
32 <name>contact_id</name>
33 <table>civicrm_contact</table>
34 <key>id</key>
35 <add>2.0</add>
36 <onDelete>CASCADE</onDelete>
6a488035
TO
37 </foreignKey>
38 <field>
8f069c03
EM
39 <name>location_type_id</name>
40 <title>Address Location Type</title>
41 <type>int unsigned</type>
42 <comment>Which Location does this address belong to.</comment>
43 <add>2.0</add>
44 <pseudoconstant>
45 <table>civicrm_location_type</table>
46 <keyColumn>id</keyColumn>
47 <labelColumn>display_name</labelColumn>
48 </pseudoconstant>
49 <html>
50 <type>Select</type>
51 </html>
6a488035
TO
52 </field>
53 <index>
54 <name>index_location_type</name>
55 <fieldName>location_type_id</fieldName>
56 <add>2.0</add>
57 </index>
58 <field>
8f069c03 59 <name>is_primary</name>
b6673dcd 60 <title>Primary address</title>
8f069c03
EM
61 <type>boolean</type>
62 <default>0</default>
63 <comment>Is this the primary address.</comment>
64 <add>2.0</add>
999ab5e1 65 <html>
b6673dcd 66 <type>Radio</type>
999ab5e1 67 </html>
6a488035
TO
68 </field>
69 <index>
70 <name>index_is_primary</name>
71 <fieldName>is_primary</fieldName>
72 <add>2.0</add>
73 </index>
74 <field>
8f069c03
EM
75 <name>is_billing</name>
76 <title>Is Billing Address</title>
77 <type>boolean</type>
78 <default>0</default>
79 <comment>Is this the billing address.</comment>
80 <add>2.0</add>
999ab5e1
TM
81 <html>
82 <type>CheckBox</type>
83 </html>
6a488035
TO
84 </field>
85 <index>
86 <name>index_is_billing</name>
87 <fieldName>is_billing</fieldName>
88 <add>2.0</add>
89 </index>
90 <field>
8f069c03
EM
91 <name>street_address</name>
92 <title>Street Address</title>
93 <type>varchar</type>
94 <length>96</length>
95 <import>true</import>
96 <headerPattern>/(street|address)/i</headerPattern>
97 <dataPattern>/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i</dataPattern>
98 <comment>Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
99 number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
fb607354 100 delivery, etc.).</comment>
8f069c03 101 <add>1.1</add>
999ab5e1
TM
102 <html>
103 <type>Text</type>
104 </html>
6a488035
TO
105 </field>
106 <field>
8f069c03
EM
107 <name>street_number</name>
108 <title>Street Number</title>
109 <type>int</type>
110 <export>true</export>
111 <comment>Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.</comment>
112 <add>1.1</add>
999ab5e1
TM
113 <html>
114 <type>Text</type>
115 </html>
6a488035
TO
116 </field>
117 <field>
8f069c03
EM
118 <name>street_number_suffix</name>
119 <title>Street Number Suffix</title>
120 <type>varchar</type>
121 <length>8</length>
122 <export>true</export>
fb607354 123 <comment>Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A</comment>
8f069c03 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>
8ada2bfd 264 <controlField>state_province_id</controlField>
8f069c03
EM
265 </html>
266 <add>1.1</add>
6a488035
TO
267 </field>
268 <foreignKey>
8f069c03
EM
269 <name>county_id</name>
270 <table>civicrm_county</table>
271 <key>id</key>
272 <import>true</import>
273 <headerPattern>/county/i</headerPattern>
274 <dataPattern>/[A-Z]{2}/</dataPattern>
275 <add>1.1</add>
276 <onDelete>SET NULL</onDelete>
6a488035
TO
277 </foreignKey>
278 <field>
8f069c03 279 <name>state_province_id</name>
b248d52b 280 <title>State/Province</title>
8f069c03
EM
281 <type>int unsigned</type>
282 <comment>Which State_Province does this address belong to.</comment>
283 <pseudoconstant>
284 <table>civicrm_state_province</table>
285 <keyColumn>id</keyColumn>
286 <labelColumn>name</labelColumn>
287 </pseudoconstant>
65c86f7d 288 <localize_context>province</localize_context>
8f069c03 289 <html>
b248d52b 290 <type>ChainSelect</type>
8ada2bfd 291 <controlField>country_id</controlField>
8f069c03
EM
292 </html>
293 <add>1.1</add>
6a488035
TO
294 </field>
295 <foreignKey>
8f069c03
EM
296 <name>state_province_id</name>
297 <table>civicrm_state_province</table>
298 <key>id</key>
299 <import>true</import>
300 <headerPattern>/state|prov(ince)?/i</headerPattern>
301 <dataPattern>
302 /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
303 </dataPattern>
304 <add>1.1</add>
305 <onDelete>SET NULL</onDelete>
6a488035 306 </foreignKey>
8f069c03
EM
307 <field>
308 <name>postal_code_suffix</name>
d79be26c 309 <title>Postal Code Suffix</title>
8f069c03
EM
310 <type>varchar</type>
311 <length>12</length>
312 <import>true</import>
313 <headerPattern>/p(ostal)\sc(ode)\ss(uffix)/i</headerPattern>
314 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
315 <comment>Store the suffix, like the +4 part in the USPS system.</comment>
316 <add>1.1</add>
999ab5e1
TM
317 <html>
318 <type>Text</type>
d79be26c 319 <size>3</size>
999ab5e1 320 </html>
3c7d2158 321 </field>
8f069c03
EM
322 <field>
323 <name>postal_code</name>
d79be26c 324 <title>Postal Code</title>
8f069c03 325 <type>varchar</type>
c5219185 326 <length>64</length>
8f069c03
EM
327 <import>true</import>
328 <headerPattern>/postal|zip/i</headerPattern>
329 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
d79be26c 330 <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.</comment>
8f069c03 331 <add>1.1</add>
999ab5e1
TM
332 <html>
333 <type>Text</type>
d79be26c 334 <size>6</size>
999ab5e1 335 </html>
6a488035
TO
336 </field>
337 <field>
8f069c03
EM
338 <name>usps_adc</name>
339 <title>USPS Code</title>
340 <type>varchar</type>
341 <length>32</length>
342 <comment>USPS Bulk mailing code.</comment>
343 <add>1.1</add>
6a488035
TO
344 </field>
345 <field>
8f069c03
EM
346 <name>country_id</name>
347 <title>Country</title>
348 <type>int unsigned</type>
349 <comment>Which Country does this address belong to.</comment>
350 <pseudoconstant>
351 <table>civicrm_country</table>
352 <keyColumn>id</keyColumn>
353 <labelColumn>name</labelColumn>
354 <nameColumn>iso_code</nameColumn>
a8fdb24e 355 <abbrColumn>iso_code</abbrColumn>
8f069c03 356 </pseudoconstant>
65c86f7d 357 <localize_context>country</localize_context>
8f069c03
EM
358 <html>
359 <type>Select</type>
360 </html>
361 <add>1.1</add>
6a488035
TO
362 </field>
363 <foreignKey>
8f069c03
EM
364 <name>country_id</name>
365 <table>civicrm_country</table>
366 <key>id</key>
367 <import>true</import>
368 <headerPattern>/country/i</headerPattern>
369 <dataPattern>/\w+(\s\w+)?/</dataPattern>
370 <add>1.1</add>
371 <onDelete>SET NULL</onDelete>
6a488035
TO
372 </foreignKey>
373 <field>
8f069c03
EM
374 <name>geo_code_1</name>
375 <title>Latitude</title>
376 <type>float</type>
377 <import>true</import>
378 <headerPattern>/geo/i</headerPattern>
379 <comment>Latitude</comment>
380 <add>1.1</add>
999ab5e1
TM
381 <html>
382 <type>Text</type>
383 <size>9</size>
384 </html>
6a488035
TO
385 </field>
386 <field>
8f069c03
EM
387 <name>geo_code_2</name>
388 <title>Longitude</title>
389 <type>float</type>
390 <comment>Longitude</comment>
391 <import>true</import>
392 <headerPattern>/geo/i</headerPattern>
393 <add>1.1</add>
999ab5e1
TM
394 <html>
395 <type>Text</type>
396 <size>9</size>
397 </html>
6a488035 398 </field>
d56bfd0e
SL
399 <index>
400 <name>index_geo_code_1_geo_code_2</name>
401 <fieldName>geo_code_1</fieldName>
402 <fieldName>geo_code_2</fieldName>
403 </index>
6a488035 404 <field>
8f069c03 405 <name>manual_geo_code</name>
4fcfc078 406 <title>Is Manually Geocoded</title>
8f069c03
EM
407 <type>boolean</type>
408 <default>0</default>
409 <comment>Is this a manually entered geo code</comment>
410 <add>4.3</add>
999ab5e1
TM
411 <html>
412 <type>CheckBox</type>
413 </html>
4fcfc078 414 <export>true</export>
6a488035
TO
415 </field>
416 <field>
8f069c03
EM
417 <name>timezone</name>
418 <title>Timezone</title>
419 <type>varchar</type>
420 <length>8</length>
421 <comment>Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".</comment>
422 <add>1.1</add>
999ab5e1
TM
423 <html>
424 <type>Text</type>
425 </html>
6a488035
TO
426 </field>
427 <field>
8f069c03
EM
428 <name>name</name>
429 <uniqueName>address_name</uniqueName>
430 <title>Address Name</title>
431 <type>varchar</type>
432 <length>255</length>
433 <import>true</import>
434 <headerPattern>/^location|(l(ocation\s)?name)$/i</headerPattern>
435 <dataPattern>/^\w+$/</dataPattern>
436 <add>2.1</add>
999ab5e1
TM
437 <html>
438 <type>Text</type>
439 </html>
6a488035
TO
440 </field>
441 <field>
8f069c03
EM
442 <name>master_id</name>
443 <title>Master Address Belongs To</title>
444 <type>int unsigned</type>
445 <import>true</import>
446 <comment>FK to Address ID</comment>
447 <add>3.3</add>
6a488035
TO
448 </field>
449 <foreignKey>
8f069c03
EM
450 <name>master_id</name>
451 <table>civicrm_address</table>
452 <key>id</key>
453 <add>3.3</add>
454 <onDelete>SET NULL</onDelete>
6a488035
TO
455 </foreignKey>
456</table>