""" Recreate resources table with unique constraint """ import asyncio from app.database import engine from app.models.db.resource import Resource from sqlalchemy import text async def recreate_resources_table(): """Drop and recreate resources table""" async with engine.begin() as conn: # Drop the table print("šŸ—‘ļø Dropping resources table...") await conn.execute(text("DROP TABLE IF EXISTS resources CASCADE")) print("āœ“ Table dropped") # Recreate the table print("šŸ“¦ Creating resources table with new schema...") await conn.run_sync(Resource.metadata.create_all) print("āœ“ Table created") print("\n✨ Resources table recreated successfully!") if __name__ == "__main__": asyncio.run(recreate_resources_table())