#!/usr/bin/env bash # After pg_restore --no-owner --no-acl: give app role full rights on non-system schemas. # Do NOT ALTER SEQUENCE OWNER for serials linked to tables (Postgres rejects that); # ALTER TABLE OWNER covers owned serials. # Usage inside CTR: goa-pg-acl-fixup.sh set -euo pipefail db="${1:?db}" owner="${2:?owner}" # owner is a fixed role name from the restore caller (no user input). runuser -u postgres -- psql -d "$db" -v ON_ERROR_STOP=1 <