Rake fails

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 :frowning:

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

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.

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 $

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)