# fluent-cart/1.3.26/database/Migrations/TaxRatesMigrator.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.3.26. 45 lines.

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

```php
<?php

namespace FluentCart\Database\Migrations;

class TaxRatesMigrator extends Migrator
{

    public static string $tableName = 'fct_tax_rates';

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

        // postcode is text to allow multiple postcodes like: 12345, 23456, 34567 or ranges like: 12345...12350
        return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
                `class_id` BIGINT UNSIGNED NOT NULL,
                `country` VARCHAR(45) NULL,
                `state` VARCHAR(45) NULL,
                `postcode` TEXT NULL,
                `city` VARCHAR(45) NULL,
                `rate` VARCHAR(45) NULL,
                `name` VARCHAR(45) NULL,
                `group` VARCHAR(45) NULL,
                `priority` INT UNSIGNED NULL DEFAULT 1,
                `is_compound` TINYINT UNSIGNED NULL DEFAULT 0,
                `for_shipping` TINYINT UNSIGNED NULL DEFAULT NULL,
                `for_order` TINYINT UNSIGNED NULL DEFAULT 0,

                 INDEX `{$indexPrefix}_txr_class_idx` (`class_id` ASC),
                 INDEX `{$indexPrefix}_priority_idx` (`priority` ASC)";
    }

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

    public static function addGroupColumn()
    {
        // "ALTER TABLE %i ADD COLUMN `group` VARCHAR(45) NULL AFTER `name`"
        static::addColumnIfNotExists('group', 'VARCHAR(45) NULL', 'name');
    }
}

```
