CORE-WP-0005-T02 done: Inter-Hub exporter + staging import (28 records, idempotent)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 19:21:13 +02:00
parent eec76cbb9b
commit 4dc4ab4c8b
3 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
# Inter-Hub → Core Hub migration export
`inter_hub_export.sql` is a read-only query against the legacy Inter-Hub
Postgres database (`interhub` on net-kingdom-pg) that emits a
`core-hub.migration.v1` bundle covering hubs, hubCapabilityManifests,
apiConsumers, apiKeys (prefix + hash only, no plaintext), widgets, and
interactionEvents. Field names are aliased from Inter-Hub's snake_case columns
to the bundle's camelCase contract.
## Run
```bash
kubectl exec -i -n databases net-kingdom-pg-1 -- \
psql -U postgres -d interhub -tA < scripts/migration/inter_hub_export.sql \
> interhub-bundle.json
# validate (no DB needed)
PYTHONPATH=src uv run python scripts/core_hub_cli.py migration validate interhub-bundle.json
# import into a target (CORE_HUB_DATABASE_URL); run in-cluster for staging
python scripts/core_hub_cli.py migration import --dry-run interhub-bundle.json
python scripts/core_hub_cli.py migration import interhub-bundle.json
```
The importer is idempotent (upsert by id): re-running updates in place, never
duplicates. `api_keys` carry only `keyPrefix` + `keyHash`, so no secret material
transits the bundle.