Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-07-14-22-39-05
[civicrm-core.git] / xml / schema / Contribute / ContributionRecur.xml
CommitLineData
6a488035
TO
1<?xml version="1.0" encoding="iso-8859-1" ?>
2<table>
3 <base>CRM/Contribute</base>
4 <class>ContributionRecur</class>
5 <name>civicrm_contribution_recur</name>
6 <add>1.6</add>
7 <log>true</log>
8 <field>
9 <name>id</name>
10 <type>int unsigned</type>
11 <required>true</required>
12 <comment>Contribution Recur ID</comment>
13 <add>1.6</add>
14 </field>
15 <primaryKey>
16 <name>id</name>
17 <autoincrement>true</autoincrement>
18 </primaryKey>
19 <field>
20 <name>contact_id</name>
21 <type>int unsigned</type>
22 <required>true</required>
23 <comment>Foreign key to civicrm_contact.id .</comment>
24 <add>1.6</add>
25 </field>
26 <foreignKey>
27 <name>contact_id</name>
28 <table>civicrm_contact</table>
29 <key>id</key>
30 <add>1.6</add>
31 <onDelete>CASCADE</onDelete>
32 </foreignKey>
33 <field>
34 <name>amount</name>
35 <type>decimal</type>
36 <required>true</required>
37 <comment>Amount to be contributed or charged each recurrence.</comment>
38 <add>1.6</add>
39 </field>
40 <field>
41 <name>currency</name>
42 <type>varchar</type>
43 <length>3</length>
44 <default>NULL</default>
45 <comment>3 character string, value from config setting or input via user.</comment>
46 <add>3.2</add>
bd44e0df
AS
47 <pseudoconstant>
48 <table>civicrm_currency</table>
49 <keyColumn>name</keyColumn>
a38a89fc
CW
50 <labelColumn>full_name</labelColumn>
51 <nameColumn>numeric_code</nameColumn>
bd44e0df 52 </pseudoconstant>
6a488035
TO
53 </field>
54 <field>
55 <name>frequency_unit</name>
6d68a4cb 56 <type>enum</type>
6a488035
TO
57 <values>day,week,month,year</values>
58 <default>'month'</default>
59 <comment>Time units for recurrence of payment.</comment>
60 <add>1.6</add>
61 </field>
62 <field>
63 <name>frequency_interval</name>
64 <type>int unsigned</type>
65 <required>true</required>
66 <comment>Number of time units for recurrence of payment.</comment>
67 <add>1.6</add>
68 </field>
69 <field>
70 <name>installments</name>
71 <type>int unsigned</type>
72 <comment>Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.</comment>
73 <add>1.6</add>
74 </field>
75 <field>
76 <name>start_date</name>
77 <type>datetime</type>
78 <required>true</required>
79 <comment>The date the first scheduled recurring contribution occurs.</comment>
80 <add>1.6</add>
81 </field>
82 <field>
83 <name>create_date</name>
84 <type>datetime</type>
85 <required>true</required>
86 <comment>When this recurring contribution record was created.</comment>
87 <add>1.6</add>
88 </field>
89 <field>
90 <name>modified_date</name>
91 <type>datetime</type>
92 <comment>Last updated date for this record. mostly the last time a payment was received</comment>
93 <add>1.6</add>
94 </field>
95 <field>
96 <name>cancel_date</name>
97 <type>datetime</type>
98 <comment>Date this recurring contribution was cancelled by contributor- if we can get access to it</comment>
99 <add>1.6</add>
100 </field>
101 <field>
102 <name>end_date</name>
103 <type>datetime</type>
104 <comment>Date this recurring contribution finished successfully</comment>
105 <add>1.6</add>
106 </field>
6d68a4cb 107 <field>
6a488035 108 <name>processor_id</name>
6d68a4cb 109 <type>varchar</type>
6a488035 110 <length>255</length>
6d68a4cb
CW
111 <comment>Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??</comment>
112 <add>1.6</add>
113 </field>
114 <field>
115 <name>trxn_id</name>
6a488035 116 <title>Transaction ID</title>
6d68a4cb
CW
117 <type>varchar</type>
118 <length>255</length>
6a488035 119 <comment>unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method</comment>
6d68a4cb
CW
120 <add>1.6</add>
121 </field>
122 <field>
123 <name>invoice_id</name>
6a488035 124 <title>Invoice ID</title>
6d68a4cb
CW
125 <type>varchar</type>
126 <length>255</length>
6a488035 127 <comment>unique invoice id, system generated or passed in</comment>
6d68a4cb
CW
128 <add>1.6</add>
129 </field>
6a488035
TO
130 <index>
131 <name>UI_contrib_trxn_id</name>
132 <fieldName>trxn_id</fieldName>
133 <unique>true</unique>
134 <add>2.1</add>
135 </index>
136 <index>
137 <name>UI_contrib_invoice_id</name>
138 <fieldName>invoice_id</fieldName>
139 <unique>true</unique>
140 <add>2.1</add>
141 </index>
142 <field>
143 <name>contribution_status_id</name>
144 <title>Recurring Contribution Status</title>
145 <type>int unsigned</type>
146 <default>1</default>
147 <import>true</import>
148 <add>1.6</add>
149 </field>
150 <index>
151 <name>index_contribution_status</name>
152 <fieldName>contribution_status_id</fieldName>
153 <add>1.6</add>
154 </index>
6d68a4cb
CW
155 <field>
156 <name>is_test</name>
6a488035
TO
157 <title>Test</title>
158 <type>boolean</type>
159 <default>0</default>
160 <import>true</import>
161 </field>
162 <field>
163 <name>cycle_day</name>
164 <type>int unsigned</type>
165 <default>1</default>
166 <required>true</required>
167 <comment>Day in the period when the payment should be charged e.g. 1st of month, 15th etc.</comment>
168 <add>1.6</add>
169 </field>
170 <field>
171 <name>next_sched_contribution</name>
172 <type>datetime</type>
173 <comment>At Groundspring this was used by the cron job which triggered payments. If we\'re not doing that but we know about payments, it might still be useful to store for display to org andor contributors.</comment>
174 <add>1.6</add>
175 </field>
176 <field>
177 <name>failure_count</name>
178 <type>int unsigned</type>
179 <default>0</default>
180 <comment>Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.</comment>
181 <add>1.6</add>
182 </field>
183 <field>
184 <name>failure_retry_date</name>
185 <type>datetime</type>
186 <comment>At Groundspring we set a business rule to retry failed payments every 7 days - and stored the next scheduled attempt date there.</comment>
187 <add>1.6</add>
188 </field>
6d68a4cb 189 <field>
6a488035 190 <name>auto_renew</name>
6d68a4cb
CW
191 <type>boolean</type>
192 <required>true</required>
6a488035 193 <default>0</default>
6d68a4cb
CW
194 <comment>Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.</comment>
195 <add>1.6</add>
6a488035
TO
196 </field>
197 <field>
198 <name>payment_processor_id</name>
199 <type>int unsigned</type>
200 <comment>Foreign key to civicrm_payment_processor.id</comment>
201 <add>3.3</add>
202 </field>
6d68a4cb
CW
203 <foreignKey>
204 <name>payment_processor_id</name>
205 <table>civicrm_payment_processor</table>
206 <key>id</key>
207 <add>3.3</add>
6a488035
TO
208 <onDelete>SET NULL</onDelete>
209 </foreignKey>
210 <field>
211 <name>contribution_type_id</name>
212 <title>Contribution Type</title>
213 <export>false</export>
214 <type>int unsigned</type>
215 <comment>FK to Contribution Type</comment>
216 <add>4.1</add>
217 <drop>4.3</drop>
218 </field>
219 <foreignKey>
220 <name>contribution_type_id</name>
221 <table>civicrm_contribution_type</table>
222 <key>id</key>
223 <add>4.1</add>
224 <drop>4.3</drop>
225 <onDelete>SET NULL</onDelete>
226 </foreignKey>
227 <field>
228 <name>financial_type_id</name>
229 <title>Financial Type</title>
230 <export>false</export>
231 <type>int unsigned</type>
232 <comment>FK to Financial Type</comment>
233 <add>4.3</add>
234 </field>
235 <foreignKey>
236 <name>financial_type_id</name>
237 <table>civicrm_financial_type</table>
238 <key>id</key>
239 <add>4.3</add>
240 <onDelete>SET NULL</onDelete>
241 </foreignKey>
242 <field>
243 <name>payment_instrument_id</name>
244 <title>Payment Instrument</title>
245 <type>int unsigned</type>
246 <comment>FK to Payment Instrument</comment>
6d68a4cb
CW
247 <pseudoconstant>
248 <optionGroupName>payment_instrument</optionGroupName>
249 </pseudoconstant>
6a488035
TO
250 <add>4.1</add>
251 </field>
252 <index>
253 <name>UI_contrib_payment_instrument_id</name>
254 <fieldName>payment_instrument_id</fieldName>
255 <add>4.1</add>
256 </index>
257 <field>
258 <name>campaign_id</name>
259 <uniqueName>contribution_campaign_id</uniqueName>
260 <type>int unsigned</type>
261 <title>Campaign ID</title>
262 <import>true</import>
263 <comment>The campaign for which this contribution has been triggered.</comment>
264 <add>4.1</add>
265 </field>
266 <foreignKey>
267 <name>campaign_id</name>
268 <table>civicrm_campaign</table>
269 <key>id</key>
270 <onDelete>SET NULL</onDelete>
271 </foreignKey>
6d68a4cb
CW
272 <field>
273 <name>is_email_receipt</name>
274 <type>boolean</type>
275 <comment>if true, receipt is automatically emailed to contact on each successful payment</comment>
6a488035 276 <default>1</default>
6d68a4cb
CW
277 <add>4.1</add>
278 </field>
6a488035 279</table>