diff --git a/hooks/boot/06-postgresql-upgrade-extensions.rb b/hooks/boot/06-postgresql-upgrade-extensions.rb index fe76c8b1..5f3fc869 100644 --- a/hooks/boot/06-postgresql-upgrade-extensions.rb +++ b/hooks/boot/06-postgresql-upgrade-extensions.rb @@ -43,6 +43,11 @@ def postgresql_upgrade(new_version) execute_as!('postgres', 'vacuumdb --all --analyze-in-stages', false, true) + if new_version.to_i == 13 + logger.notice("Updating ownership of the evr extension if upgrading to postgres version 13") + execute_as!('postgres', "psql -d foreman -c \"UPDATE pg_extension SET extowner = (SELECT oid FROM pg_authid WHERE rolname = 'foreman') WHERE extname = 'evr';\"", false, true) + end + logger.notice("Upgrade to PostgreSQL #{new_version} completed") end