Migrating DB 'librenms.port_group_port' doesn't exist

Hello,

I managed to upgrade my mariaDB and MySQL, but now I am having issues with ./lnms migrate

  • The output of ./validate.php
    ====================================
    Component | Version
    --------- | -------
    LibreNMS | 21.12.1
    DB Schema | 2021_03_26_014054_change_cache_to_mediumtext (208)
    PHP | 7.4.27
    Python | 3.8.10
    MySQL | 10.3.32-MariaDB-0ubuntu0.20.04.1
    RRDTool | 1.7.2
    SNMP | 5.8
    ====================================

[OK] Composer Version: 2.2.3
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate

after running ./lnms migrate, I get the following errors.

In Connection.php line 703:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.port_group_port’ doesn’t exist (SQL: alter table port_group_port
add constraint port_group_port_port_group_id_foreign foreign key (port_group_id) references port_groups (id) on delete CASCADE)

In Exception.php line 18:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.port_group_port’ doesn’t exist

In PDOStatement.php line 117:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.port_group_port’ doesn’t exist

I did do a show tables and confirmed that there isn’t a librenms table in there. I also tried running ./daily.sh and am still having the same issue.

What do you get back if you run show create table port_group in mysql?

This is what should be returned:

CREATE TABLE `port_groups` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `desc` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `port_groups_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC

All I get “ERROR 1146 (42S02): Table ‘librenms.port_group’ doesn’t exist”

I am connected to the librenms database.

Run that create command above

Just tried that, same error. Do I need to change CREATE TABLE to librenms.port_groups, or is that probably a permissions error? I am only able to connect to this DB as root, not librenms.

Run this:

CREATE TABLE `port_group_port` (
  `port_group_id` int(10) unsigned NOT NULL,
  `port_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`port_group_id`,`port_id`),
  KEY `port_group_port_port_group_id_index` (`port_group_id`),
  KEY `port_group_port_port_id_index` (`port_id`),
  CONSTRAINT `port_group_port_port_group_id_foreign` FOREIGN KEY (`port_group_id`) REFERENCES `port_groups` (`id`) ON DELETE CASCADE,
  CONSTRAINT `port_group_port_port_id_foreign` FOREIGN KEY (`port_id`) REFERENCES `ports` (`port_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci