#!/usr/bin/env python3 """Prépare et rafraîchit les schémas PostgreSQL par groupe.""" import asyncio import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "backend")) from app.core.database import async_session, engine # noqa: E402 from app.services.tenant_schemas import refresh_all_tenant_schemas # noqa: E402 async def main(): async with async_session() as db: results = await refresh_all_tenant_schemas(db) await db.commit() for result in results: print(f"{result['schema']} ({result['tables']} tables)") await engine.dispose() return 0 if __name__ == "__main__": raise SystemExit(asyncio.run(main()))