diff --git a/backend/api/index.php b/backend/api/index.php index f7037e1..b3b4e34 100644 --- a/backend/api/index.php +++ b/backend/api/index.php @@ -14,6 +14,9 @@ require_once __DIR__ . '/../config/database.php'; $db = getDbConnection(); +// Ensure notes column exists +try { $db->exec("ALTER TABLE network_nodes ADD COLUMN notes TEXT DEFAULT '' AFTER group_name"); } catch (Exception $e) {} + // Auth check (except for session check) $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $path = str_replace('/api/', '', $path); diff --git a/backend/config/database.php b/backend/config/database.php index 58e3a52..9763434 100644 --- a/backend/config/database.php +++ b/backend/config/database.php @@ -39,10 +39,7 @@ function migrate($db) { created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); try { - $r = $db->query("SHOW COLUMNS FROM network_nodes LIKE 'notes'"); - if ($r->rowCount() === 0) { - $db->exec("ALTER TABLE network_nodes ADD COLUMN notes TEXT DEFAULT '' AFTER group_name"); - } + $db->exec("ALTER TABLE network_nodes ADD COLUMN notes TEXT DEFAULT '' AFTER group_name"); } catch (Exception $e) { } } \ No newline at end of file