update
This commit is contained in:
@@ -26,7 +26,8 @@ CREATE TABLE IF NOT EXISTS timestamp_table (
|
||||
)
|
||||
""")
|
||||
cursor.execute("""
|
||||
INSERT INTO timestamp_table (id, last_updated) VALUES (1, CURRENT_TIMESTAMP);
|
||||
INSERT OR REPLACE INTO timestamp_table (id, last_updated)
|
||||
VALUES (1, CURRENT_TIMESTAMP);
|
||||
""")
|
||||
|
||||
|
||||
@@ -42,6 +43,14 @@ CREATE TABLE IF NOT EXISTS data_NPM (
|
||||
)
|
||||
""")
|
||||
|
||||
# Create a table CO2
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS data_CO2 (
|
||||
timestamp TEXT,
|
||||
CO2 INTEGER
|
||||
)
|
||||
""")
|
||||
|
||||
# Create a table BME280
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS data_BME280 (
|
||||
|
||||
@@ -16,6 +16,7 @@ data_NPM_5channels
|
||||
data_BME280
|
||||
data_envea
|
||||
timestamp_table
|
||||
data_CO2
|
||||
|
||||
'''
|
||||
|
||||
@@ -45,7 +46,7 @@ if row:
|
||||
print(f"[INFO] Deleting records older than: {cutoff_date_str}")
|
||||
|
||||
# List of tables to delete old data from
|
||||
tables_to_clean = ["data_NPM", "data_NPM_5channels", "data_BME280", "data_envea"]
|
||||
tables_to_clean = ["data_NPM", "data_NPM_5channels", "data_BME280", "data_envea", "data_CO2"]
|
||||
|
||||
# Loop through each table and delete old data
|
||||
for table in tables_to_clean:
|
||||
|
||||
Reference in New Issue
Block a user