lib/tasks/pg_pull.rake in effective_developer-0.6.13 vs lib/tasks/pg_pull.rake in effective_developer-0.6.14
- old
+ new
@@ -128,14 +128,16 @@
db = { username: (config['username'] || `whoami`), password: config['password'], host: config['host'], port: (config['port'] || 5432), database: config['database'] }
db.transform_values! { |v| v.respond_to?(:chomp) ? v.chomp : v }
puts "=== Loading #{args.filename} into local '#{db[:database]}' database"
- if system("export PGPASSWORD=#{db[:password]}; pg_restore --no-acl --no-owner --clean --if-exists -h #{db[:host]} -U #{db[:username]} -d #{db[:database]} #{args.filename}")
- puts "Loading database completed"
+ command = "export PGPASSWORD=#{db[:password]}; pg_restore --no-acl --no-owner --clean --if-exists -h #{db[:host]} -U #{db[:username]} -d #{db[:database]} #{args.filename}"
+
+ if system(command)
+ puts "\nLoading database completed"
else
- abort "Error loading database"
+ abort "\nLoading database completed with errors. It probably worked just fine."
end
end
# bundle exec rake pg:save => Will dump the database to latest.dump
# bundle exec rake pg:save[something.dump] => Will dump the database to something.dump
@@ -181,10 +183,12 @@
puts "=== Saving local '#{db[:database]}' database to #{args.filename}"
exclude_table_data = "--exclude-table-data=logs" unless (args.logs == 'true')
- if system("export PGPASSWORD=#{db[:password]}; pg_dump -Fc --no-acl --no-owner #{exclude_table_data} -h #{db[:host]} -p #{db[:port]} -U #{db[:username]} #{db[:database]} > #{args.filename}")
+ command = "export PGPASSWORD=#{db[:password]}; pg_dump -Fc --no-acl --no-owner #{exclude_table_data} -h #{db[:host]} -p #{db[:port]} -U #{db[:username]} #{db[:database]} > #{args.filename}"
+
+ if system(command)
puts "Saving database completed"
else
abort "Error saving database"
end
end