Class: Redmine::Installer::Plugin::Database::PostgreSQL

Inherits:
Redmine::Installer::Plugin::Database show all
Defined in:
lib/redmine-installer/plugins/database.rb

Overview

PostgreSQL

Constant Summary

Constants inherited from Redmine::Installer::Plugin::Database

DATABASE_BACKUP_DIR, DATABASE_YML_PATH

Instance Attribute Summary

Attributes inherited from Redmine::Installer::Plugin::Database

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Redmine::Installer::Plugin::Database

#backup, backup_all, #build, #file_for_backup, #get, #load, load_all, #make_config, #restore, restore_all

Methods inherited from Base

all, inherited, title

Methods included from Utils

included

Constructor Details

#initializePostgreSQL

Returns a new instance of PostgreSQL.



149
150
151
152
# File 'lib/redmine-installer/plugins/database.rb', line 149

def initialize
  super
  @params.add('port').default(5432)
end

Class Method Details

.adapter_nameObject



145
146
147
# File 'lib/redmine-installer/plugins/database.rb', line 145

def self.adapter_name
  'pg'
end

Instance Method Details

#command(comm, file) ⇒ Object



154
155
156
# File 'lib/redmine-installer/plugins/database.rb', line 154

def command(comm, file)
  %{PGPASSWORD="#{get('password')}" #{comm} -i -h #{get('host')} -p #{get('port')} -U #{get('username')} -Fc -f #{file}}
end

#command_for_backup(file) ⇒ Object



158
159
160
# File 'lib/redmine-installer/plugins/database.rb', line 158

def command_for_backup(file)
  command('pg_dump', file)
end

#command_for_restore(file) ⇒ Object



162
163
164
# File 'lib/redmine-installer/plugins/database.rb', line 162

def command_for_restore(file)
  command('psql', file)
end