Skip to content

Commit

Permalink
Refs #11098 - Update evr extension ownership after postgresql upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
sjha4 committed Aug 6, 2024
1 parent de26c75 commit 7f5e2ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hooks/boot/06-postgresql-upgrade-extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def postgresql_upgrade(new_version)
start_services(['postgresql'])

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

Expand Down

0 comments on commit 7f5e2ac

Please sign in to comment.