# fluent-cart/1.6.4/database/Migrations/CustomersMigrator.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 51 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/database/Migrations/CustomersMigrator.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/database/Migrations/CustomersMigrator.php
- Modified: 2026-04-07T13:41:30+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.4/code/database/Migrations/CustomersMigrator.php#L10-L20`.

```php
<?php

namespace FluentCart\Database\Migrations;

class CustomersMigrator extends Migrator
{

    public static string $tableName = 'fct_customers';

    public static function getSqlSchema(): string
    {
        $indexPrefix = static::getDbPrefix() . 'fct_cus_';

        return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
                `user_id` BIGINT UNSIGNED DEFAULT NULL,
                `contact_id` BIGINT UNSIGNED NOT NULL DEFAULT '0',
                `email` VARCHAR(192) NOT NULL DEFAULT '',
                `first_name` VARCHAR(192) NOT NULL DEFAULT '',
                `last_name` VARCHAR(192) NOT NULL DEFAULT '',
                `status` VARCHAR(45) NULL DEFAULT 'active',
                `purchase_value` json NULL,
                `purchase_count` BIGINT UNSIGNED NOT NULL DEFAULT '0',
                `ltv` BIGINT NOT NULL DEFAULT '0',
                `first_purchase_date` DATETIME NULL,
                `last_purchase_date` DATETIME NULL,
                `aov` DECIMAL(18,2) NULL,
                `notes` LONGTEXT NOT NULL,
                `uuid` VARCHAR(100) NULL DEFAULT '',
                `country` VARCHAR(45) NULL,
                `city` VARCHAR(45) NULL,
                `state` VARCHAR(45) NULL,
                `postcode` VARCHAR(45) NULL,
                `created_at` DATETIME NULL,
                `updated_at` DATETIME NULL,

                INDEX `{$indexPrefix}_email` (`email` ASC),
                INDEX `{$indexPrefix}_user_id` (`user_id` ASC)";
    }

    public static function migrated()
    {
        static::addLtvColumn();
    }

    public static function addLtvColumn()
    {
        // "ALTER TABLE %i ADD COLUMN `ltv` BIGINT NOT NULL DEFAULT '0' AFTER `purchase_count`"
        static::addColumnIfNotExists('ltv', "BIGINT NOT NULL DEFAULT '0'", 'purchase_count');
    }
}

```
