deploy(prod): NOTIFY pgrst reload schema after migrations + after rollback
Post-deploy, PostgREST keeps its pre-migration pg_proc snapshot and 404s any RPC added in the just-applied migrations until the rest container restarts. Confirmed on 2026-05-18 after migration 026 (set_item_frequency_weight + purge_item_frequency) — the "Purgar" button in /collective/manage returned "Could not find the function public.purge_item_frequency in the schema cache". `NOTIFY pgrst, 'reload schema'` triggers the same reload path the container would do on restart, but without a 2s blip in flight requests. Added at the end of the migration loop in deploy-erosi.sh, and at the end of the rebuild step in rollback-erosi.sh (rollback can change RPC shapes too). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -175,6 +175,13 @@ cd /opt/colectivo
|
||||
GIT_SHA="$GIT_SHA" docker compose --env-file .env -f infra/docker-compose.erosi.yml \
|
||||
build --build-arg GIT_SHA="$GIT_SHA" app
|
||||
GIT_SHA="$GIT_SHA" docker compose --env-file .env -f infra/docker-compose.erosi.yml up -d
|
||||
|
||||
# Reload PostgREST schema cache so any RPCs that changed shape between
|
||||
# the rolled-back schema and the current rest container snapshot are
|
||||
# resolved. Mirrors the same step at the end of deploy-erosi.sh.
|
||||
docker compose --env-file .env -f infra/docker-compose.erosi.yml exec -T db \
|
||||
psql -U postgres -d postgres </dev/null \
|
||||
-c "NOTIFY pgrst, 'reload schema';"
|
||||
REMOTE
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user