import sqlite3

conn = sqlite3.connect(r'C:\Users\청춘약국\source\pharmacy-pos-qr-system\backend\db\product_images.db')
cursor = conn.cursor()

# 테이블 목록
cursor.execute('SELECT name FROM sqlite_master WHERE type="table"')
tables = [r[0] for r in cursor.fetchall()]
print("테이블:", tables)

# 각 테이블 스키마
for table in tables:
    cursor.execute(f'PRAGMA table_info({table})')
    cols = [r[1] for r in cursor.fetchall()]
    print(f"\n{table} 컬럼: {cols}")
    
    # 샘플 데이터
    cursor.execute(f'SELECT * FROM {table} LIMIT 2')
    rows = cursor.fetchall()
    for r in rows:
        print(f"  샘플: {r[:3]}..." if len(r) > 3 else f"  샘플: {r}")

# 총 개수
for table in tables:
    cursor.execute(f'SELECT COUNT(*) FROM {table}')
    print(f"\n{table} 총 {cursor.fetchone()[0]}개")
