#!/usr/bin/env python3
"""
Drop old complex process_services table and create simple version
"""
from app import app
from models import db
from sqlalchemy import text

with app.app_context():
    print("Fixing process_services table...")

    # Drop the old tables
    with db.engine.connect() as conn:
        print("Dropping old service_attempts table...")
        conn.execute(text("DROP TABLE IF EXISTS service_attempts"))
        print("Dropping old process_services table...")
        conn.execute(text("DROP TABLE IF EXISTS process_services"))
        conn.commit()

    # Create the new simple table
    print("Creating new simple process_services table...")
    db.create_all()

    print("✅ Process services table fixed successfully!")
