Project

General

Profile

Bug #15040

Could not find table 'users' during db:migrate

Added by Dominic Cleal about 6 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

db:migrate on a clean setup is failing on develop since #12225:

rake db:migrate
The Apipie cache is turned off. Enable it and run apipie:cache rake task to speed up API calls.
rake aborted!
ActiveRecord::StatementInvalid: Could not find table 'users'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/sqlite3_adapter.rb:513:in `table_structure'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/sqlite3_adapter.rb:387:in `columns'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/schema_cache.rb:43:in `columns'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/attributes.rb:93:in `columns'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/attributes.rb:98:in `columns_hash'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:48:in `columns_hash'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/relation/calculations.rb:178:in `block in pluck'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/relation/calculations.rb:177:in `map'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/relation/calculations.rb:177:in `pluck'
/home/dcleal/code/foreman/foreman/config/initializers/foreman.rb:38:in `<top (required)>'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/engine.rb:652:in `block in load_config_initializer'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/engine.rb:651:in `load_config_initializer'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/engine.rb:615:in `each'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/engine.rb:615:in `block in <class:Engine>'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `each'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `tsort_each_child'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing'
/home/dcleal/code/foreman/foreman/config/environment.rb:5:in `<top (required)>'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/bin/ruby_executable_hooks:15:in `eval'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

(also http://ci.theforeman.org/job/test_develop/2092/)


Related issues

Related to Foreman - Bug #12225: TopbarSweeper should invalidate on plugin installation/removalClosed2015-10-20
Related to Foreman - Refactor #15866: Provide alternative way of migrating data as oposed misuing db:migrate for this purposeNew2016-07-27

Associated revisions

Revision a0fc0462 (diff)
Added by Dominic Cleal about 6 years ago

fixes #15040 - remove user fragment cache initializer

The initializer added in c3e0fed caused the foreman initializer to fail
as loaded the User model, which it assumes meant the table was present.
This isn't the case when db:migrate runs for the first time.

The new initializer has been removed so as to only keep the existing
cache expiry in the foreman initializer, which now checks for presence
of the table instead. The existing initializer is also compatible with
memcache, preventing an exception starting Rails.

History

#1 Updated by Dominic Cleal about 6 years ago

  • Related to Bug #12225: TopbarSweeper should invalidate on plugin installation/removal added

#2 Updated by Dominic Cleal about 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

#3 Updated by The Foreman Bot about 6 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3524 added

#4 Updated by Dominic Cleal about 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Ivan Necas almost 6 years ago

  • Related to Refactor #15866: Provide alternative way of migrating data as oposed misuing db:migrate for this purpose added

Also available in: Atom PDF