# fluent-community/2.7.7/database/Migrations/TermMigrator.php

FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS &amp; Online Courses, version 2.7.7. 40 lines.

- Page: https://pluginprobe.com/plugins/fluent-community/2.7.7/code/database/Migrations/TermMigrator.php
- Raw: https://pluginprobe.com/plugins/fluent-community/2.7.7/raw/database/Migrations/TermMigrator.php
- Modified: 2024-11-07T12:38:44+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-community/2.7.7/code/database/Migrations/TermMigrator.php#L10-L20`.

```php
<?php
// phpcs:disable

namespace FluentCommunity\Database\Migrations;

class TermMigrator
{
    /**
     * Migrate the table.
     *
     * @return void
     */
    public static function migrate()
    {
        global $wpdb;

        $charsetCollate = $wpdb->get_charset_collate();

        $table = $wpdb->prefix . 'fcom_terms';
        $indexPrefix = $wpdb->prefix . 'fcom_tm_';

        if ($wpdb->get_var("SHOW TABLES LIKE '$table'") != $table) {
            $sql = "CREATE TABLE $table (
                `id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
                `parent_id` BIGINT UNSIGNED NULL,
                `taxonomy_name` VARCHAR(50) NOT NULL,
                `slug` VARCHAR(100) NOT NULL,
                `title` LONGTEXT NULL,
                `description` LONGTEXT NULL,
                `settings` LONGTEXT NULL,
                `created_at` TIMESTAMP NULL,
                `updated_at` TIMESTAMP NULL,
                 INDEX `{$indexPrefix}_mt_tax` (`taxonomy_name`),
                 INDEX `{$indexPrefix}_mt_slug` (`slug`)
            ) $charsetCollate;";
            dbDelta($sql);
        }
    }
}

```
