From 36f8d7e3bcefb81abaec55b60eb21a654f60b9b7 Mon Sep 17 00:00:00 2001 From: Matin Gathani Date: Mon, 30 Mar 2026 18:02:37 -0700 Subject: [PATCH] Fix hardcoded postgres owner on set_updated_at function Migration 0012 ran ALTER FUNCTION set_updated_at() OWNER TO postgres, which hard-codes the built-in superuser role. On managed PostgreSQL services and custom installations where that role does not exist, the migration fails with "role postgres does not exist". Rather than modifying 0012 (which would invalidate checksums for existing installations that have already run it), this new migration reassigns ownership to CURRENT_USER so it resolves correctly in any environment. Fixes #77 --- .../database/migrations/0043_fix_set_updated_at_owner.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 packages/sync-engine/src/database/migrations/0043_fix_set_updated_at_owner.sql diff --git a/packages/sync-engine/src/database/migrations/0043_fix_set_updated_at_owner.sql b/packages/sync-engine/src/database/migrations/0043_fix_set_updated_at_owner.sql new file mode 100644 index 000000000..e8675a68b --- /dev/null +++ b/packages/sync-engine/src/database/migrations/0043_fix_set_updated_at_owner.sql @@ -0,0 +1,5 @@ +-- Migration 0012 hardcoded "postgres" as the function owner, which fails on +-- PostgreSQL installations where that role does not exist (e.g. managed cloud +-- databases). Re-assign ownership to the role executing the migration so it +-- works in any environment. +ALTER FUNCTION set_updated_at() OWNER TO CURRENT_USER;