简体   繁体   English

Icinga Mysql 迁移错误表在引擎中不存在

[英]Icinga Mysql migration error Table doesn't exist in engine

I have tried to perform update for icinga into 2.9.1 and to do this I need to apply migration on a sql database.我尝试将 icinga 更新到 2.9.1,为此我需要在 sql 数据库上应用迁移。

The migration uses the following sql query:迁移使用以下 sql 查询:

2.9.0 migration 2.9.0 迁移

CREATE TABLE `icingaweb_rememberme`(
    ->   id                int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   username          varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
    ->   passphrase        varchar(256) NOT NULL,
    ->   random_iv         varchar(24) NOT NULL,
    ->   http_user_agent   text NOT NULL,
    ->   expires_at        timestamp NULL DEFAULT NULL,
    ->   ctime             timestamp NULL DEFAULT NULL,
    ->   mtime             timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
    ->   PRIMARY KEY (id)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

2.9.1 migration 2.9.1 迁移

ALTER TABLE `icingaweb_rememberme`
    ->     MODIFY random_iv varchar(32)  NOT NULL;

The issue is that when I try to perfom it I get confilicting error messages问题是,当我尝试执行它时,我收到了冲突的错误消息

Full migration log完整迁移日志

MariaDB [(none)]> use icingaweb2
Database changed
MariaDB [icingaweb2]> CREATE TABLE `icingaweb_rememberme`(
    ->   id                int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   username          varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
    ->   passphrase        varchar(256) NOT NULL,
    ->   random_iv         varchar(24) NOT NULL,
    ->   http_user_agent   text NOT NULL,
    ->   expires_at        timestamp NULL DEFAULT NULL,
    ->   ctime             timestamp NULL DEFAULT NULL,
    ->   mtime             timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
    ->   PRIMARY KEY (id)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
ERROR 1050 (42S01): Table 'icingaweb_rememberme' already exists
MariaDB [icingaweb2]> ALTER TABLE `icingaweb_rememberme`
    ->     MODIFY random_iv varchar(32)  NOT NULL;
ERROR 1932 (42S02): Table 'icingaweb2.icingaweb_rememberme' doesn't exist in engine

Icinga currently shows this error (similar to second migration error) Icinga 当前显示此错误(类似于第二次迁移错误)

SQLSTATE[42S02]: Base table or view not found: 1932 Table 'icingaweb2.icingaweb_rememberme' doesn't exist in engine

Question问题

How I can apply migration so that collection icingaweb2 has table icingaweb_rememberme我如何应用迁移以便集合icingaweb2具有表icingaweb_rememberme

I found the anwser.我找到了答案。

MySQL database created a file icingaweb_rememberme.idb but did not have coresponding frm file. MySQL 数据库创建了文件icingaweb_rememberme.idb但没有相应的frm文件。

I have droped the icingaweb_rememberme TABLE, removed .idb that was left in the MySQL directory and recreated the table using single command (with second migration already applied)我删除了icingaweb_rememberme TABLE,删除了留在 MySQL 目录中的.idb并使用单个命令重新创建了表(已经应用了第二次迁移)

This might not be the full anwser or there might be simpler solution but thats something that worked for me in this case.这可能不是完整的答案,或者可能有更简单的解决方案,但在这种情况下,这对我有用。

REMEMBER TO MAKE A BACKUP IF YOU ARE PLANNING ON DROPPING OR REMOVING FILES AND TABLES如果您计划删除或删除文件和表格,请记住进行备份

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM