PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / database / Migrations / CustomerAddressesMigrator.php

CustomerAddressesMigrator.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at database/Migrations/CustomerAddressesMigrator.php

49 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\Database\Migrations;
4
5 class CustomerAddressesMigrator extends Migrator
6 {
7
8 public static string $tableName = 'fct_customer_addresses';
9
10 public static function getSqlSchema(): string
11 {
12 $indexPrefix = static::getDbPrefix() . 'fct_cus_ad_';
13 return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
14 `customer_id` BIGINT UNSIGNED NOT NULL,
15 `is_primary` TINYINT(1) NOT NULL DEFAULT 0,
16 `type` VARCHAR(20) NOT NULL DEFAULT 'billing',
17 `status` VARCHAR(20) NOT NULL DEFAULT 'active',
18 `label` VARCHAR(50) NOT NULL DEFAULT '',
19 `name` VARCHAR(192) NULL,
20 `address_1` VARCHAR(192) NULL,
21 `address_2` VARCHAR(192) NULL,
22 `city` VARCHAR(192) NULL,
23 `state` VARCHAR(192) NULL,
24 `phone` VARCHAR(192) NULL,
25 `email` VARCHAR(192) NULL,
26 `postcode` VARCHAR(32) NULL,
27 `country` VARCHAR(100) NULL,
28 `meta` JSON DEFAULT NULL,
29 `created_at` DATETIME NULL,
30 `updated_at` DATETIME NULL,
31
32 INDEX `{$indexPrefix}_customer_is_primary` (`customer_id` ASC, `is_primary` ASC),
33 INDEX `{$indexPrefix}_type` (`type` ASC),
34 INDEX `{$indexPrefix}_status` (`status` ASC)";
35 }
36
37 public static function migrated()
38 {
39 static::addMetaColumn();
40 }
41
42 public static function addMetaColumn()
43 {
44 // "ALTER TABLE %i ADD COLUMN `meta` JSON DEFAULT NULL AFTER `country`"
45 static::addColumnIfNotExists('meta', 'JSON DEFAULT NULL', 'country');
46 }
47 }
48
49