<commit_before><?php
/*
* Custom Username Markup For User v1.0.0 written by <EMAIL>.
* This software is licensed under the BSD 2-Clause modified License.
* See the LICENSE file within the package for details.
*/

class ThreePointStudio_CustomMarkupForUser_Installer {
    public static final function install($installedAddon) {
        $db = XenForo_Application::getDb();
        $version = is_array($installedAddon) ? $installedAddon['version_id'] : 0;
        if ($version == 0) {
            $db->query("ALTER TABLE `xf_user`
                        ADD COLUMN  `3ps_cmfu_options` BLOB NULL AFTER `is_staff`");
            $db->query("CREATE TABLE IF NOT EXISTS `xf_3ps_cmfu_presets` (
                      `preset_id` bigint(20) unsigned NOT NULL,
                      `title` text CHARACTER SET latin1 NOT NULL,
                      `enable_for` text CHARACTER SET latin1 NOT NULL,
                      `config` text CHARACTER SET latin1 NOT NULL,
                      `user_groups` text CHARACTER SET latin1 NOT NULL
                    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
                ");
            $db->query("ALTER TABLE `xf_3ps_cmfu_presets` ADD UNIQUE KEY `preset_id` (`preset_id`);");
        }
        if ($version > 0) { // Upgrade section
            if ($version < 3) { // 1.0.0 Beta 1 - 1.0.0
                $db->query("ALTER TABLE `xf_user` ADD COLUMN `3ps_cmfu_render_cache` BLOB NULL AFTER `3ps_cmfu_options`");
            }

            if ($version < 4) { // 1.0.0 - 1.0.1
                $db->query("ALTER TABLE `xf_user`
                    CHANGE `3ps_cmfu_options` `3ps_cmfu_options` BLOB NULL,
                    CHANGE `3ps_cmfu_render_cache` `3ps_cmfu_render_cache` BLOB NULL
                ");
            }

            if ($version < 5) { // 1.0.1 - 1.1.0
                $db->query("ALTER TABLE `xf_user` DROP COLUMN `3ps_cmfu_render_cache`");
                $db->query("CREATE TABLE IF NOT EXISTS `xf_3ps_cmfu_presets` (
                      `preset_id` bigint(20) unsigned NOT NULL,
                      `title` text CHARACTER SET latin1 NOT NULL,
                      `enable_for` text CHARACTER SET latin1 NOT NULL,
                      `config` text CHARACTER SET latin1 NOT NULL,
                      `user_groups` text CHARACTER SET latin1 NOT NULL
                    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
                ");
                $db->query("ALTER TABLE `xf_3ps_cmfu_presets` ADD UNIQUE KEY `preset_id` (`preset_id`);");
            }
        }
    }

    public static final function uninstall() {
        $db = XenForo_Application::getDb();
        $db->query("ALTER TABLE `xf_user`
                    DROP COLUMN `3ps_cmfu_options`");
        $db->query("DROP TABLE IF EXISTS `xf_3ps_cmfu_presets`");
    }
}<commit_msg>Fix installer not adding AUTO_INCREMENT correctly<commit_after><?php
/*
* Custom Username Markup For User v1.0.0 written by <EMAIL>.
* This software is licensed under the BSD 2-Clause modified License.
* See the LICENSE file within the package for details.
*/

class ThreePointStudio_CustomMarkupForUser_Installer {
    public static final function install($installedAddon) {
        $db = XenForo_Application::getDb();
        $version = is_array($installedAddon) ? $installedAddon['version_id'] : 0;
        if ($version == 0) {
            $db->query("ALTER TABLE `xf_user`
                        ADD COLUMN  `3ps_cmfu_options` BLOB NULL AFTER `is_staff`");
            $db->query("CREATE TABLE IF NOT EXISTS `xf_3ps_cmfu_presets` (
                  `preset_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                  `title` text COLLATE utf8_unicode_ci NOT NULL,
                  `enable_for` text COLLATE utf8_unicode_ci NOT NULL,
                  `display_style_priority` int(10) unsigned NOT NULL,
                  `config` text COLLATE utf8_unicode_ci NOT NULL,
                  `user_groups` text COLLATE utf8_unicode_ci NOT NULL
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
            ");
            $db->query("ALTER TABLE `xf_3ps_cmfu_presets`
                ADD PRIMARY KEY (`preset_id`),
                ADD UNIQUE KEY `preset_id` (`preset_id`);
            ");
        }
        if ($version > 0) { // Upgrade section
            if ($version < 3) { // 1.0.0 Beta 1 - 1.0.0
                $db->query("ALTER TABLE `xf_user` ADD COLUMN `3ps_cmfu_render_cache` BLOB NULL AFTER `3ps_cmfu_options`");
            }

            if ($version < 4) { // 1.0.0 - 1.0.1
                $db->query("ALTER TABLE `xf_user`
                    CHANGE `3ps_cmfu_options` `3ps_cmfu_options` BLOB NULL,
                    CHANGE `3ps_cmfu_render_cache` `3ps_cmfu_render_cache` BLOB NULL
                ");
            }

            if ($version < 5) { // 1.0.1 - 1.1.0
                $db->query("ALTER TABLE `xf_user` DROP COLUMN `3ps_cmfu_render_cache`");
                $db->query("CREATE TABLE IF NOT EXISTS `xf_3ps_cmfu_presets` (
                    `preset_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                    `title` text COLLATE utf8_unicode_ci NOT NULL,
                    `enable_for` text COLLATE utf8_unicode_ci NOT NULL,
                    `display_style_priority` int(10) unsigned NOT NULL,
                    `config` text COLLATE utf8_unicode_ci NOT NULL,
                    `user_groups` text COLLATE utf8_unicode_ci NOT NULL
                  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
                ");
                $db->query("ALTER TABLE `xf_3ps_cmfu_presets`
                  ADD PRIMARY KEY (`preset_id`),
                  ADD UNIQUE KEY `preset_id` (`preset_id`);
                ");
            }
        }
    }

    public static final function uninstall() {
        $db = XenForo_Application::getDb();
        $db->query("ALTER TABLE `xf_user`
                    DROP COLUMN `3ps_cmfu_options`");
        $db->query("DROP TABLE IF EXISTS `xf_3ps_cmfu_presets`");
    }
}
{'fraction_non_alphanumeric': 0.0993421052631579, 'fraction_numerical': 0.020394736842105264, 'mean_word_length': 1.9179462571976968, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '15900', 'n_tokens_mistral': 2014, 'n_tokens_neox': 1877, 'n_words': 471}