PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.21
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.21
1.6.5 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 All 48 releases
fluent-cart / database / Migrations / TaxRatesMigrator.php

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

45 lines 1.5 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 TaxRatesMigrator extends Migrator
6 {
7
8 public static string $tableName = 'fct_tax_rates';
9
10 public static function getSqlSchema(): string
11 {
12 $prefix = static::getDbPrefix();
13 $indexPrefix = $prefix . 'fct_txr_';
14
15 // postcode is text to allow multiple postcodes like: 12345, 23456, 34567 or ranges like: 12345...12350
16 return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
17 `class_id` BIGINT UNSIGNED NOT NULL,
18 `country` VARCHAR(45) NULL,
19 `state` VARCHAR(45) NULL,
20 `postcode` TEXT NULL,
21 `city` VARCHAR(45) NULL,
22 `rate` VARCHAR(45) NULL,
23 `name` VARCHAR(45) NULL,
24 `group` VARCHAR(45) NULL,
25 `priority` INT UNSIGNED NULL DEFAULT 1,
26 `is_compound` TINYINT UNSIGNED NULL DEFAULT 0,
27 `for_shipping` TINYINT UNSIGNED NULL DEFAULT NULL,
28 `for_order` TINYINT UNSIGNED NULL DEFAULT 0,
29
30 INDEX `{$indexPrefix}_txr_class_idx` (`class_id` ASC),
31 INDEX `{$indexPrefix}_priority_idx` (`priority` ASC)";
32 }
33
34 public static function migrated()
35 {
36 static::addGroupColumn();
37 }
38
39 public static function addGroupColumn()
40 {
41 // "ALTER TABLE %i ADD COLUMN `group` VARCHAR(45) NULL AFTER `name`"
42 static::addColumnIfNotExists('group', 'VARCHAR(45) NULL', 'name');
43 }
44 }
45