PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
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
← All changes | database/Migrations/CartMigrator.php +18 -1 1.6.0 → 1.6.5 View file →
@@ -9,8 +9,10 @@
9 9
10 10 public static string $tableName = 'fct_carts';
11 11
12 12
13 + const CUSTOMER_RECOVERY_INDEX = 'idx_carts_customer_recovery';
14 +
13 15 public static function getSqlSchema(): string
14 16 {
15 17 return "`customer_id` BIGINT(20) UNSIGNED NULL,
16 18 `user_id` BIGINT(20) UNSIGNED NULL,
@@ -30,7 +32,22 @@
30 32 `completed_at` TIMESTAMP NULL,
31 33 `created_at` DATETIME NULL,
32 34 `updated_at` DATETIME NULL,
33 35 `deleted_at` TIMESTAMP NULL,
34 - UNIQUE KEY cart_hash (cart_hash)";
36 + UNIQUE KEY cart_hash (cart_hash),
37 + INDEX `" . self::CUSTOMER_RECOVERY_INDEX . "` (`customer_id` ASC, `cart_hash` ASC)";
38 + }
39 + public static function migrated()
40 + {
41 + static::addCustomerRecoveryIndex();
42 + }
43 +
44 + public static function addCustomerRecoveryIndex(): void
45 + {
46 + static::addIndexIfNotExists(self::CUSTOMER_RECOVERY_INDEX, ['customer_id', 'cart_hash']);
47 + }
48 +
49 + public static function hasCustomerRecoveryIndex(): bool
50 + {
51 + return static::hasIndex(self::CUSTOMER_RECOVERY_INDEX);
35 52 }
36 53 }