@@ -420,6 +420,7 @@ function handleNodes($method, $id, $db) {
|
|||||||
break;
|
break;
|
||||||
case 'DELETE':
|
case 'DELETE':
|
||||||
if ($id) {
|
if ($id) {
|
||||||
|
$db->prepare("DELETE FROM node_notes WHERE node_id = ?")->execute([$id]);
|
||||||
$db->prepare("DELETE FROM network_nodes WHERE id = ?")->execute([$id]);
|
$db->prepare("DELETE FROM network_nodes WHERE id = ?")->execute([$id]);
|
||||||
echo json_encode(['deleted' => true]);
|
echo json_encode(['deleted' => true]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ function migrate($db) {
|
|||||||
try {
|
try {
|
||||||
$db->exec("CREATE TABLE IF NOT EXISTS node_notes (
|
$db->exec("CREATE TABLE IF NOT EXISTS node_notes (
|
||||||
node_id INT PRIMARY KEY,
|
node_id INT PRIMARY KEY,
|
||||||
notes TEXT DEFAULT '',
|
notes TEXT DEFAULT ''
|
||||||
FOREIGN KEY (node_id) REFERENCES network_nodes(id) ON DELETE CASCADE
|
|
||||||
)");
|
)");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -73,6 +73,5 @@ INSERT IGNORE INTO teams (name, color) VALUES
|
|||||||
-- Ensure notes column exists and grant ALTER privilege
|
-- Ensure notes column exists and grant ALTER privilege
|
||||||
CREATE TABLE IF NOT EXISTS node_notes (
|
CREATE TABLE IF NOT EXISTS node_notes (
|
||||||
node_id INT PRIMARY KEY,
|
node_id INT PRIMARY KEY,
|
||||||
notes TEXT DEFAULT '',
|
notes TEXT DEFAULT ''
|
||||||
FOREIGN KEY (node_id) REFERENCES network_nodes(id) ON DELETE CASCADE
|
|
||||||
);
|
);
|
||||||
Reference in New Issue
Block a user