Sha256: 5589899260cf3f2775a91e3a1cf383daa4d5b8cbbe4a5e6a36aa6154357adcc6

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

module AmicoDb
  class DumpCmd
    attr_accessor :db_user
    attr_accessor :db_name
    attr_accessor :folder_dump
    attr_accessor :remote_app_path

    def initialize(db_user: AmicoDb.configuration.db_user,
                   db_name: AmicoDb.configuration.db_name,
                   folder_dump: AmicoDb.configuration.folder_dump,
                   remote_app_path: AmicoDb.configuration.remote_app_path)
      self.db_user = db_user
      self.db_name = db_name
      self.folder_dump = folder_dump
      self.remote_app_path = remote_app_path
    end

    def call
      cmd = "'mysqldump -u #{db_user} --ignore-table=#{db_name}.ar_internal_metadata --no-create-db -p$MYSQL_ROOT_PASSWORD #{db_name} > #{folder_dump}'"
      cmds = ["cd #{remote_app_path}", "docker-compose exec -T db bash -c #{cmd}"]
      cmds.join('; ')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amico-db-0.1.8 lib/amico-db/dump_cmd.rb
amico-db-0.1.7 lib/amico-db/dump_cmd.rb