# fluent-cart/1.4.1/database/Migrations/AttributeGroupsMigrator.php

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

- Page: https://pluginprobe.com/plugins/fluent-cart/1.4.1/code/database/Migrations/AttributeGroupsMigrator.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.4.1/raw/database/Migrations/AttributeGroupsMigrator.php
- Modified: 2026-05-14T15:41:54+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.4.1/code/database/Migrations/AttributeGroupsMigrator.php#L10-L20`.

```php
<?php

namespace FluentCart\Database\Migrations;

class AttributeGroupsMigrator extends Migrator
{
    public static string $tableName = 'fct_atts_groups';

    public static function getSqlSchema(): string
    {
        return "`id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
                `title` VARCHAR(192) NOT NULL,
                `slug` VARCHAR(192) NOT NULL UNIQUE,
                `description` longtext NULL,
                `settings` longtext NULL,
                `created_at` DATETIME NULL,
                `updated_at` DATETIME NULL";
    }

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

    public static function dropLegacyTitleUniqueIndexes()
    {
        global $wpdb;

        $tableName = static::getTableName();

        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
        $indexes = $wpdb->get_results($wpdb->prepare(
            "SHOW INDEX FROM %i WHERE Column_name = %s",
            $tableName,
            'title'
        ), ARRAY_A);

        if (empty($indexes)) {
            return;
        }

        foreach ($indexes as $index) {
            if (($index['Non_unique'] ?? '1') !== '0') {
                continue;
            }

            static::dropIndexIfExists($index['Key_name']);
        }
    }
}

```
