diff --git a/sqlite/set_config.py b/sqlite/set_config.py index 35e04cc..6751220 100644 --- a/sqlite/set_config.py +++ b/sqlite/set_config.py @@ -107,6 +107,18 @@ for connected, port, name, coefficient in envea_sondes: print(f"Envea sonde '{name}' already exists, skipping") +# Database migrations (add columns to existing tables) +migrations = [ + ("data_NPM", "npm_status", "INTEGER DEFAULT 0"), +] + +for table, column, col_type in migrations: + try: + cursor.execute(f"ALTER TABLE {table} ADD COLUMN {column} {col_type}") + print(f"Migration: added column '{column}' to {table}") + except: + pass # Column already exists + # Commit and close the connection conn.commit() conn.close()