./lnms migrate fails

Hello all ,

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.
But after running the migrate command I get these errors .
Migrating: 2020_04_06_001048_the_great_index_rename

In Connection.php line 669:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘deleted’; check that column/key exists (SQL: ALTER TABLE access_points DROP INDEX deleted, ADD INDEX access_points_deleted_index(
deleted):wink:

In PDOStatement.php line 129:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘deleted’; check that column/key exists

In PDOStatement.php line 127:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘deleted’; check that column/key exists

I’d appreciate any help you can provide
Thanks ,

Same here on Monthly update channel after installing the Python3 requirements.

1 Like

Solution might be here .

Your system failed to apply the migration fully.

  1. Mark the migration as completed
insert into migrations (migration, batch) VALUES ("2020_04_06_001048_the_great_index_rename", 1);
  1. run ./validate.php or lnms migrate --pretend
  2. Run the suggested SQL statements until validation comes back clean.
  3. If you have any inconsistencies that persist, ask for more help :wink:
1 Like

Following murrant’s steps solved the issue .

Thanks !

Dear Murrent ! i have facing same issue please tell me how i execute the command in step 1 ?

librenms@netplus-NMS:~$ ./validate.php

Component Version
LibreNMS 21.2.0-8-g3d5f4bdad
DB Schema (0)
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.9
[OK] Dependencies up-to-date.
[WARN] You have no devices.
[FIX]:
Consider adding a device such as localhost: /addhost
[OK] Database connection successful
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate

Dear Murrant !
i ve facing same problem !
librenms@netplus-NMS:~$ ./lnms migrate


  • Application In Production!     *
    

Do you really wish to run this command? (yes/no) [no]:

yes

Loading stored database schema: /opt/librenms/database/schema/mysql-schema.dump

In Process.php line 267:

The command “mysql --user=”${:LARAVEL_LOAD_USER}" --password=“${:LARAVEL_LOAD_PASSWORD}” --host=“${:LARAVE
L_LOAD_HOST}” --port=“${:LARAVEL_LOAD_PORT}” --database=“${:LARAVEL_LOAD_DATABASE}” < “${:LARAVEL_LOAD_PATH
}”" failed.

Exit Code: 1(General error)

Working directory: /opt/librenms

Output:

Error Output:

ERROR 1050 (42S01) at line 9: Table ‘access_points’ already exists

1 Like