"""Ensure PocketBase hub_* collections exist (idempotent).""" from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] API = ROOT / "apps" / "api" sys.path.insert(0, str(API)) sys.path.insert(0, str(API / "services")) try: from dotenv import load_dotenv load_dotenv(ROOT / ".env") load_dotenv(ROOT / ".env.local", override=True) load_dotenv(API / ".env") load_dotenv(API / ".env.local", override=True) except Exception: pass from nomadro_pb.ensure import ensure_selected # noqa: E402 HUB_NAMES = { "hub_roster", "hub_liveness_audits", "hub_skill_posts", "hub_meetup_reviews", "hub_blocks", "hub_reports", "hub_messages", "hub_channel_meta", "hub_channel_reads", "hub_files", "hub_trips", "hub_cafe_reviews", "hub_feedback", "hub_join_leads", "hub_gig_apps", "hub_archives", } def main() -> int: ok = ensure_selected(HUB_NAMES) print("hub_collections_ok" if ok else "hub_collections_failed", sorted(HUB_NAMES)) return 0 if ok else 1 if __name__ == "__main__": raise SystemExit(main())