#!/usr/bin/env python3
"""
Check restaurant_photos table schema
"""

from sqlalchemy import create_engine, text
from urllib.parse import quote_plus

def check_restaurant_photos_schema():
    DATABASE_URL = f"postgresql://postgres:{quote_plus('F@f@k0s!!')}@localhost:5432/bookbeach"
    engine = create_engine(DATABASE_URL)
    
    with engine.connect() as db:
        # Check if restaurant_photos table exists
        table_exists = db.execute(text("""
            SELECT EXISTS (
                SELECT FROM information_schema.tables 
                WHERE table_schema = 'public' 
                AND table_name = 'restaurant_photos'
            )
        """)).fetchone()[0]
        
        if not table_exists:
            print("❌ restaurant_photos table does not exist")
            return
        
        # Get table structure
        result = db.execute(text("""
            SELECT column_name, data_type, is_nullable
            FROM information_schema.columns 
            WHERE table_name = 'restaurant_photos' 
            ORDER BY ordinal_position
        """)).fetchall()
        
        print('\nCurrent restaurant_photos table columns:')
        for col_name, data_type, is_nullable in result:
            print(f'  {col_name}: {data_type} (nullable: {is_nullable})')

if __name__ == '__main__':
    check_restaurant_photos_schema()