I’m having issues when running validate.php it states that my database is out of date , this can be fixed by running ./lnms migrate.
:~$ ./validate.php
Component
Version
LibreNMS
21.3.0-46-g10cf97e58
DB Schema
2021_03_11_003540_rename_toner_table (202)
PHP
7.4.3
Python
3.8.5
MySQL
10.3.25-MariaDB-0ubuntu0.20.04.1
RRDTool
1.7.2
SNMP
NET-SNMP 5.8
====================================
[OK] Composer Version: 2.0.11
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
But after running the migrate command I get these errors .
~$ ./lnms migrate --pretend
Application In Production! *
Do you really wish to run this command? (yes/no) [no]:
yes
MigrateToUtf8mb4: ALTER SCHEMA librenms DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci;
MigrateToUtf8mb4: select TABLE_NAME from information_schema.tables where table_schema = ?
MigrateToUtf8mb4: select * from information_schema.columns where table_schema = ? and CHARACTER_SET_NAME is not null and COLLATION_NAME is not null and (CHARACTER_SET_NAME != ? or COLLATION_NAME != ?)
In SchemaException.php line 86:
There is no column with name ‘supply_descr’ on table ‘printer_supplies’.
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> yes
CreatePortGroupsTable: create table `port_groups` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `desc` varchar(255) null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
CreatePortGroupsTable: alter table `port_groups` add unique `port_groups_name_unique`(`name`)
MigrateToUtf8mb4: ALTER SCHEMA `librenms` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci;
MigrateToUtf8mb4: select `TABLE_NAME` from `information_schema`.`tables` where `table_schema` = ?
MigrateToUtf8mb4: select * from `information_schema`.`columns` where `table_schema` = ? and `CHARACTER_SET_NAME` is not null and `COLLATION_NAME` is not null and (`CHARACTER_SET_NAME` != ? or `COLLATION_NAME` != ?)
RenameTonerTable: rename table `toner` to `printer_supplies`
In SchemaException.php line 86:
There is no column with name 'supply_descr' on table 'printer_supplies'.
I have never added any printer to monitor. and when I go into the database this is the printer_supplies table:
MariaDB [librenms]> select * from printer_supplies limit 5;
Empty set (0.00 sec)
[OK] Composer Version: 2.0.12
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
[INFO] Detected Python Wrapper
[OK] Connection to memcached is ok
librenms@librenms:~$ ./lnms migrate
Application In Production! *
Do you really wish to run this command? (yes/no) [no]:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists (SQL: create table port_groups (id int unsigned not null auto_increment primary key, name varchar(255) not null, desc varchar(255) nu
ll) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)
In Exception.php line 18:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists
In PDOStatement.php line 112:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists
MariaDB [librenms]> describe printer_supplies;
±-------------------±-----------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±-------------------±-----------------±-----±----±--------±---------------+
| toner_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| device_id | int(10) unsigned | NO | MUL | 0 | |
| toner_index | int(11) | NO | | NULL | |
| toner_type | varchar(64) | NO | | NULL | |
| toner_oid | varchar(64) | NO | | NULL | |
| toner_descr | varchar(255) | NO | | | |
| toner_capacity | int(11) | NO | | 0 | |
| toner_current | int(11) | NO | | 0 | |
| toner_capacity_oid | varchar(64) | YES | | NULL | |
| supply_descr | varchar(10) | YES | | NULL | |
±-------------------±-----------------±-----±----±--------±---------------+
10 rows in set (0.001 sec)
./lnms migrate --pretend
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_id supply_id INT UNSIGNED AUTO_INCREMENT NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_index supply_index INT NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_type supply_type VARCHAR(64) NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_oid supply_oid VARCHAR(64) NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_descr supply_descr VARCHAR(255) DEFAULT ‘’ NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_capacity supply_capacity INT DEFAULT 0 NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_current supply_current INT DEFAULT 0 NOT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE toner_capacity_oid supply_capacity_oid VARCHAR(64) DEFAULT NULL
RenamePrinterColumns: ALTER TABLE printer_supplies CHANGE supply_descr supply_descr VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE utf8mb4_unicode_ci
ChangeCacheToMediumtext: ALTER TABLE cache CHANGE value value MEDIUMTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_unicode_ci
Hi @bhaggu,
Did you solve your problem?
I have the same error message than you while processing the “2021_03_11_003713_rename_printer_columns” migration DB Schema.
Regards