fix(schema.py): ensure cursor is closed after executing PRAGMA table_info to prevent resource leaks

This commit is contained in:
2026-01-03 21:36:47 -06:00
parent 8c5a68a01f
commit 48b7def004

View File

@@ -19,8 +19,11 @@ class DatabaseSchema:
"""Add a column to a table if it doesn't exist."""
# First check if it exists using PRAGMA
cursor = self.provider.connection.cursor()
cursor.execute(f"PRAGMA table_info({table_name})")
columns = [row[1] for row in cursor.fetchall()]
try:
cursor.execute(f"PRAGMA table_info({table_name})")
columns = [row[1] for row in cursor.fetchall()]
finally:
cursor.close()
if column_name not in columns:
try: