mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix for failed sql query during db dump (#9815)
This commit is contained in:
@@ -2454,9 +2454,10 @@ function dump_db_schema()
|
||||
}
|
||||
}
|
||||
|
||||
$create = dbFetchRow("SHOW CREATE TABLE `$table`")['Create Table'];
|
||||
$create = dbFetchRow("SHOW CREATE TABLE `$table`");
|
||||
if (isset($create['Create Table'])) {
|
||||
$constraint_regex = '/CONSTRAINT `(?<name>[A-Za-z_0-9]+)` FOREIGN KEY \(`(?<foreign_key>[A-Za-z_0-9]+)`\) REFERENCES `(?<table>[A-Za-z_0-9]+)` \(`(?<key>[A-Za-z_0-9]+)`\) ?(?<extra>[ A-Z]+)?/';
|
||||
$constraint_count = preg_match_all($constraint_regex, $create, $constraints);
|
||||
$constraint_count = preg_match_all($constraint_regex, $create['Create Table'], $constraints);
|
||||
for ($i = 0; $i < $constraint_count; $i++) {
|
||||
$constraint_name = $constraints['name'][$i];
|
||||
$output[$table]['Constraints'][$constraint_name] = [
|
||||
@@ -2468,6 +2469,7 @@ function dump_db_schema()
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user