class RedmineInstaller::Database::PostgreSQL

Public Instance Methods

adapter_name() click to toggle source
# File lib/redmine-installer/database.rb, line 165
def adapter_name
  'postgresql'
end
backup_command(file) click to toggle source
# File lib/redmine-installer/database.rb, line 193
def backup_command(file)
  "#{cli_password} pg_dump --clean #{command_args} --format=custom --file=#{file} #{@database}"
end
cli_password() click to toggle source
# File lib/redmine-installer/database.rb, line 177
def cli_password
  if @password.present?
    "PGPASSWORD=\"#{@password}\""
  else
    ''
  end
end
command_args() click to toggle source
# File lib/redmine-installer/database.rb, line 169
def command_args
  args = []
  args << "--host=#{@host}"         unless @host.to_s.empty?
  args << "--port=#{@port}"         unless @port.to_s.empty?
  args << "--username=#{@username}" unless @username.to_s.empty?
  args.join(' ')
end
create_database_command() click to toggle source
# File lib/redmine-installer/database.rb, line 185
def create_database_command
  "#{cli_password} psql #{command_args} --command=\"create database #{@database};\""
end
default_port() click to toggle source
# File lib/redmine-installer/database.rb, line 161
def default_port
  5432
end
drop_database_command() click to toggle source
# File lib/redmine-installer/database.rb, line 189
def drop_database_command
  "#{cli_password} psql #{command_args} --command=\"drop database #{@database};\""
end
restore_command(file) click to toggle source
# File lib/redmine-installer/database.rb, line 197
def restore_command(file)
  "#{cli_password} pg_restore --clean #{command_args} --dbname=#{@database} #{file} 2>/dev/null"
end