Merge pull request #4302 from guanhuan/additional-participant-fixes
[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>
6a488035
TO
63 </field>
64 <index>
65 <name>index_is_primary</name>
66 <fieldName>is_primary</fieldName>
67 <add>2.0</add>
68 </index>
69 <field>
8f069c03
EM
70 <name>is_billing</name>
71 <title>Is Billing Address</title>
72 <type>boolean</type>
73 <default>0</default>
74 <comment>Is this the billing address.</comment>
75 <add>2.0</add>
6a488035
TO
76 </field>
77 <index>
78 <name>index_is_billing</name>
79 <fieldName>is_billing</fieldName>
80 <add>2.0</add>
81 </index>
82 <field>
8f069c03
EM
83 <name>street_address</name>
84 <title>Street Address</title>
85 <type>varchar</type>
86 <length>96</length>
87 <import>true</import>
88 <headerPattern>/(street|address)/i</headerPattern>
89 <dataPattern>/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i</dataPattern>
90 <comment>Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
91 number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
92 delivery, etc.).
93 </comment>
94 <add>1.1</add>
6a488035
TO
95 </field>
96 <field>
8f069c03
EM
97 <name>street_number</name>
98 <title>Street Number</title>
99 <type>int</type>
100 <export>true</export>
101 <comment>Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.</comment>
102 <add>1.1</add>
6a488035
TO
103 </field>
104 <field>
8f069c03
EM
105 <name>street_number_suffix</name>
106 <title>Street Number Suffix</title>
107 <type>varchar</type>
108 <length>8</length>
109 <export>true</export>
110 <comment>Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A
111 </comment>
112 <add>1.1</add>
6a488035
TO
113 </field>
114 <field>
8f069c03
EM
115 <name>street_number_predirectional</name>
116 <title>Street Direction Prefix</title>
117 <type>varchar</type>
118 <length>8</length>
119 <comment>Directional prefix, e.g. SE Main St, SE is the prefix.</comment>
120 <add>1.1</add>
6a488035
TO
121 </field>
122 <field>
8f069c03
EM
123 <name>street_name</name>
124 <type>varchar</type>
125 <title>Street Name</title>
126 <length>64</length>
127 <export>true</export>
128 <comment>Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.</comment>
129 <add>1.1</add>
6a488035
TO
130 </field>
131 <index>
8f069c03
EM
132 <name>index_street_name</name>
133 <fieldName>street_name</fieldName>
134 <add>1.1</add>
6a488035
TO
135 </index>
136 <field>
8f069c03
EM
137 <name>street_type</name>
138 <title>Street Type</title>
139 <type>varchar</type>
140 <length>8</length>
141 <comment>St, Rd, Dr, etc.</comment>
142 <add>1.1</add>
6a488035
TO
143 </field>
144 <field>
8f069c03
EM
145 <name>street_number_postdirectional</name>
146 <title>Street Direction Suffix</title>
147 <type>varchar</type>
148 <length>8</length>
149 <comment>Directional prefix, e.g. Main St S, S is the suffix.</comment>
150 <add>1.1</add>
6a488035
TO
151 </field>
152 <field>
8f069c03
EM
153 <name>street_unit</name>
154 <title>Street Unit</title>
155 <type>varchar</type>
156 <length>16</length>
157 <export>true</export>
158 <comment>Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200</comment>
159 <add>1.1</add>
6a488035
TO
160 </field>
161 <field>
8f069c03
EM
162 <name>supplemental_address_1</name>
163 <title>Supplemental Address 1</title>
164 <type>varchar</type>
165 <length>96</length>
166 <import>true</import>
167 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
168 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
169 <comment>Supplemental Address Information, Line 1</comment>
170 <add>1.1</add>
6a488035
TO
171 </field>
172 <field>
8f069c03
EM
173 <name>supplemental_address_2</name>
174 <title>Supplemental Address 2</title>
175 <type>varchar</type>
176 <length>96</length>
177 <import>true</import>
178 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
179 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
180 <comment>Supplemental Address Information, Line 2</comment>
181 <add>1.1</add>
6a488035
TO
182 </field>
183 <field>
8f069c03
EM
184 <name>supplemental_address_3</name>
185 <title>Supplemental Address 3</title>
186 <type>varchar</type>
187 <length>96</length>
188 <comment>Supplemental Address Information, Line 3</comment>
189 <add>1.1</add>
6a488035
TO
190 </field>
191 <field>
8f069c03
EM
192 <name>city</name>
193 <title>City</title>
194 <type>varchar</type>
195 <length>64</length>
196 <import>true</import>
197 <headerPattern>/city/i</headerPattern>
198 <dataPattern>/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/</dataPattern>
199 <comment>City, Town or Village Name.</comment>
200 <add>1.1</add>
6a488035
TO
201 </field>
202 <index>
8f069c03
EM
203 <name>index_city</name>
204 <fieldName>city</fieldName>
205 <add>1.1</add>
6a488035
TO
206 </index>
207 <field>
8f069c03
EM
208 <name>county_id</name>
209 <type>int unsigned</type>
210 <title>County</title>
211 <comment>Which County does this address belong to.</comment>
212 <pseudoconstant>
213 <table>civicrm_county</table>
214 <keyColumn>id</keyColumn>
215 <labelColumn>name</labelColumn>
216 </pseudoconstant>
217 <html>
218 <type>Select</type>
219 </html>
220 <add>1.1</add>
6a488035
TO
221 </field>
222 <foreignKey>
8f069c03
EM
223 <name>county_id</name>
224 <table>civicrm_county</table>
225 <key>id</key>
226 <import>true</import>
227 <headerPattern>/county/i</headerPattern>
228 <dataPattern>/[A-Z]{2}/</dataPattern>
229 <add>1.1</add>
230 <onDelete>SET NULL</onDelete>
6a488035
TO
231 </foreignKey>
232 <field>
8f069c03
EM
233 <name>state_province_id</name>
234 <title>State</title>
235 <type>int unsigned</type>
236 <comment>Which State_Province does this address belong to.</comment>
237 <pseudoconstant>
238 <table>civicrm_state_province</table>
239 <keyColumn>id</keyColumn>
240 <labelColumn>name</labelColumn>
241 </pseudoconstant>
242 <html>
243 <type>Select</type>
244 </html>
245 <add>1.1</add>
6a488035
TO
246 </field>
247 <foreignKey>
8f069c03
EM
248 <name>state_province_id</name>
249 <table>civicrm_state_province</table>
250 <key>id</key>
251 <import>true</import>
252 <headerPattern>/state|prov(ince)?/i</headerPattern>
253 <dataPattern>
254 /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
255 </dataPattern>
256 <add>1.1</add>
257 <onDelete>SET NULL</onDelete>
6a488035 258 </foreignKey>
8f069c03
EM
259 <field>
260 <name>postal_code_suffix</name>
261 <title>Postal Code Suffix</title>
262 <type>varchar</type>
263 <length>12</length>
264 <import>true</import>
265 <headerPattern>/p(ostal)\sc(ode)\ss(uffix)/i</headerPattern>
266 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
267 <comment>Store the suffix, like the +4 part in the USPS system.</comment>
268 <add>1.1</add>
3c7d2158 269 </field>
8f069c03
EM
270 <field>
271 <name>postal_code</name>
272 <title>Postal Code</title>
273 <type>varchar</type>
274 <length>12</length>
275 <import>true</import>
276 <headerPattern>/postal|zip/i</headerPattern>
277 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
278 <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate
279 validation.
280 </comment>
281 <add>1.1</add>
6a488035
TO
282 </field>
283 <field>
8f069c03
EM
284 <name>usps_adc</name>
285 <title>USPS Code</title>
286 <type>varchar</type>
287 <length>32</length>
288 <comment>USPS Bulk mailing code.</comment>
289 <add>1.1</add>
6a488035
TO
290 </field>
291 <field>
8f069c03
EM
292 <name>country_id</name>
293 <title>Country</title>
294 <type>int unsigned</type>
295 <comment>Which Country does this address belong to.</comment>
296 <pseudoconstant>
297 <table>civicrm_country</table>
298 <keyColumn>id</keyColumn>
299 <labelColumn>name</labelColumn>
300 <nameColumn>iso_code</nameColumn>
301 </pseudoconstant>
302 <html>
303 <type>Select</type>
304 </html>
305 <add>1.1</add>
6a488035
TO
306 </field>
307 <foreignKey>
8f069c03
EM
308 <name>country_id</name>
309 <table>civicrm_country</table>
310 <key>id</key>
311 <import>true</import>
312 <headerPattern>/country/i</headerPattern>
313 <dataPattern>/\w+(\s\w+)?/</dataPattern>
314 <add>1.1</add>
315 <onDelete>SET NULL</onDelete>
6a488035
TO
316 </foreignKey>
317 <field>
8f069c03
EM
318 <name>geo_code_1</name>
319 <title>Latitude</title>
320 <type>float</type>
321 <import>true</import>
322 <headerPattern>/geo/i</headerPattern>
323 <comment>Latitude</comment>
324 <add>1.1</add>
6a488035
TO
325 </field>
326 <field>
8f069c03
EM
327 <name>geo_code_2</name>
328 <title>Longitude</title>
329 <type>float</type>
330 <comment>Longitude</comment>
331 <import>true</import>
332 <headerPattern>/geo/i</headerPattern>
333 <add>1.1</add>
6a488035
TO
334 </field>
335 <field>
8f069c03
EM
336 <name>manual_geo_code</name>
337 <title>Is manually geocoded</title>
338 <type>boolean</type>
339 <default>0</default>
340 <comment>Is this a manually entered geo code</comment>
341 <add>4.3</add>
6a488035
TO
342 </field>
343 <field>
8f069c03
EM
344 <name>timezone</name>
345 <title>Timezone</title>
346 <type>varchar</type>
347 <length>8</length>
348 <comment>Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".</comment>
349 <add>1.1</add>
6a488035
TO
350 </field>
351 <field>
8f069c03
EM
352 <name>name</name>
353 <uniqueName>address_name</uniqueName>
354 <title>Address Name</title>
355 <type>varchar</type>
356 <length>255</length>
357 <import>true</import>
358 <headerPattern>/^location|(l(ocation\s)?name)$/i</headerPattern>
359 <dataPattern>/^\w+$/</dataPattern>
360 <add>2.1</add>
6a488035
TO
361 </field>
362 <field>
8f069c03
EM
363 <name>master_id</name>
364 <title>Master Address Belongs To</title>
365 <type>int unsigned</type>
366 <import>true</import>
367 <comment>FK to Address ID</comment>
368 <add>3.3</add>
6a488035
TO
369 </field>
370 <foreignKey>
8f069c03
EM
371 <name>master_id</name>
372 <table>civicrm_address</table>
373 <key>id</key>
374 <add>3.3</add>
375 <onDelete>SET NULL</onDelete>
6a488035
TO
376 </foreignKey>
377</table>