lib/sequel_rails/storage/postgres.rb in sequel-rails-0.4.1 vs lib/sequel_rails/storage/postgres.rb in sequel-rails-0.4.2

- old
+ new

@@ -23,9 +23,35 @@ commands << database res = system(*commands) ENV["PGPASSWORD"] = nil unless password.blank? res end + + def _dump filename + ENV["PGPASSWORD"] = password unless password.blank? + commands = %w(pg_dump -i -s -x -O) + commands << "-f" << filename + commands << "-U" << username unless username.blank? + commands << "--port" << port.to_s unless port.blank? + commands << "--host" << host unless host.blank? + commands << database + res = system(*commands) + ENV["PGPASSWORD"] = nil unless password.blank? + res + end + + def _load filename + ENV["PGPASSWORD"] = password unless password.blank? + commands = %w(psql) + commands << "-f" << filename + commands << "-U" << username unless username.blank? + commands << "--port" << port.to_s unless port.blank? + commands << "--host" << host unless host.blank? + commands << database + res = system(*commands) + ENV["PGPASSWORD"] = nil unless password.blank? + res + end def close_connections begin db = ::Sequel.connect(config) # Will only work on Postgres > 8.4