Fix: events Migration PRAGMA table_info Syntax (pragma_table_info() nicht unterstützt)

This commit is contained in:
rene 2026-04-17 22:39:52 +02:00
parent a7753c9cf5
commit 1af9bc0f7e

View file

@ -657,10 +657,8 @@ def _migrate(conn_factory):
logger.info("Migration: dog_shares Tabelle bereit.") logger.info("Migration: dog_shares Tabelle bereit.")
# Events: user_id NOT NULL Constraint entfernen (für Scheduler-Imports ohne User) # Events: user_id NOT NULL Constraint entfernen (für Scheduler-Imports ohne User)
row = conn.execute( _ev_cols = {r[1]: r[3] for r in conn.execute("PRAGMA table_info(events)").fetchall()}
"SELECT notnull FROM pragma_table_info('events') WHERE name='user_id'" if _ev_cols.get("user_id") == 1:
).fetchone()
if row and row[0] == 1:
conn.executescript(""" conn.executescript("""
CREATE TABLE IF NOT EXISTS events_new ( CREATE TABLE IF NOT EXISTS events_new (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,