Open sachinsaxena1996 opened 2 years ago
Actualy I found a workaround for this where I am overiding rake db:structure:dump as follows in a file lib/tasks/xyz.rake :
Rake::Task['db:structure:dump'].overwrite do config = PostgresUtility.db_connection_config filename = ENV['DB_STRUCTURE'] || Rails.root.join('db/structure.sql') raise "Task not supported by #{config[:adapter]}" unless PostgresUtility.postgresql?
conf = config.stringify_keys ENV['PGHOST'] = conf['host'] if conf['host'] ENV['PGPORT'] = conf['port'].to_s if conf['port'] ENV['PGPASSWORD'] = conf['password'].to_s if conf['password'] ENV['PGUSER'] = conf['username'].to_s if conf['username']
search_path = config[:schema_search_path]
if search_path.present?
search_path = search_path.split(',').map do |search_path_part|
"--schema=#{Shellwords.escape(search_path_part.strip)}"
end.join(' ')
end
database = PostgresUtility.db_name
pg_dump --no-tablespaces -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(database)}
raise 'Error dumping database' if $CHILD_STATUS.exitstatus == 1
File.open(filename, 'a') { |f| f << "SET search_path TO #{ActiveRecord::Base.connection.schema_search_path};\n\n" } File.open(filename, 'a') { |f| f << ActiveRecord::Base.connection.dump_schema_information } end I hope it helps anyone else facing the same issue
Hi,
I am using gem 'makara', '0.5.0' with rails 5.2.6. I get below error when I run rake db: migrate --trace Ruby version is 2.6.2. Any help is appreciated!