Sha256: bbe24d542d1d382abba0373b6f04704df64181f90a57a61b6df80355511c9ff1
Contents?: true
Size: 994 Bytes
Versions: 7
Compression:
Stored size: 994 Bytes
Contents
# frozen_string_literal: true module UffDbLoader module Postgresql def self.dump_extension "dump" end def self.dump_command_template "ssh %user%@%host% \"docker exec -i %app_name%_%environment%_db sh -c 'exec pg_dump --username \\$POSTGRES_USER --clean --no-owner --no-acl --format=c %database%'\" > %target%" end def self.restore_command(database_name, result_file_path) "pg_restore --username postgres --clean --if-exists --no-owner --no-acl --dbname #{database_name} #{result_file_path}" end def self.list_databases ActiveRecord::Base .connection .execute("SELECT datname FROM pg_database;") .values .flatten end def self.create_database(database_name) ActiveRecord::Base.connection.execute("CREATE DATABASE #{database_name};") end def self.drop_database(database_name) ActiveRecord::Base.connection.execute("DROP DATABASE IF EXISTS #{database_name};") end end end
Version data entries
7 entries across 7 versions & 1 rubygems