rake migrate error: SQLexception

When i try to migrate my db, it gives the following error:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
SQLite3::SQLException: no such table: users: SELECT * FROM "users"
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/abstract_adapter.rb:227:in `log'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/sqlite_adapter.rb:172:in `execute'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/sqlite_adapter.rb:172:in `execute'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/sqlite_adapter.rb:321:in `select'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_c
ache'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/conn
ection_adapters/abstract/query_cache.rb:62:in `select_all'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base
.rb:665:in `find_by_sql'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base
.rb:1582:in `find_every'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base
.rb:619:in `find'
C:/diederik/prails/zwemschool/config/initializers/task_scheduler.rb:6
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:171:in `load_without_new_constant_marking'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:171:in `load'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:547:in `new_constants_in'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:171:in `load'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:622:in
`lo
ad_application_initializers'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:621:in
`ea
ch'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:621:in
`lo
ad_application_initializers'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:176:in
`pr
ocess'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in
`se
nd'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in
`ru
n'
C:/diederik/prails/zwemschool/config/environment.rb:13
D:/Irails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_orig
inal_require'
D:/Irails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'

D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:182:in `require'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:547:in `new_constants_in'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/de
pendencies.rb:182:in `require'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/tasks/misc.rake:4
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
`call'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
`execute'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
`each'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
`execute'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
`invoke_with
_call_chain'
D:/Irails/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with
_call_chain'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in
`invoke_prer
equisites'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`each'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`invoke_prer
equisites'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
`invoke_with
_call_chain'
D:/Irails/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with
_call_chain'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in
`invoke'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
`invoke_tas
k'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level'

D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`each'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level'

D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_e
xception_handling'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
`top_level'

D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in
`run'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_e
xception_handling'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in
`run'
D:/Irails/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
D:/Irails/ruby/bin/rake:19:in `load'
D:/Irails/ruby/bin/rake:19

Any chance that at line 6 of config/initializers/task_scheduler.rb you
access Users before the users table has been created?

If so, what happens if you comment that line while you migrate to
create the table?

Hi kelly,

Kindly ensure that you are created the model named “User” before migration done…It seems to be you are not created the ‘user’ table.

Michael Pavling wrote in post #996409:

Any chance that at line 6 of config/initializers/task_scheduler.rb you
access Users before the users table has been created?

If so, what happens if you comment that line while you migrate to
create the table?

You sir, saved my day. I should have looked more closely into the
errors.
Thank you very much.

No worries... they can be a pain to decipher sometimes - I've just
been banging my head against a bug myself which was waving itself in
my face! :slight_smile: