# Rake db:migrate failing in production in 2.3.2

**URL:** <https://www.ruby-forum.com/t/rake-db-migrate-failing-in-production-in-2-3-2/172156>\
**Category:** Rails\
**Created:** [July 15, 2009, 7:41pm UTC](https://www.ruby-forum.com/t/rake-db-migrate-failing-in-production-in-2-3-2/172156 "2009-07-15T19:41:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![plambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@plambert](https://www.ruby-forum.com/u/plambert)\
**Post date:** [July 15, 2009, 7:41pm UTC](https://www.ruby-forum.com/t/rake-db-migrate-failing-in-production-in-2-3-2/172156/1 "2009-07-15T19:41:59Z")

</div>

I just upgraded from Rails 2.2.2 to Rails 2.3.2, and found that  
running rake db:migrate fails now in production mode, unless I add “–  
require ‘config/environment’” between “rake” and “db:migrate”. The  
error complains that model classes referenced in our migrations are  
not defined. In development mode, everything works as usual.

Is this to be expected, or have I missed some step in the upgrade?  
Thanks,  
–Paul

---

<div class="post-metadata">

**Author:** ![plambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@plambert](https://www.ruby-forum.com/u/plambert)\
**Post date:** [July 16, 2009, 5:47am UTC](https://www.ruby-forum.com/t/rake-db-migrate-failing-in-production-in-2-3-2/172156/2 "2009-07-16T05:47:13Z")

</div>

Quoting Paul E. G. Lynch [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I just upgraded from Rails 2.2.2 to Rails 2.3.2, and found that  
> running rake db:migrate fails now in production mode, unless I add “–  
> require ‘config/environment’” between “rake” and “db:migrate”. The  
> error complains that model classes referenced in our migrations are  
> not defined. In development mode, everything works as usual.

rake db:migrate RAILS\_ENV=production

It works fine for me on two different Rails 2.3.2 Linux hosts (OpenSuSE  
10.3  
on an IBM ThinkPad and Debian 5.0 on an Amazon EC2 instance).

What is the error message and/or symptoms?

Jeffrey
