13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/eve_app/sde/downloader.rb', line 13
def restore
table_list.each do |table_name,info|
sql %Q(DROP TABLE IF EXISTS "#{table_name}")
sql %Q(DROP TABLE IF EXISTS "#{info[:name]}")
end
options = ['-x -O']
options << "-h #{db_config[:host]}" if db_config[:host]
options << "-p #{db_config[:port]}" if db_config[:port]
options << "-U #{db_config[:username]}" if db_config[:username]
options << "-d #{db_config[:database]}"
options += table_list.keys.map { |name| "-t #{name}" }
options << local_archive.gsub('.bz2', '')
execute :pg_restore, *options
end
|