Skip to content

Commit

Permalink
Set postgres db owner to confluence user.
Browse files Browse the repository at this point in the history
* This allows a database to be imported using a more flexible backup,
  taken with the `--no-owner` flag. However, in order for the new
database to work as expected, the database my be owned by the user
expected to interact with it. This way, the table ownership is
automatically set to this db user during import, and this db user can
continue to access later.
  • Loading branch information
patcon committed Sep 29, 2015
1 parent 409d58a commit f1e07a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recipes/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
action :create
end

postgresql_database 'set database owner' do
connection database_connection
sql "ALTER DATABASE #{settings['database']['name']} OWNER TO #{settings['database']['user']}"
action :query
end

postgresql_database_user settings['database']['user'] do
connection database_connection
password settings['database']['password']
Expand Down

0 comments on commit f1e07a8

Please sign in to comment.