Sha256: 53f1e8614f4d88bfb0a315ba96d493ce38b7f4be8b2dd2618750d3db0192c49d
Contents?: true
Size: 965 Bytes
Versions: 4
Compression:
Stored size: 965 Bytes
Contents
module Storey class SqlDumper easy_class_to_instance def initialize(options={}) @file = options[:file] || File.join(Rails.root, "db", "structure.sql") end def dump stdout_str, stderr_str, status = Open3.capture3(command) raise "Error dumping database: #{stderr_str}" if status.exitstatus != 0 end private def abcs @abcs ||= ::ActiveRecord::Base.configurations.with_indifferent_access[Rails.env] end def search_path @search_path ||= abcs[:schema_search_path] end def database_name @database_name ||= Shellwords.escape(abcs[:database]) end def command return @command if defined?(@command) args = Storey.database_config.slice(:host, :username, :password).merge( structure_only: true, file: @file, schemas: search_path, database: database_name, ).symbolize_keys @command = GenDumpCommand.(args) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
storey-2.2.0 | lib/storey/sql_dumper.rb |
storey-2.1.2 | lib/storey/sql_dumper.rb |
storey-2.1.1 | lib/storey/sql_dumper.rb |
storey-2.1.0 | lib/storey/sql_dumper.rb |