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

Ensure to connect database when load_config #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tanahiro
Copy link

Hello, I get an error when I try to run Rake tasks.
I don't use Rails but simply try to load some tasks from activegroonga.
With this fix, I can run without error.

Thanks

@kou
Copy link
Member

kou commented Jul 15, 2018

Can you show full errror message what you got?

@tanahiro
Copy link
Author

Sorry I didn't include the info..

In config/groonga.yml

development:
  database: tmp/db/groonga

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  database: test/tmp/db/groonga

production:
  database: tmp/db/groonga

Rakefile

require "rails"
require "rails/application"
require "active_groonga/railtie"
Class.new(Rails::Application) unless Rails.application

require "active_groonga"
require "rails/generators"
require "rails/generators/active_groonga"
ActiveGroonga::Base.logger = Logger.new(STDOUT)

load "active_groonga/railties/groonga.rake"

namespace :groonga do
  task :environment => "load_config"
end

Execution and error messages

$ rake groonga:migrate:status --trace
** Invoke groonga:migrate:status (first_time)
** Invoke groonga:environment (first_time)
** Invoke groonga:load_config (first_time)
** Execute groonga:load_config
** Execute groonga:environment
** Invoke groonga:load_config
** Execute groonga:migrate:status
rake aborted!
ArgumentError: unregistered Groonga object: name: <"UInt64">
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rroonga-7.1.1/lib/groonga/schema.rb:815:in `create'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rroonga-7.1.1/lib/groonga/schema.rb:815:in `define'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rroonga-7.1.1/lib/groonga/schema.rb:629:in `block in define'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rroonga-7.1.1/lib/groonga/schema.rb:628:in `each'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rroonga-7.1.1/lib/groonga/schema.rb:628:in `define'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/schema.rb:46:in `define'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/schema.rb:22:in `define'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/migrator.rb:76:in `ensure_table'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/migrator.rb:48:in `initialize'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/migrator.rb:139:in `new'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/migrator.rb:139:in `management_table'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activegroonga-4.2.1/lib/active_groonga/railties/groonga.rake:92:in `block (3 levels) in <top (required)>'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/home/tanahiro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/tanahiro/.rbenv/versions/2.5.1/bin/rake:23:in `load'
/home/tanahiro/.rbenv/versions/2.5.1/bin/rake:23:in `<main>'
Tasks: TOP => groonga:migrate:status

@kou
Copy link
Member

kou commented Jul 30, 2018

Thanks.
Do you want to use just migration feature?

@tanahiro
Copy link
Author

tanahiro commented Aug 1, 2018

Yes, you're right.

Or maybe using with non-rails framework like Padrino.

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

Successfully merging this pull request may close these issues.

2 participants