import asyncio from sqlalchemy import text from api.database import engine async def migrate(): print("Starting migration: Adding npc_intent column to active_combats table...") async with engine.begin() as conn: try: # Check if column exists first to avoid errors # This is a simple check, might vary based on exact postgres version but usually works await conn.execute(text("ALTER TABLE active_combats ADD COLUMN IF NOT EXISTS npc_intent VARCHAR DEFAULT 'attack'")) print("Migration successful: Added npc_intent column.") except Exception as e: print(f"Migration failed: {e}") if __name__ == "__main__": asyncio.run(migrate())