From c52a2b627a3d54ae4b78c3e8ab6ffca34b3c7cd3 Mon Sep 17 00:00:00 2001 From: NorseGaud Date: Tue, 5 Jun 2018 23:43:53 -0400 Subject: [PATCH] Quick fix for fetch(:pg_database) on extension adding --- CHANGELOG.md | 3 +++ lib/capistrano/postgresql/helper_methods.rb | 4 ++-- lib/capistrano/postgresql/version.rb | 2 +- lib/capistrano/tasks/postgresql.rake | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3429666..2a5a7f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ### master +## v5.0.1, 2018-06-05 +- Quick fix for fetch(:pg_database) on extension adding + ## v5.0.0, 2018-06-05 - Code cleanup - Removal of legacy add hstore method diff --git a/lib/capistrano/postgresql/helper_methods.rb b/lib/capistrano/postgresql/helper_methods.rb index 4f08d84..d48d5a0 100644 --- a/lib/capistrano/postgresql/helper_methods.rb +++ b/lib/capistrano/postgresql/helper_methods.rb @@ -5,7 +5,7 @@ module Postgresql module HelperMethods def extension_exists?(extension) - psql 'test', fetch(:pg_system_db), '-tAc', %Q{"SELECT 1 FROM pg_extension WHERE extname='#{extension}';" | grep -q 1} + psql 'test', fetch(:pg_database), '-tAc', %Q{"SELECT 1 FROM pg_extension WHERE extname='#{extension}';" | grep -q 1} end def remove_extensions @@ -14,7 +14,7 @@ def remove_extensions # remove in reverse order if extension is present Array( fetch(:pg_extensions) ).reverse.each do |ext| next if [nil, false, ""].include?(ext) - psql 'execute', fetch(:pg_system_db), '-c', %Q{"DROP EXTENSION IF EXISTS #{ext};"} if extension_exists?(ext) + psql 'execute', fetch(:pg_database), '-c', %Q{"DROP EXTENSION IF EXISTS #{ext};"} if extension_exists?(ext) end end end diff --git a/lib/capistrano/postgresql/version.rb b/lib/capistrano/postgresql/version.rb index cf9d277..cdf8e77 100644 --- a/lib/capistrano/postgresql/version.rb +++ b/lib/capistrano/postgresql/version.rb @@ -1,5 +1,5 @@ module Capistrano module Postgresql - VERSION = '5.0.0' + VERSION = '5.0.1' end end diff --git a/lib/capistrano/tasks/postgresql.rake b/lib/capistrano/tasks/postgresql.rake index d50fa5e..6d24578 100644 --- a/lib/capistrano/tasks/postgresql.rake +++ b/lib/capistrano/tasks/postgresql.rake @@ -76,7 +76,7 @@ namespace :postgresql do if Array( fetch(:pg_extensions) ).any? Array( fetch(:pg_extensions) ).each do |ext| next if [nil, false, ''].include?(ext) - psql 'execute', fetch(:pg_system_db), '-c', %Q{"CREATE EXTENSION IF NOT EXISTS #{ext};"}unless extension_exists?(ext) + psql 'execute', fetch(:pg_database), '-c', %Q{"CREATE EXTENSION IF NOT EXISTS #{ext};"}unless extension_exists?(ext) end end end