PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.26
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.26
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 / OrderTaxRateMigrator.php

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

42 lines 1.2 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 OrderTaxRateMigrator extends Migrator
6 {
7
8 public static string $tableName = 'fct_order_tax_rate';
9
10 public static function getSqlSchema(): string
11 {
12 return "`id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
13 `order_id` BIGINT(20) UNSIGNED NOT NULL,
14 `tax_rate_id` BIGINT(20) UNSIGNED NOT NULL,
15 `shipping_tax` BIGINT NULL,
16 `order_tax` BIGINT NULL,
17 `total_tax` BIGINT NULL,
18 `meta` json DEFAULT NULL,
19 `filed_at` DATETIME NULL,
20 `created_at` DATETIME NULL,
21 `updated_at` DATETIME NULL";
22 }
23
24 public static function migrated()
25 {
26 static::addMetaColumn();
27 static::addFiledAtColumn();
28 }
29
30 public static function addMetaColumn()
31 {
32 // "ALTER TABLE %i ADD COLUMN `meta` JSON"
33 static::addColumnIfNotExists('meta', 'JSON');
34 }
35
36 public static function addFiledAtColumn()
37 {
38 // "ALTER TABLE %i ADD COLUMN `filed_at` DATETIME NULL AFTER `meta`"
39 static::addColumnIfNotExists('filed_at', 'DATETIME NULL', 'meta');
40 }
41 }
42