# rake fails

**URL:** <https://discuss.rubyonrails.org/t/rake-fails/21562>\
**Category:** rubyonrails-talk\
**Created:** [December 11, 2007, 10:39am UTC](https://discuss.rubyonrails.org/t/rake-fails/21562 "2007-12-11T10:39:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Thufir](https://discuss.rubyonrails.org/u/Thufir)\
**Post date:** [December 11, 2007, 10:39am UTC](https://discuss.rubyonrails.org/t/rake-fails/21562/1 "2007-12-11T10:39:36Z")

</div>

I don't understand why the rake fails. More precisely, the rake succeeds, but reverting to version 0 fails and I don't see why ☹

thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ cat db/migrate/001\_predators.rb class Predators \< ActiveRecord::Migration &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def self.up &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;create\_table :predators do |table| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.column :predator, :string &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def self.down &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;drop\_table :predators &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end end thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ rake db:migrate (in /home/thufir/Desktop/predator-prey) thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ rake db:migrate VERSION=0 (in /home/thufir/Desktop/predator-prey) == Predators: reverting

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 11, 2007, 10:43am UTC](https://discuss.rubyonrails.org/t/rake-fails/21562/2 "2007-12-11T10:43:37Z")

</div>

> I don't understand why the rake fails. More precisely, the rake succeeds, but reverting to version 0 fails and I don't see why ☹
> 
> thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ cat db/migrate/ 001\_predators.rb class Predators \< ActiveRecord::Migration &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def self.up &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;create\_table :predators do |table| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.column :predator, :string &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def self.down &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;drop\_table :predators &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end end

Sounds like it already thought you were at schema level 1. Did you  
change the migration after having previously run it (without migrating  
down to 0 in between)

---

<div class="post-metadata">

**Author:** ![Thufir](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Thufir](https://discuss.rubyonrails.org/u/Thufir)\
**Post date:** [December 11, 2007, 7:37pm UTC](https://discuss.rubyonrails.org/t/rake-fails/21562/3 "2007-12-11T19:37:56Z")

</div>

I guess it could be due to running the "rake db:migrate" prior to configuring the db/migration/001\_ file to add/drop tables?

I'd like to be able to "rake db:migrate VERSION=0"; to do so, merge back to r2 and configure the db/migration/001\_ file \*prior\* to the initial "rake db:migrate" command.

Sorta kinda makes sense. I know, kinda silly in a way, but I'd like to fix it.

thufir@arrakis ~/Desktop/predator-prey $ thufir@arrakis ~/Desktop/predator-prey $ svn log

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [December 11, 2007, 7:50pm UTC](https://discuss.rubyonrails.org/t/rake-fails/21562/4 "2007-12-11T19:50:43Z")

</div>

> > Sounds like it already thought you were at schema level 1. Did you change the migration after having previously run it (without migrating down to 0 in between)
> 
> I guess it could be due to running the "rake db:migrate" prior to configuring the db/migration/001\_ file to add/drop tables?

that would do it. comment out the stuff in the down migration, migrate down, uncomment and migrate back up.

Fred.
