You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
arkecode@sachins:~/repository/Factory$ rake db:migrate --trace
warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.8-compliant syntax, but you are running 2.6.2.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:structure:dump (first_time)
** Invoke db:load_config
** Execute db:structure:dump
rake aborted!
TypeError: no implicit conversion of nil into String
/home/arkecode/.rvm/gems/ruby-2.6.2/gems/activerecord-5.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:117:in `system'
/home/arkecode/.rvm/gems/ruby-2.6.2/gems/activerecord-5.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:117:in `run_cmd'
/home/arkecode/.rvm/gems/ruby-2.6.2/gems/activerecord-5.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:79:in `structure_dump'
/home/arkecode/.rvm/gems/ruby-2.6.2/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:228:in `structure_dump'
/home/arkecode/.rvm/gems/ruby-2.6.2/gems/activerecord-5.2.6/lib/active_record/railties/databases.rake:287:in `block (3 levels) in <top (required)>'
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: