简体   繁体   中英

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.

The migration uses the following sql query:

2.9.0 migration

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

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)

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

I found the anwser.

MySQL database created a file icingaweb_rememberme.idb but did not have coresponding frm file.

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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