diff --git a/backend/api/index.php b/backend/api/index.php index e11b836..73157a6 100644 --- a/backend/api/index.php +++ b/backend/api/index.php @@ -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]); } diff --git a/backend/config/database.php b/backend/config/database.php index 82c378c..6f6d2cd 100644 --- a/backend/config/database.php +++ b/backend/config/database.php @@ -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) { } diff --git a/docker/init.sql b/docker/init.sql index a73a016..df54d8a 100644 --- a/docker/init.sql +++ b/docker/init.sql @@ -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 '' ); \ No newline at end of file