Tuesday, September 28, 2010

Workaround for "ORA-04043: object * does not exist" in rake db:migrate

This has happened at least twice now, so I thought I'd share a workaround.

If you do a production migration in Rails:

RAILS_ENV=production rake db:migrate
and it dies with:
(in /path/to/some/project)
rake aborted!
ORA-04043: object plural_name_of_a_model does not exist
/path/to/some/project/Rakefile:10
(See full trace by running task with --trace) 

Then, first try using the --trace option:

RAILS_ENV=production rake db:migrate --trace

If the error is coming from a controller, move that controller and any others that fail to the base project directory (or somewhere outside of where it is supposed to be) and then run the migration again.

Be sure to move the controllers back afterwards.

No comments: