Sha256: ded717b70cfd0ae34fae1fa1efe43075e13567ccde47585d5d69a05a47ce6aad
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
module Dumper module Database class MySQL < Base DUMP_TOOL = 'mysqldump' FILE_EXT = 'sql.gz' def command "cd #{tmpdir} && #{dump_tool_path} #{connection_options} #{additional_options} #{@stack.configs[:mysql][:database]} | gzip > #{filename}" end def connection_options [ :host, :port, :username, :password ].map do |option| next if @stack.configs[:mysql][option].blank? "--#{option}='#{@stack.configs[:mysql][option]}'".gsub('--username', '--user') end.compact.join(' ') end def additional_options '--single-transaction' end def config_for(rails_env=nil) return unless defined?(ActiveRecord::Base) && ActiveRecord::Base.configurations && (config = ActiveRecord::Base.configurations[rails_env]) && %w(mysql mysql2).include?(config['adapter']) { :host => config['host'], :port => config['port'], :username => config['username'], :password => config['password'], :database => config['database'], :dump_tool => dump_tool_path } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dumper-0.3.0 | lib/dumper/database/mysql.rb |
dumper-0.2.2 | lib/dumper/database/mysql.rb |
dumper-0.2.0 | lib/dumper/database/mysql.rb |