from sqlalchemy import text
from database import engine

def upgrade():
    with engine.connect() as conn:
        try:
            conn.execute(text("ALTER TABLE users ADD COLUMN phone VARCHAR;"))
        except Exception as e:
            print(f"Update phone failed (maybe exists): {e}")
            
        try:
            conn.execute(text("ALTER TABLE users ADD COLUMN profile_photo VARCHAR;"))
        except Exception as e:
            print(f"Update profile_photo failed (maybe exists): {e}")

        try:
            conn.execute(text("ALTER TABLE resumes ADD COLUMN file_path VARCHAR;"))
        except Exception as e:
            print(f"Update file_path failed (maybe exists): {e}")
            
        conn.commit()
        print("Database schema update attempts finished.")

if __name__ == "__main__":
    upgrade()
