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/SubscriptionsMigrator.php +26 -1 1.5.4 → 1.6.5 View file →
@@ -8,8 +8,10 @@
8 8
9 9 public static string $tableName = "fct_subscriptions";
10 10
11 11
12 + const CUSTOMER_RECOVERY_INDEX = 'idx_subscriptions_customer_recovery';
13 +
12 14 public static function getSqlSchema(): string
13 15 {
14 16 $indexPrefix = static::getDbPrefix() . 'fct_index_';
15 17
@@ -48,20 +50,34 @@
48 50 `updated_at` DATETIME NULL,
49 51
50 52 INDEX `{$indexPrefix}_order_subscription_idx` (`parent_order_id` ASC),
51 53 INDEX `{$indexPrefix}vendor_subscription_id_idx` (`vendor_subscription_id` ASC),
52 - INDEX `{$indexPrefix}_expiry_scan_idx` (`status`, `next_billing_date`, `id`)";
54 + INDEX `{$indexPrefix}_expiry_scan_idx` (`status`, `next_billing_date`, `id`),
55 + INDEX `{$indexPrefix}collection_method_idx` (`collection_method`),
56 + INDEX `" . self::CUSTOMER_RECOVERY_INDEX . "` (`customer_id` ASC, `id` ASC)";
53 57 }
54 58
55 59 public static function migrated()
56 60 {
61 + static::addCustomerRecoveryIndex();
57 62 static::addUuidColumn();
58 63 static::renameInitialAmountToSignupFee();
59 64 static::backfillEmptyUuids();
60 65 static::addVendorSubscriptionIdIndex();
61 66 static::addExpiryScanIndex();
67 + static::addCollectionMethodIndex();
62 68 }
63 69
70 + // Serves the store-managed cron guard: whereIn(collection_method,[manual,system])->exists().
71 + // Online DDL, builds over existing rows; column is NOT NULL so no legacy backfill.
72 + public static function addCollectionMethodIndex()
73 + {
74 + static::addIndexIfNotExists(
75 + static::getDbPrefix() . 'fct_index_collection_method_idx',
76 + 'collection_method'
77 + );
78 + }
79 +
64 80 public static function addVendorSubscriptionIdIndex()
65 81 {
66 82 static::addIndexIfNotExists(
67 83 static::getDbPrefix() . 'fct_index_vendor_subscription_id_idx',
@@ -115,6 +131,15 @@
115 131 }
116 132
117 133 (new Subscription())->batchUpdate($uuids);
118 134 } while ($subscriptions->count() >= $chunkSize);
135 + }
136 + public static function addCustomerRecoveryIndex(): void
137 + {
138 + static::addIndexIfNotExists(self::CUSTOMER_RECOVERY_INDEX, ['customer_id', 'id']);
139 + }
140 +
141 + public static function hasCustomerRecoveryIndex(): bool
142 + {
143 + return static::hasIndex(self::CUSTOMER_RECOVERY_INDEX);
119 144 }
120 145 }