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