PostgreSQL Shadow Migration

A shadow migration imports copied Vorliq JSON state into a temporary PostgreSQL database, verifies parity, and then cleans up. It is rehearsal only. Production still uses hardened JSON as the source of truth.

Why It Is Safe

Run Locally

  1. Copy database/.env.shadow.example into your shell environment.
  2. Start PostgreSQL with docker compose -f database/docker-compose.shadow.yml up -d.
  3. Install the optional Python PostgreSQL client with python -m pip install "psycopg[binary]".
  4. Run python tools/run_shadow_migration_rehearsal.py --data-dir tests/fixtures/migration/sample_data --database-url "$SHADOW_DATABASE_URL" --check-adapter --output temp-shadow-report.json.

CI Fixture Data

CI uses deliberately fake data from tests/fixtures/migration/sample_data. The fixture includes a small valid chain, pending transactions, profiles, forum, governance, exchange, lending, treasury, registry, faucet, analytics, and incident records. It contains no production data, wallet private keys, admin tokens, SSH keys, or real credentials.

Parity Checks

Before Any Real Migration

A real production migration would require fresh verified JSON backups, repeated shadow parity passes, staging adapter smoke tests, a tested rollback plan, operator approval, and a separate cutover window. Until that happens, chain.json, pending.json, and the existing domain JSON files remain canonical.

Related