I just inherited code that I'm attempting to run the migrations for but I keep getting a rake aborted error. I've come across others that have what appears to be similar issues, but most involved Heroku and I'm trying to run this locally (to start.)
I've tried troubleshooting using both PostgreSQL and SQLite, and both produce the same issue. The table "roles" referenced is the second migration called, so I'm having a hard time figuring out what is causing it to not get built. Any and all assistance is greatly appreciated. Thanks in advance.
Here's the roles migration:
class CreateRoles < ActiveRecord::Migration
def change
create_table :roles do |t|
t.string :name
t.timestamps
end
end
end
Here is the trace for SQLite:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Could not find table 'roles'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/sqlite_adapter.rb:470:in `table_structure'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/sqlite_adapter.rb:351:in `columns'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:228:in `yield'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:228:in `default'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:228:in `columns'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:248:in `column_names'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:261:in `column_methods_hash'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/dynamic_matchers.rb:69:in `all_attributes_exists?'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/dynamic_matchers.rb:27:in `method_missing'
/Users/sa/Documents/AptanaWorkspace/recprototype/config/initializ
ers/constants.rb:1:in `<top (required)>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:245:in `load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:245:in `block in load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:236:in `load_dependency'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:245:in `load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/engi
ne.rb:588:in `block (2 levels) in <class:Engine>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/engi
ne.rb:587:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/engi
ne.rb:587:in `block in <class:Engine>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:30:in `instance_exec'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:30:in `run'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:55:in `block in run_initializers'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:54:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:54:in `run_initializers'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/appl
ication.rb:136:in `initialize!'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/rail
tie/configurable.rb:30:in `method_missing'
/Users/sa/Documents/AptanaWorkspace/recprototype/config/environme
nt.rb:5:in `<top (required)>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:251:in `require'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:251:in `block in require'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:236:in `load_dependency'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:251:in `require'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/appl
ication.rb:103:in `require_environment!'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/appl
ication.rb:292:in `block (2 levels) in initialize_tasks'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:205:in `call'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:205:in `block in execute'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:200:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:200:in `execute'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:158:in `block in invoke_with_call_chain'
/Users/sa/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:151:in `invoke_with_call_chain'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:176:in `block in invoke_prerequisites'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:174:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:174:in `invoke_prerequisites'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:157:in `block in invoke_with_call_chain'
/Users/sa/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:151:in `invoke_with_call_chain'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:144:in `invoke'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:116:in `invoke_task'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:94:in `block (2 levels) in top_level'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:94:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:94:in `block in top_level'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:133:in `standard_exception_handling'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:88:in `top_level'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:66:in `block in run'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:133:in `standard_exception_handling'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:63:in `run'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/bin/rake:33:in `
<top (required)>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate => environment
Here is the trace for PostgreSQL:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
PG::Error: ERROR: relation "roles" does not exist
LINE 4: WHERE a.attrelid = '"roles"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a
.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"roles"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/postgresql_adapter.rb:1106:in `async_exec'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/postgresql_adapter.rb:1106:in `exec_no_cache'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/postgresql_adapter.rb:650:in `block in exec_query'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/notifications/instrumenter.rb:20:in `instrument'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/abstract_adapter.rb:275:in `log'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/postgresql_adapter.rb:649:in `exec_query'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/postgresql_adapter.rb:1231:in `column_definitions'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/postgresql_adapter.rb:845:in `columns'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:228:in `yield'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:228:in `default'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:228:in `columns'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:248:in `column_names'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/model_schema.rb:261:in `column_methods_hash'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/dynamic_matchers.rb:69:in `all_attributes_exists?'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.2.1/lib/active
_record/dynamic_matchers.rb:27:in `method_missing'
/Users/sa/Documents/AptanaWorkspace/recprototype/config/initializ
ers/constants.rb:1:in `<top (required)>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:245:in `load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:245:in `block in load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:236:in `load_dependency'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:245:in `load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/engi
ne.rb:588:in `block (2 levels) in <class:Engine>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/engi
ne.rb:587:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/engi
ne.rb:587:in `block in <class:Engine>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:30:in `instance_exec'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:30:in `run'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:55:in `block in run_initializers'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:54:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/init
ializable.rb:54:in `run_initializers'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/appl
ication.rb:136:in `initialize!'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/rail
tie/configurable.rb:30:in `method_missing'
/Users/sa/Documents/AptanaWorkspace/recprototype/config/environme
nt.rb:5:in `<top (required)>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:251:in `require'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:251:in `block in require'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:236:in `load_dependency'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.1/lib/activ
e_support/dependencies.rb:251:in `require'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/appl
ication.rb:103:in `require_environment!'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.1/lib/rails/appl
ication.rb:292:in `block (2 levels) in initialize_tasks'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:205:in `call'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:205:in `block in execute'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:200:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:200:in `execute'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:158:in `block in invoke_with_call_chain'
/Users/sa/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:151:in `invoke_with_call_chain'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:176:in `block in invoke_prerequisites'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:174:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:174:in `invoke_prerequisites'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:157:in `block in invoke_with_call_chain'
/Users/sa/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:151:in `invoke_with_call_chain'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb
:144:in `invoke'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:116:in `invoke_task'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:94:in `block (2 levels) in top_level'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:94:in `each'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:94:in `block in top_level'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:133:in `standard_exception_handling'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:88:in `top_level'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:66:in `block in run'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:133:in `standard_exception_handling'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/applica
tion.rb:63:in `run'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/bin/rake:33:in `
<top (required)>'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `load'
/Users/sa/.rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate => environment