# Rake fails

**URL:** <https://www.ruby-forum.com/t/rake-fails/122736>\
**Category:** Rails\
**Created:** [December 11, 2007, 2:41pm UTC](https://www.ruby-forum.com/t/rake-fails/122736 "2007-12-11T14:41:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 11, 2007, 2:41pm UTC](https://www.ruby-forum.com/t/rake-fails/122736/1 "2007-12-11T14:41:44Z")

</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  
def self.up  
create\_table :predators do |table|  
table.column :predator, :string  
end  
end

```
    def self.down
            drop_table :predators
    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

– drop\_table(:predators)  
rake aborted!  
SQLite3::SQLException: no such table: predators: DROP TABLE predators

(See full trace by running task with --trace)  
thufir@arrakis ~/Desktop/predator-prey $

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 12, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/rake-fails/122736/2 "2007-12-12T15:19:17Z")

</div>

On 11 Dec 2007, at 19:37, Thufir wrote:

> 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.

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 12, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/rake-fails/122736/3 "2007-12-12T13:58:16Z")

</div>

On Tue, 11 Dec 2007 10:43:37 +0000, Frederick C. wrote:

> 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?

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

r7 | hawat.thufir | 2007-12-11 02:31:58 -0800 (Tue, 11 Dec 2007) | 2  
lines

fixed syntax

* * *

r6 | hawat.thufir | 2007-12-11 02:30:38 -0800 (Tue, 11 Dec 2007) | 2  
lines

fixed syntax

* * *

r5 | hawat.thufir | 2007-12-11 02:29:36 -0800 (Tue, 11 Dec 2007) | 2  
lines

add/drop predator table

* * *

r4 | hawat.thufir | 2007-12-11 02:25:00 -0800 (Tue, 11 Dec 2007) | 3  
lines

rake db:migrate

* * *

r3 | hawat.thufir | 2007-12-11 02:22:34 -0800 (Tue, 11 Dec 2007) | 3  
lines

script/generate migration predators

* * *

r2 | hawat.thufir | 2007-12-11 02:10:27 -0800 (Tue, 11 Dec 2007) | 3  
lines

thufir@arrakis ~/Desktop $ rails predator-prey --database=sqlite3

* * *

r1 | (no author) | 2007-12-11 02:04:54 -0800 (Tue, 11 Dec 2007) | 1 line

## Initial directory structure.

thufir@arrakis ~/Desktop/predator-prey $

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [December 12, 2007, 11:43pm UTC](https://www.ruby-forum.com/t/rake-fails/122736/4 "2007-12-12T23:43:19Z")

</div>

On 11 Dec 2007, at 10:39, Thufir wrote:

> class Predators \< ActiveRecord::Migration  
> def self.up  
> create\_table :predators do |table|  
> table.column :predator, :string  
> end  
> end
> 
> ```
> def self.down
> drop_table :predators
> 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)
