Files
aevolution/tools/migrate-postgres.sh
T
dingoandClaude Opus 5.5 a7a3d12283
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s
Wire M10.8c-1 region handoff: protocol v4, durable probes, crossing, ghosts
ADR-0096. Session protocol v4 (v3 is deployed and frozen) adds HandoffOffer,
SessionRedirect, close reasons handed_off and moved, and ghost marker records.
Sessions use the durable probe record: logins open it where it was saved
(redirected when it lives elsewhere), and session ends save it. A marker
crossing into a neighbour's area is frozen, prepared, its control released
and a signed ticket offered; uncommitted transfers are aborted after the
ticket's lifetime. The destination shows arriving probes as ghosts (schema
v13 incoming_probe_transfers) and opens the marker where it crossed.

Refreshes the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 21:24:42 -04:00

49 lines
2.4 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "$0")/.." && pwd)"
# Operator-created NOLOGIN group role granted to the region runtime login (ADR-0060).
runtime_role="${EVO_PG_RUNTIME_ROLE:?set EVO_PG_RUNTIME_ROLE to the runtime group role}"
if [ -n "${EVO_PGPASS_SOURCE:-}" ]; then
umask 077
export PGPASSFILE
PGPASSFILE="$(mktemp /tmp/evo-pgpass.XXXXXXXX)"
trap 'rm -f -- "$PGPASSFILE"' EXIT
cat "$EVO_PGPASS_SOURCE" > "$PGPASSFILE"
fi
# Connection comes from PG* environment / mounted service and password files.
# Never print the connection or enable shell tracing here.
digest="$(sha256sum "$root/migrations/0001_region_bootstrap.sql")"
digest="${digest%% *}"
digest_2="$(sha256sum "$root/migrations/0002_region_fencing.sql")"
digest_2="${digest_2%% *}"
digest_3="$(sha256sum "$root/migrations/0003_region_checkpoints.sql")"
digest_3="${digest_3%% *}"
digest_4="$(sha256sum "$root/migrations/0004_lineage_profile.sql")"
digest_4="${digest_4%% *}"
digest_5="$(sha256sum "$root/migrations/0005_batch_decisions.sql")"
digest_5="${digest_5%% *}"
digest_6="$(sha256sum "$root/migrations/0006_commit_lookup.sql")"
digest_6="${digest_6%% *}"
digest_7="$(sha256sum "$root/migrations/0007_region_clones.sql")"
digest_7="${digest_7%% *}"
digest_8="$(sha256sum "$root/migrations/0008_upgrade_barrier.sql")"
digest_8="${digest_8%% *}"
digest_9="$(sha256sum "$root/migrations/0009_serialized_authority.sql")"
digest_9="${digest_9%% *}"
digest_10="$(sha256sum "$root/migrations/0010_account_control.sql")"
digest_10="${digest_10%% *}"
digest_11="$(sha256sum "$root/migrations/0011_region_actions.sql")"
digest_11="${digest_11%% *}"
digest_12="$(sha256sum "$root/migrations/0012_probe_handoff.sql")"
digest_12="${digest_12%% *}"
digest_13="$(sha256sum "$root/migrations/0013_probe_incoming.sql")"
digest_13="${digest_13%% *}"
psql -X --no-password --set=ON_ERROR_STOP=1 --set="migration_sha=$digest" \
--set="migration_sha_2=$digest_2" --set="migration_sha_3=$digest_3" \
--set="migration_sha_4=$digest_4" --set="migration_sha_5=$digest_5" \
--set="migration_sha_6=$digest_6" --set="migration_sha_7=$digest_7" \
--set="migration_sha_8=$digest_8" --set="migration_sha_9=$digest_9" \
--set="migration_sha_10=$digest_10" --set="migration_sha_11=$digest_11" --set="migration_sha_12=$digest_12" --set="migration_sha_13=$digest_13" \
--set="runtime_role=$runtime_role" \
--file="$root/migrations/apply.sql"