67 lines
1.8 KiB
Python
67 lines
1.8 KiB
Python
import sqlite3
|
|
import os
|
|
|
|
db_path = r"D:\Hosted\familyhub\backend\data\family_hub.db"
|
|
|
|
print("="*70)
|
|
print("DATABASE COLUMN CHECK")
|
|
print("="*70)
|
|
print(f"Database: {db_path}")
|
|
print(f"Exists: {os.path.exists(db_path)}")
|
|
print()
|
|
|
|
if os.path.exists(db_path):
|
|
conn = sqlite3.connect(db_path)
|
|
cursor = conn.cursor()
|
|
|
|
# Check users table
|
|
print("USERS TABLE COLUMNS:")
|
|
cursor.execute('PRAGMA table_info(users)')
|
|
for row in cursor.fetchall():
|
|
print(f" - {row[1]} ({row[2]})")
|
|
|
|
print()
|
|
|
|
# Check chores table
|
|
print("CHORES TABLE COLUMNS:")
|
|
cursor.execute('PRAGMA table_info(chores)')
|
|
for row in cursor.fetchall():
|
|
print(f" - {row[1]} ({row[2]})")
|
|
|
|
print()
|
|
|
|
# Check if avatar_url exists
|
|
cursor.execute('PRAGMA table_info(users)')
|
|
user_cols = [row[1] for row in cursor.fetchall()]
|
|
|
|
cursor.execute('PRAGMA table_info(chores)')
|
|
chore_cols = [row[1] for row in cursor.fetchall()]
|
|
|
|
print("="*70)
|
|
if 'avatar_url' in user_cols:
|
|
print("✅ avatar_url column EXISTS in users table")
|
|
else:
|
|
print("❌ avatar_url column MISSING in users table")
|
|
print(" Run migration: APPLY_IMAGE_MIGRATION.bat")
|
|
|
|
if 'image_url' in chore_cols:
|
|
print("✅ image_url column EXISTS in chores table")
|
|
else:
|
|
print("❌ image_url column MISSING in chores table")
|
|
print(" Run migration: APPLY_IMAGE_MIGRATION.bat")
|
|
print("="*70)
|
|
|
|
# Check if user 1 has an avatar_url set
|
|
if 'avatar_url' in user_cols:
|
|
cursor.execute('SELECT id, username, avatar_url FROM users WHERE id = 1')
|
|
user = cursor.fetchone()
|
|
if user:
|
|
print()
|
|
print(f"User 1 ({user[1]}) avatar_url: {user[2]}")
|
|
|
|
conn.close()
|
|
else:
|
|
print("❌ Database file not found!")
|
|
|
|
print("="*70)
|