books migration: only call meta.sync() when permitted; deploy runs it as the app role
All checks were successful
Deploy production / deploy (push) Successful in 2m35s
All checks were successful
Deploy production / deploy (push) Successful in 2m35s
Run #77 failed in db-migrate with "permission denied for function sync": in prod meta.sync() is granted to personal_app/personal_ddl, not to the schema owner (personal) that runs migrations. The migration still registers the books tables in meta.tables and syncs when it can (dev); deploy-remote.sh now runs scripts/db-meta-sync.ts as DB_URL after migrating. Verified on a prod clone with SET ROLE personal / personal_app.
This commit is contained in:
@@ -103,6 +103,12 @@ run_database_script() {
|
||||
if [ "$mode" = deploy ]; then
|
||||
# Schema changes: Drizzle migrations from ./drizzle, as the schema owner.
|
||||
run_database_script scripts/db-migrate.ts
|
||||
# Refresh the generic table GUI's column registry (meta.columns) for tables that migrations
|
||||
# registered in meta.tables. meta.sync() is SECURITY DEFINER and granted to the app role, not
|
||||
# to the schema owner, so run it as DB_URL (personal_app).
|
||||
echo "Running meta.sync()"
|
||||
sudo docker run --rm --network backend --env-file "$environment" "$image" \
|
||||
bun scripts/db-meta-sync.ts
|
||||
run_database_script scripts/seed-catalog.ts
|
||||
run_database_script scripts/seed-cod-catalog.ts
|
||||
run_database_script scripts/seed-pokemon-research.ts
|
||||
|
||||
Reference in New Issue
Block a user