diff --git a/server/database.js b/server/database.js index ae064bc..d63ddb0 100644 --- a/server/database.js +++ b/server/database.js @@ -85,12 +85,28 @@ export function initializeDatabase() { max_x INTEGER NOT NULL, max_y INTEGER NOT NULL, max_z INTEGER NOT NULL, + name TEXT, + color TEXT DEFAULT '#4a8c2a', status TEXT DEFAULT 'active', created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL ) `); + // Migrate existing mining_areas table to add name/color columns if missing + try { + const tableInfo = db.prepare("PRAGMA table_info(mining_areas)").all(); + const columns = tableInfo.map(c => c.name); + if (!columns.includes('name')) { + db.exec('ALTER TABLE mining_areas ADD COLUMN name TEXT'); + } + if (!columns.includes('color')) { + db.exec("ALTER TABLE mining_areas ADD COLUMN color TEXT DEFAULT '#4a8c2a'"); + } + } catch (e) { + // Ignore migration errors + } + // Mining statistics table db.exec(` CREATE TABLE IF NOT EXISTS mining_stats (