Pandora FMS community forums
Pandora FMS db migration error - Printable Version

+- Pandora FMS community forums (https://pandorafms.com/community-forums)
+-- Forum: Pandora FMS (https://pandorafms.com/community-forums/forum-3.html)
+--- Forum: Community support (English) (https://pandorafms.com/community-forums/forum-7.html)
+--- Thread: Pandora FMS db migration error (/thread-15210.html)



Pandora FMS db migration error - Arulrajah - 05-27-2020

I try to migrate the pandora db version 6.0 to version 7.0. But I got an error " ERROR 1054 (42S22) at line 145: Unknown column 'ip_target' in 'tpolicy_modules' ", I'm using pandora FMS 7 ubuntu 18.04


RE: Pandora FMS db migration error - Jimmy_Olano - 05-27-2020

¡Hi everybody! I am just drinking more coffee☕ for this, I start...

*** WARNING *** : you are working at your own risk, I only suggest some issues  that I found.

FIRST: Check if table 'tpolicy_modules' exists because I got error when creating it. I use MySQL 14.14 on Ubuntu 18.04:

Code:
>>mysql --version
mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper

There is a problem for default values (see https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html ) for TEXT fields:

Code:
ERROR 1101 (42000): BLOB, TEXT, GEOMETRY or JSON column 'unit' can't have a default value

quick-and-dirty: I created that table erasing «default ''» ;-)  this is an old issue for MySQL.

SECOND: absolutely no problem for your case, this instruction fix very well:

Code:
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';

BUT NEXT LINE yes, "Uh, Houston, we've had a problem":


Code:
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ERROR 1060 (42S21): Duplicate column name 'dynamic_next'

I thing that we need here a function for check first if field exists, something like explains here (I am not tested that code) BIG WORK but at long time harvest benefits (and avoid headaches!).

Thanks for your attention! ?


RE: Pandora FMS db migration error - Diego.M - 05-28-2020

Hello

This failure is due to the fact that you are missing some changes made to the database (aka MR). Before reviewing them I have to ask you,  you comment that you are using Pandora FMS 7 version, this is the version you are updating to? were you in a Pandora FMS 6 version instead of in a Pandora FMS 7?

In case you had a Pandora FMS 7 before, it is not necessary to use the migration script, you just have to update the MR as indicated in our wiki.

https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29

In case you were using Pandora FMS 6, you should update the database with a migration script. I also attach a link to this section of the wiki.

https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Major_release_update

But it is important that you identify which version you were in and which one you are in now to avoid having more database problems in the future.

Greetings
Diego