Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clickhouse:structure:dump throws an error in rails_70 branch #131

Open
AlexKichkailo opened this issue Apr 3, 2024 · 1 comment
Open

Comments

@AlexKichkailo
Copy link

When running bin/rails clickhouse:structure:dump I am getting the following error

throws NoMethodError: undefined method `with_indifferent_access' for #<ActiveRecord::DatabaseConfigurations::HashConfig

      @configuration = configuration.with_indifferent_access
                                    ^^^^^^^^^^^^^^^^^^^^^^^^
/src/vendor/bundle/ruby/3.1.0/gems/clickhouse-activerecord-0.6.2/lib/clickhouse-activerecord/tasks.rb:8:in `initialize'
/src/vendor/bundle/ruby/3.1.0/gems/clickhouse-activerecord-0.6.2/lib/tasks/clickhouse.rake:48:in `new'
/src/vendor/bundle/ruby/3.1.0/gems/clickhouse-activerecord-0.6.2/lib/tasks/clickhouse.rake:48:in `block (3 levels) in <top (required)>'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `block in execute'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `each'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `execute'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `synchronize'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `invoke_with_call_chain'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/task.rb:188:in `invoke'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:182:in `invoke_task'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block (2 levels) in top_level'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `each'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block in top_level'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:147:in `run_with_threads'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:132:in `top_level'
/src/vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.1/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/application.rb:208:in `standard_exception_handling'
/src/vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.1/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/src/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib/rake/rake_module.rb:59:in `with_application'
/src/vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.1/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/src/vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.1/lib/rails/command.rb:51:in `invoke'
/src/vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.1/lib/rails/commands.rb:18:in `<top (required)>'

Appears to be an issue in rails_70 branch.

@senid231
Copy link

senid231 commented Jul 20, 2024

temp fix

ClickhouseActiverecord::Tasks.class_eval do
  def initialize(configuration)
    # sometimes configuration is an instance of ActiveRecord::DatabaseConfigurations::HashConfig
    # and sometimes it's a Hash
    @configuration = if configuration.respond_to?(:configuration_hash)
                       configuration.configuration_hash.with_indifferent_access
                     else
                       configuration.with_indifferent_access
                     end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants