skcc321/dumpman

View on GitHub
lib/dumpman/adapters/pg.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
63%
module Dumpman
  module Adapters
    class Pg < Base
      def dump_cmd
        "PGPASSWORD='#{password}' pg_dump -h #{host} --username '#{username}' --verbose --clean --no-owner --no-acl -Z4 -Fc #{database} > '#{Dumpman.dump_file}'"
      end

      def restore_cmd
        "PGPASSWORD='#{password}' pg_restore -h #{host} --username '#{username}' --verbose --clean --no-owner --no-acl -j 4 -d #{database} '#{Dumpman.dump_file}'"
      end

      def drop_cmd
        "PGPASSWORD='#{password}' dropdb -h #{host} --username '#{username}' #{database}"
      end

      def create_cmd
        "PGPASSWORD='#{password}' createdb -h #{host} --username '#{username}' #{database}"
      end
    end
  end
end