1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* CakePHPify : CakePHP Plugin for Shopify API Authentication |
4
|
|
|
* Copyright (c) Multidimension.al (http://multidimension.al) |
5
|
|
|
* Github : https://github.com/multidimension-al/cakephpify |
6
|
|
|
* |
7
|
|
|
* Licensed under The MIT License |
8
|
|
|
* For full copyright and license information, please see the LICENSE file |
9
|
|
|
* Redistributions of files must retain the above copyright notice. |
10
|
|
|
* |
11
|
|
|
* @copyright (c) Multidimension.al (http://multidimension.al) |
12
|
|
|
* @link https://github.com/multidimension-al/cakephpify CakePHPify Github |
13
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Multidimensional\Cakephpify\Migrations; |
17
|
|
|
|
18
|
|
|
use Migrations\AbstractMigration; |
19
|
|
|
|
20
|
|
|
class Database extends AbstractMigration |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @return void |
25
|
|
|
*/ |
26
|
|
|
public function up() |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
$this->table('shopify_access_tokens') |
29
|
|
|
->addColumn( |
30
|
|
|
'domain', |
31
|
|
|
'string', |
32
|
|
|
[ |
33
|
|
|
'default' => null, |
34
|
|
|
'limit' => 255, |
35
|
|
|
'null' => false, |
36
|
|
|
] |
37
|
|
|
) |
38
|
|
|
->addColumn( |
39
|
|
|
'api_key', |
40
|
|
|
'string', |
41
|
|
|
[ |
42
|
|
|
'default' => null, |
43
|
|
|
'limit' => 32, |
44
|
|
|
'null' => false, |
45
|
|
|
] |
46
|
|
|
) |
47
|
|
|
->addColumn( |
48
|
|
|
'token', |
49
|
|
|
'string', |
50
|
|
|
[ |
51
|
|
|
'default' => null, |
52
|
|
|
'limit' => 255, |
53
|
|
|
'null' => false, |
54
|
|
|
] |
55
|
|
|
) |
56
|
|
|
->addColumn( |
57
|
|
|
'created_at', |
58
|
|
|
'datetime', |
59
|
|
|
[ |
60
|
|
|
'default' => 'CURRENT_TIMESTAMP', |
61
|
|
|
'limit' => null, |
62
|
|
|
'null' => false, |
63
|
|
|
] |
64
|
|
|
) |
65
|
|
|
->addColumn( |
66
|
|
|
'updated_at', |
67
|
|
|
'datetime', |
68
|
|
|
[ |
69
|
|
|
'default' => 'CURRENT_TIMESTAMP', |
70
|
|
|
'limit' => null, |
71
|
|
|
'null' => false, |
72
|
|
|
] |
73
|
|
|
) |
74
|
|
|
->addColumn( |
75
|
|
|
'expired_at', |
76
|
|
|
'datetime', |
77
|
|
|
[ |
78
|
|
|
'default' => null, |
79
|
|
|
'limit' => null, |
80
|
|
|
'null' => true, |
81
|
|
|
] |
82
|
|
|
) |
83
|
|
|
->addIndex( |
84
|
|
|
[ |
85
|
|
|
'token', |
86
|
|
|
], |
87
|
|
|
['unique' => true] |
88
|
|
|
) |
89
|
|
|
->addIndex( |
90
|
|
|
[ |
91
|
|
|
'domain', |
92
|
|
|
] |
93
|
|
|
) |
94
|
|
|
->create(); |
95
|
|
|
|
96
|
|
|
$this->table('shopify_shops') |
97
|
|
|
->addColumn( |
98
|
|
|
'domain', |
99
|
|
|
'string', |
100
|
|
|
[ |
101
|
|
|
'default' => null, |
102
|
|
|
'limit' => 255, |
103
|
|
|
'null' => false, |
104
|
|
|
] |
105
|
|
|
) |
106
|
|
|
->addColumn( |
107
|
|
|
'name', |
108
|
|
|
'string', |
109
|
|
|
[ |
110
|
|
|
'default' => null, |
111
|
|
|
'limit' => 255, |
112
|
|
|
'null' => false, |
113
|
|
|
] |
114
|
|
|
) |
115
|
|
|
->addColumn( |
116
|
|
|
'email', |
117
|
|
|
'string', |
118
|
|
|
[ |
119
|
|
|
'default' => null, |
120
|
|
|
'limit' => 255, |
121
|
|
|
'null' => false, |
122
|
|
|
] |
123
|
|
|
) |
124
|
|
|
->addColumn( |
125
|
|
|
'shop_owner', |
126
|
|
|
'string', |
127
|
|
|
[ |
128
|
|
|
'default' => null, |
129
|
|
|
'limit' => 255, |
130
|
|
|
'null' => false, |
131
|
|
|
] |
132
|
|
|
) |
133
|
|
|
->addColumn( |
134
|
|
|
'address1', |
135
|
|
|
'string', |
136
|
|
|
[ |
137
|
|
|
'default' => null, |
138
|
|
|
'limit' => 255, |
139
|
|
|
'null' => false, |
140
|
|
|
] |
141
|
|
|
) |
142
|
|
|
->addColumn( |
143
|
|
|
'address2', |
144
|
|
|
'string', |
145
|
|
|
[ |
146
|
|
|
'default' => null, |
147
|
|
|
'limit' => 255, |
148
|
|
|
'null' => false, |
149
|
|
|
] |
150
|
|
|
) |
151
|
|
|
->addColumn( |
152
|
|
|
'city', |
153
|
|
|
'string', |
154
|
|
|
[ |
155
|
|
|
'default' => null, |
156
|
|
|
'limit' => 255, |
157
|
|
|
'null' => false, |
158
|
|
|
] |
159
|
|
|
) |
160
|
|
|
->addColumn( |
161
|
|
|
'province_code', |
162
|
|
|
'string', |
163
|
|
|
[ |
164
|
|
|
'default' => null, |
165
|
|
|
'limit' => 10, |
166
|
|
|
'null' => false, |
167
|
|
|
] |
168
|
|
|
) |
169
|
|
|
->addColumn( |
170
|
|
|
'province', |
171
|
|
|
'string', |
172
|
|
|
[ |
173
|
|
|
'default' => null, |
174
|
|
|
'limit' => 255, |
175
|
|
|
'null' => false, |
176
|
|
|
] |
177
|
|
|
) |
178
|
|
|
->addColumn( |
179
|
|
|
'zip', |
180
|
|
|
'string', |
181
|
|
|
[ |
182
|
|
|
'default' => null, |
183
|
|
|
'limit' => 10, |
184
|
|
|
'null' => false, |
185
|
|
|
] |
186
|
|
|
) |
187
|
|
|
->addColumn( |
188
|
|
|
'country', |
189
|
|
|
'string', |
190
|
|
|
[ |
191
|
|
|
'default' => null, |
192
|
|
|
'limit' => 2, |
193
|
|
|
'null' => false, |
194
|
|
|
] |
195
|
|
|
) |
196
|
|
|
->addColumn( |
197
|
|
|
'country_code', |
198
|
|
|
'string', |
199
|
|
|
[ |
200
|
|
|
'default' => null, |
201
|
|
|
'limit' => 2, |
202
|
|
|
'null' => false, |
203
|
|
|
] |
204
|
|
|
) |
205
|
|
|
->addColumn( |
206
|
|
|
'country_name', |
207
|
|
|
'string', |
208
|
|
|
[ |
209
|
|
|
'default' => null, |
210
|
|
|
'limit' => 255, |
211
|
|
|
'null' => false, |
212
|
|
|
] |
213
|
|
|
) |
214
|
|
|
->addColumn( |
215
|
|
|
'source', |
216
|
|
|
'string', |
217
|
|
|
[ |
218
|
|
|
'default' => null, |
219
|
|
|
'limit' => 255, |
220
|
|
|
'null' => true, |
221
|
|
|
] |
222
|
|
|
) |
223
|
|
|
->addColumn( |
224
|
|
|
'phone', |
225
|
|
|
'string', |
226
|
|
|
[ |
227
|
|
|
'default' => null, |
228
|
|
|
'limit' => 100, |
229
|
|
|
'null' => false, |
230
|
|
|
] |
231
|
|
|
) |
232
|
|
|
->addColumn( |
233
|
|
|
'created_at', |
234
|
|
|
'datetime', |
235
|
|
|
[ |
236
|
|
|
'default' => null, |
237
|
|
|
'limit' => null, |
238
|
|
|
'null' => false, |
239
|
|
|
] |
240
|
|
|
) |
241
|
|
|
->addColumn( |
242
|
|
|
'updated_at', |
243
|
|
|
'datetime', |
244
|
|
|
[ |
245
|
|
|
'default' => null, |
246
|
|
|
'limit' => null, |
247
|
|
|
'null' => false, |
248
|
|
|
] |
249
|
|
|
) |
250
|
|
|
->addColumn( |
251
|
|
|
'customer_email', |
252
|
|
|
'string', |
253
|
|
|
[ |
254
|
|
|
'default' => null, |
255
|
|
|
'limit' => 255, |
256
|
|
|
'null' => false, |
257
|
|
|
] |
258
|
|
|
) |
259
|
|
|
->addColumn( |
260
|
|
|
'latitude', |
261
|
|
|
'decimal', |
262
|
|
|
[ |
263
|
|
|
'default' => null, |
264
|
|
|
'null' => false, |
265
|
|
|
'precision' => 10, |
266
|
|
|
'scale' => 8, |
267
|
|
|
] |
268
|
|
|
) |
269
|
|
|
->addColumn( |
270
|
|
|
'longitude', |
271
|
|
|
'decimal', |
272
|
|
|
[ |
273
|
|
|
'default' => null, |
274
|
|
|
'null' => false, |
275
|
|
|
'precision' => 11, |
276
|
|
|
'scale' => 8, |
277
|
|
|
] |
278
|
|
|
) |
279
|
|
|
->addColumn( |
280
|
|
|
'primary_location_id', |
281
|
|
|
'integer', |
282
|
|
|
[ |
283
|
|
|
'default' => null, |
284
|
|
|
'limit' => 10, |
285
|
|
|
'null' => true, |
286
|
|
|
] |
287
|
|
|
) |
288
|
|
|
->addColumn( |
289
|
|
|
'primary_locale', |
290
|
|
|
'string', |
291
|
|
|
[ |
292
|
|
|
'default' => 'en', |
293
|
|
|
'limit' => 10, |
294
|
|
|
'null' => false, |
295
|
|
|
] |
296
|
|
|
) |
297
|
|
|
->addColumn( |
298
|
|
|
'currency', |
299
|
|
|
'string', |
300
|
|
|
[ |
301
|
|
|
'default' => 'USD', |
302
|
|
|
'limit' => 10, |
303
|
|
|
'null' => false, |
304
|
|
|
] |
305
|
|
|
) |
306
|
|
|
->addColumn( |
307
|
|
|
'iana_timezone', |
308
|
|
|
'string', |
309
|
|
|
[ |
310
|
|
|
'default' => null, |
311
|
|
|
'limit' => 255, |
312
|
|
|
'null' => false, |
313
|
|
|
] |
314
|
|
|
) |
315
|
|
|
->addColumn( |
316
|
|
|
'money_format', |
317
|
|
|
'string', |
318
|
|
|
[ |
319
|
|
|
'default' => '${{amount}}', |
320
|
|
|
'limit' => 255, |
321
|
|
|
'null' => false, |
322
|
|
|
] |
323
|
|
|
) |
324
|
|
|
->addColumn( |
325
|
|
|
'money_with_currency_format', |
326
|
|
|
'string', |
327
|
|
|
[ |
328
|
|
|
'default' => '${{amount}} USD', |
329
|
|
|
'limit' => 255, |
330
|
|
|
'null' => false, |
331
|
|
|
] |
332
|
|
|
) |
333
|
|
|
->addColumn( |
334
|
|
|
'taxes_included', |
335
|
|
|
'boolean', |
336
|
|
|
[ |
337
|
|
|
'default' => null, |
338
|
|
|
'limit' => null, |
339
|
|
|
'null' => true, |
340
|
|
|
] |
341
|
|
|
) |
342
|
|
|
->addColumn( |
343
|
|
|
'tax_shipping', |
344
|
|
|
'boolean', |
345
|
|
|
[ |
346
|
|
|
'default' => null, |
347
|
|
|
'limit' => null, |
348
|
|
|
'null' => true, |
349
|
|
|
] |
350
|
|
|
) |
351
|
|
|
->addColumn( |
352
|
|
|
'county_taxes', |
353
|
|
|
'boolean', |
354
|
|
|
[ |
355
|
|
|
'default' => null, |
356
|
|
|
'limit' => null, |
357
|
|
|
'null' => true, |
358
|
|
|
] |
359
|
|
|
) |
360
|
|
|
->addColumn( |
361
|
|
|
'plan_display_name', |
362
|
|
|
'string', |
363
|
|
|
[ |
364
|
|
|
'default' => null, |
365
|
|
|
'limit' => 255, |
366
|
|
|
'null' => false, |
367
|
|
|
] |
368
|
|
|
) |
369
|
|
|
->addColumn( |
370
|
|
|
'plan_name', |
371
|
|
|
'string', |
372
|
|
|
[ |
373
|
|
|
'default' => null, |
374
|
|
|
'limit' => 255, |
375
|
|
|
'null' => false, |
376
|
|
|
] |
377
|
|
|
) |
378
|
|
|
->addColumn( |
379
|
|
|
'has_discounts', |
380
|
|
|
'boolean', |
381
|
|
|
[ |
382
|
|
|
'default' => null, |
383
|
|
|
'limit' => null, |
384
|
|
|
'null' => true, |
385
|
|
|
] |
386
|
|
|
) |
387
|
|
|
->addColumn( |
388
|
|
|
'has_gift_cards', |
389
|
|
|
'boolean', |
390
|
|
|
[ |
391
|
|
|
'default' => null, |
392
|
|
|
'limit' => null, |
393
|
|
|
'null' => true, |
394
|
|
|
] |
395
|
|
|
) |
396
|
|
|
->addColumn( |
397
|
|
|
'myshopify_domain', |
398
|
|
|
'string', |
399
|
|
|
[ |
400
|
|
|
'default' => null, |
401
|
|
|
'limit' => 255, |
402
|
|
|
'null' => false, |
403
|
|
|
] |
404
|
|
|
) |
405
|
|
|
->addColumn( |
406
|
|
|
'google_apps_domain', |
407
|
|
|
'string', |
408
|
|
|
[ |
409
|
|
|
'default' => null, |
410
|
|
|
'limit' => 255, |
411
|
|
|
'null' => true, |
412
|
|
|
] |
413
|
|
|
) |
414
|
|
|
->addColumn( |
415
|
|
|
'google_apps_login_enabled', |
416
|
|
|
'string', |
417
|
|
|
[ |
418
|
|
|
'default' => null, |
419
|
|
|
'limit' => 255, |
420
|
|
|
'null' => true, |
421
|
|
|
] |
422
|
|
|
) |
423
|
|
|
->addColumn( |
424
|
|
|
'money_in_emails_format', |
425
|
|
|
'string', |
426
|
|
|
[ |
427
|
|
|
'default' => '${{amount}}', |
428
|
|
|
'limit' => 255, |
429
|
|
|
'null' => false, |
430
|
|
|
] |
431
|
|
|
) |
432
|
|
|
->addColumn( |
433
|
|
|
'money_with_currency_in_emails_format', |
434
|
|
|
'string', |
435
|
|
|
[ |
436
|
|
|
'default' => '${{amount}} USD', |
437
|
|
|
'limit' => 255, |
438
|
|
|
'null' => false, |
439
|
|
|
] |
440
|
|
|
) |
441
|
|
|
->addColumn( |
442
|
|
|
'eligible_for_payments', |
443
|
|
|
'boolean', |
444
|
|
|
[ |
445
|
|
|
'default' => null, |
446
|
|
|
'limit' => null, |
447
|
|
|
'null' => true, |
448
|
|
|
] |
449
|
|
|
) |
450
|
|
|
->addColumn( |
451
|
|
|
'requires_extra_payments_agreement', |
452
|
|
|
'boolean', |
453
|
|
|
[ |
454
|
|
|
'default' => null, |
455
|
|
|
'limit' => null, |
456
|
|
|
'null' => true, |
457
|
|
|
] |
458
|
|
|
) |
459
|
|
|
->addColumn( |
460
|
|
|
'password_enabled', |
461
|
|
|
'boolean', |
462
|
|
|
[ |
463
|
|
|
'default' => null, |
464
|
|
|
'limit' => null, |
465
|
|
|
'null' => true, |
466
|
|
|
] |
467
|
|
|
) |
468
|
|
|
->addColumn( |
469
|
|
|
'has_storefront', |
470
|
|
|
'boolean', |
471
|
|
|
[ |
472
|
|
|
'default' => null, |
473
|
|
|
'limit' => null, |
474
|
|
|
'null' => true, |
475
|
|
|
] |
476
|
|
|
) |
477
|
|
|
->addColumn( |
478
|
|
|
'eligible_for_card_reader_giveaway', |
479
|
|
|
'boolean', |
480
|
|
|
[ |
481
|
|
|
'default' => null, |
482
|
|
|
'limit' => null, |
483
|
|
|
'null' => true, |
484
|
|
|
] |
485
|
|
|
) |
486
|
|
|
->addColumn( |
487
|
|
|
'finances', |
488
|
|
|
'boolean', |
489
|
|
|
[ |
490
|
|
|
'default' => null, |
491
|
|
|
'limit' => null, |
492
|
|
|
'null' => true, |
493
|
|
|
] |
494
|
|
|
) |
495
|
|
|
->addColumn( |
496
|
|
|
'setup_required', |
497
|
|
|
'boolean', |
498
|
|
|
[ |
499
|
|
|
'default' => null, |
500
|
|
|
'limit' => null, |
501
|
|
|
'null' => true, |
502
|
|
|
] |
503
|
|
|
) |
504
|
|
|
->addColumn( |
505
|
|
|
'force_ssl', |
506
|
|
|
'boolean', |
507
|
|
|
[ |
508
|
|
|
'default' => null, |
509
|
|
|
'limit' => null, |
510
|
|
|
'null' => true, |
511
|
|
|
] |
512
|
|
|
) |
513
|
|
|
->addIndex( |
514
|
|
|
[ |
515
|
|
|
'domain', |
516
|
|
|
] |
517
|
|
|
) |
518
|
|
|
->create(); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @return void |
523
|
|
|
*/ |
524
|
|
|
public function down() |
525
|
|
|
{ |
526
|
|
|
$this->dropTable('shopify_access_tokens'); |
527
|
|
|
$this->dropTable('shopify_shops'); |
528
|
|
|
} |
529
|
|
|
} |
530
|
|
|
|
Even though PHP does not care about the name of your methods, it is generally a good practice to choose method names which can be easily understood by other human readers.