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

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

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/database/Migrations/CustomerAddressesMigrator.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/database/Migrations/CustomerAddressesMigrator.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/CustomerAddressesMigrator.php#L10-L20`.

```php
<?php

namespace FluentCart\Database\Migrations;

class CustomerAddressesMigrator extends Migrator
{

    public static string $tableName = 'fct_customer_addresses';

    public static function getSqlSchema(): string
    {
        $indexPrefix = static::getDbPrefix() . 'fct_cus_ad_';
        return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
                `customer_id` BIGINT UNSIGNED NOT NULL,
                `is_primary` TINYINT(1) NOT NULL DEFAULT 0,
                `type` VARCHAR(20) NOT NULL DEFAULT 'billing',
                `status` VARCHAR(20) NOT NULL DEFAULT 'active',
                `label` VARCHAR(50) NOT NULL DEFAULT '',
                `name` VARCHAR(192) NULL,
                `address_1` VARCHAR(192) NULL,
                `address_2` VARCHAR(192) NULL,
                `city` VARCHAR(192) NULL,
                `state` VARCHAR(192) NULL,
                `phone` VARCHAR(192) NULL,
                `email` VARCHAR(192) NULL,
                `postcode` VARCHAR(32) NULL,
                `country` VARCHAR(100) NULL,
                `meta` JSON DEFAULT NULL,
                `created_at` DATETIME NULL,
                `updated_at` DATETIME NULL,

                 INDEX `{$indexPrefix}_customer_is_primary` (`customer_id` ASC, `is_primary` ASC),
                 INDEX `{$indexPrefix}_type` (`type` ASC),
                 INDEX `{$indexPrefix}_status` (`status` ASC)";
    }

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

    public static function addMetaColumn()
    {
        // "ALTER TABLE %i ADD COLUMN `meta` JSON DEFAULT NULL AFTER `country`"
        static::addColumnIfNotExists('meta', 'JSON DEFAULT NULL', 'country');
    }
}


```
