| @@ -50,9 +50,10 @@ | ||
| 50 | 50 | |
| 51 | 51 | INDEX `{$indexPrefix}_invoice_no` (`invoice_no`(191) ASC), |
| 52 | 52 | INDEX `{$indexPrefix}_status_type` (`type` ASC), |
| 53 | 53 | INDEX `{$indexPrefix}_customer_id` (`customer_id` ASC), |
| 54 | - INDEX `{$indexPrefix}_date_created_completed` (`created_at` ASC, `completed_at` ASC)"; | |
| 54 | + INDEX `{$indexPrefix}_date_created_completed` (`created_at` ASC, `completed_at` ASC), | |
| 55 | + INDEX `{$indexPrefix}_uuid` (`uuid` ASC)"; | |
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | public static function migrated() |
| 58 | 59 | { |
| @@ -60,8 +61,9 @@ | ||
| 60 | 61 | static::addTaxBehaviorColumn(); |
| 61 | 62 | static::addReceiptNumberColumn(); |
| 62 | 63 | static::renameDiscountTotalColumn(); |
| 63 | 64 | static::addPaymentStatusIndex(); |
| 65 | + static::addUuidIndex(); | |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | public static function addFeeTotalColumn() |
| 67 | 69 | { |
| @@ -90,6 +92,15 @@ | ||
| 90 | 92 | public static function addPaymentStatusIndex() |
| 91 | 93 | { |
| 92 | 94 | // "ALTER TABLE %i ADD INDEX `fct_payment_status` (`payment_status`, `id`)" |
| 93 | 95 | static::addIndexIfNotExists('fct_payment_status', ['payment_status', 'id']); |
| 96 | + } | |
| 97 | + | |
| 98 | + public static function addUuidIndex() | |
| 99 | + { | |
| 100 | + // "ALTER TABLE %i ADD INDEX `{prefix}fct_ord__uuid` (`uuid`)" | |
| 101 | + // Non-unique on purpose: speeds up the uuid collision check and every | |
| 102 | + // by-value order lookup (receipts, webhooks, customer profile) without | |
| 103 | + // enforcing a UNIQUE constraint. | |
| 104 | + static::addIndexIfNotExists(static::getDbPrefix() . 'fct_ord__uuid', 'uuid'); | |
| 94 | 105 | } |
| 95 | 106 | } |