$ ./validate.php
Component | Version |
---|---|
LibreNMS | 1.70.1-6-g9ccb70733 |
DB Schema | 2018_07_03_091322_add_foreign_keys_to_wireless_sensors_table (449) |
PHP | 7.4.13 |
Python | 3.8.6 |
MySQL | 8.0.22-0ubuntu0.20.10.2 |
RRDTool | 1.7.2 |
SNMP | NET-SNMP 5.8 |
====================================
[OK] Composer Version: 2.0.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Database: incorrect constraint (device_relationships/device_relationship_child_device_id_fk)
[FAIL] Database: incorrect constraint (device_relationships/device_relationship_parent_device_id_fk)
[FAIL] Database: incorrect constraint (sensors/sensors_device_id_foreign)
[FAIL] Database: incorrect constraint (sensors_to_state_indexes/sensors_to_state_indexes_ibfk_1)
[FAIL] Database: incorrect constraint (sensors_to_state_indexes/sensors_to_state_indexes_sensor_id_foreign)
[FAIL] Database: incorrect constraint (wireless_sensors/wireless_sensors_device_id_foreign)
[FAIL] We have detected that your database schema may be wrong, please report the following to us on Discord (https://t.libren.ms/discord) or the community site (https://t.libren.ms/5gscd):
[FIX]:
Run the following SQL statements to fix.
SQL Statements:
ALTER TABLE device_relationships
DROP FOREIGN KEY device_relationship_child_device_id_fk
;
ALTER TABLE device_relationships
ADD CONSTRAINT device_relationship_child_device_id_fk
FOREIGN KEY (child_device_id
) REFERENCES devices
(device_id
) ON DELETE CASCADE;
ALTER TABLE device_relationships
DROP FOREIGN KEY device_relationship_parent_device_id_fk
;
ALTER TABLE device_relationships
ADD CONSTRAINT device_relationship_parent_device_id_fk
FOREIGN KEY (parent_device_id
) REFERENCES devices
(device_id
) ON DELETE CASCADE;
ALTER TABLE sensors
DROP FOREIGN KEY sensors_device_id_foreign
;
ALTER TABLE sensors
ADD CONSTRAINT sensors_device_id_foreign
FOREIGN KEY (device_id
) REFERENCES devices
(device_id
) ON DELETE CASCADE;
ALTER TABLE sensors_to_state_indexes
DROP FOREIGN KEY sensors_to_state_indexes_ibfk_1
;
ALTER TABLE sensors_to_state_indexes
ADD CONSTRAINT sensors_to_state_indexes_ibfk_1
FOREIGN KEY (state_index_id
) REFERENCES state_indexes
(state_index_id
);
ALTER TABLE sensors_to_state_indexes
DROP FOREIGN KEY sensors_to_state_indexes_sensor_id_foreign
;
ALTER TABLE sensors_to_state_indexes
ADD CONSTRAINT sensors_to_state_indexes_sensor_id_foreign
FOREIGN KEY (sensor_id
) REFERENCES sensors
(sensor_id
) ON DELETE CASCADE;
ALTER TABLE wireless_sensors
DROP FOREIGN KEY wireless_sensors_device_id_foreign
;
ALTER TABLE wireless_sensors
ADD CONSTRAINT wireless_sensors_device_id_foreign
FOREIGN KEY (device_id
) REFERENCES devices
(device_id
) ON DELETE CASCADE;