#!/usr/bin/env python3 """Quick script to check database schema.""" import sqlite3 from pathlib import Path db_path = Path(__file__).parent / "data" / "family_hub.db" if not db_path.exists(): print(f"ERROR: Database not found at {db_path}") exit(1) print(f"Checking database: {db_path}") print("=" * 70) conn = sqlite3.connect(db_path) cursor = conn.cursor() # Get all tables cursor.execute("SELECT name FROM sqlite_master WHERE type='table'") tables = cursor.fetchall() print(f"\nTables in database: {[t[0] for t in tables]}") # Get chores table schema cursor.execute("PRAGMA table_info(chores)") columns = cursor.fetchall() print("\nChores table columns:") for col in columns: col_id, name, type_, notnull, default, pk = col print(f" {name:20} {type_:15} {'NOT NULL' if notnull else ''}") # Check if we have data with assignment_type cursor.execute("SELECT id, title, assignment_type FROM chores LIMIT 5") rows = cursor.fetchall() print(f"\nFirst 5 chores (checking assignment_type values):") for row in rows: id_, title, assignment_type = row print(f" [{id_:2}] {title:30} -> assignment_type: '{assignment_type}'") conn.close() print("\n" + "=" * 70) print("Database check complete!")