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