# fluent-cart/1.6.6/database/Migrations/CartMigrator.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.6. 54 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.6/code/database/Migrations/CartMigrator.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.6/raw/database/Migrations/CartMigrator.php
- Modified: 2026-09-24T15:16:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.6/code/database/Migrations/CartMigrator.php#L10-L20`.

```php
<?php

namespace FluentCart\Database\Migrations;

use FluentCart\Framework\Database\Schema;

class CartMigrator extends Migrator
{

    public static string $tableName = 'fct_carts';


    const CUSTOMER_RECOVERY_INDEX = 'idx_carts_customer_recovery';

    public static function getSqlSchema(): string
    {
        return "`customer_id` BIGINT(20) UNSIGNED NULL,
                `user_id` BIGINT(20) UNSIGNED NULL,
                `order_id` BIGINT(20) UNSIGNED NULL,
                `cart_hash` varchar(192) NOT NULL,
                `checkout_data` longtext NULL,
                `cart_data` longtext NULL,
                `utm_data` longtext NULL,
                `coupons` longtext NULL,
                `first_name` varchar(192) NULL,
                `last_name` varchar(192) NULL,
			    `email` varchar(192) NULL,
                `stage` VARCHAR(30) NULL DEFAULT 'draft', /* draft | pending | in-complete | completed */
                `cart_group` VARCHAR(30) NULL DEFAULT 'global',
                `user_agent` VARCHAR(192) NULL,
                `ip_address` VARCHAR(50) NULL,
                `completed_at` TIMESTAMP NULL,
                `created_at` DATETIME NULL,
                `updated_at` DATETIME NULL,
                `deleted_at` TIMESTAMP NULL,
                UNIQUE KEY cart_hash (cart_hash),
                INDEX `" . self::CUSTOMER_RECOVERY_INDEX . "` (`customer_id` ASC, `cart_hash` ASC)";
    }
    public static function migrated()
    {
        static::addCustomerRecoveryIndex();
    }

    public static function addCustomerRecoveryIndex(): void
    {
        static::addIndexIfNotExists(self::CUSTOMER_RECOVERY_INDEX, ['customer_id', 'cart_hash']);
    }

    public static function hasCustomerRecoveryIndex(): bool
    {
        return static::hasIndex(self::CUSTOMER_RECOVERY_INDEX);
    }
}

```
