33 lines
795 B
Python
33 lines
795 B
Python
"""# Summary
|
|
|
|
Operator script — drop the collections owned by each service for a clean slate.
|
|
|
|
Run from the project root:
|
|
|
|
python -m scripts.drop
|
|
"""
|
|
import asyncio
|
|
|
|
from init import init, shutdown
|
|
|
|
|
|
async def main() -> None:
|
|
"""Delete every service collection, best-effort, then shut down."""
|
|
resources = await init()
|
|
try:
|
|
dropped = 0
|
|
for name, svc in resources.items():
|
|
if not name.endswith("_svc"):
|
|
continue
|
|
delete_many = getattr(svc.repo, "delete_many", None)
|
|
if delete_many is not None:
|
|
await delete_many({})
|
|
dropped += 1
|
|
print(f"Dropped {dropped} service collection(s).")
|
|
finally:
|
|
await shutdown()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|