diff --git a/S88/write_data.py b/S88/write_data.py index a6cec79..287492a 100644 --- a/S88/write_data.py +++ b/S88/write_data.py @@ -83,6 +83,15 @@ def main(): conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() + # Self-heal: ensure the table exists even if create_db.py was skipped during OTA. + # Duplicates the canonical schema from sqlite/create_db.py — keep them in sync. + cursor.execute(""" + CREATE TABLE IF NOT EXISTS data_S88 ( + timestamp TEXT, + CO2 INTEGER + ) + """) + port = get_config(cursor, "S88_port", DEFAULT_PORT) try: diff --git a/VERSION b/VERSION index f60acf7..88b883e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.9.18 +1.9.19 diff --git a/changelog.json b/changelog.json index 3378e16..d668854 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,18 @@ { "versions": [ + { + "version": "1.9.19", + "date": "2026-06-01", + "changes": { + "features": [], + "improvements": [ + "S88/write_data.py: self-heal CREATE TABLE IF NOT EXISTS au démarrage. Protège contre le cas où l'OTA n'a pas appelé create_db.py (problème classique bash qui exécute l'ancien script chargé en mémoire avant le git pull). Le script crée la table data_S88 lui-même au 1er run si elle manque." + ], + "fixes": [], + "compatibility": [] + }, + "notes": "Le schéma de la table est dupliqué dans write_data.py et create_db.py — garder synchro. C'est volontaire pour rendre le script self-contained et éviter les blocages OTA. Pattern à appliquer aux futurs nouveaux capteurs." + }, { "version": "1.9.18", "date": "2026-06-01",