Migrations schema_info table, Rails Recipes Bug?


#1

I have the rails recipes book and i was going through the migrations
recipe. Everything seemed to work except for the last part in trying to
do
a rake migrate with a migration file version 1 and the schema_info
version
set to 0. Without the force attribute, the rake migration fails, as
expected.

So the recipe says to run this:

ruby script/runner ‘ActiveRecord::Base.connection.execute(“INSERT INTO
schema_info (version) VALUES(1)”)’

with an INSERT function. however, it said the schema_info table is just
1
column, 1 row. Is this true? Cause if that is true, shouldnt the
command
be to “UPDATE” the version to 1, not inserting another row?

I guess my confusion lies in the definition of schema_info. I think it
makes sense to be just one column, one row, but i’m just a simple minded
programmer.

But anyway, my rake migrations kept failing until i switched to the
update
command:

ruby script/runner ‘ActiveRecord::Base.connection.execute(“UPDATE
schema_info SET version=1”)’

I know its a beta book, so i’m looking to confirm if this is a bug or
not.

Thanks.


#2

On 3/7/06, Manish S. removed_email_address@domain.invalid wrote:

with an INSERT function. however, it said the schema_info table is just 1
ruby script/runner ‘ActiveRecord::Base.connection.execute(“UPDATE
schema_info SET version=1”)’

I know its a beta book, so i’m looking to confirm if this is a bug or not.

Thanks, Manish. I think you’re right. I need to go back through and
make sure that this follows the same flow that I did in the Recipe.
Your comments are appreciated!


Chad F.
http://chadfowler.com
http://pragmaticprogrammer.com/titles/fr_rr/ (Rails Recipes - In Beta!)
http://pragmaticprogrammer.com/titles/mjwti/ (My Job Went to India,
and All I Got Was This Lousy Book)
http://rubycentral.org
http://rubygarden.org
http://rubygems.rubyforge.org (over one million gems served!)


#3

I had this very same prob today, but there was some mention on the
user-submitted errata of deleting the 0 (leaving just the 1) – which I
did and this solved the prob., and I’ve since done another migration
without any probs, so that seems the prob.
Chris T
[Good book apart from that, and well worth the money]


#4

I had this very same prob today, but there was some mention on the
user-submitted errata of deleting the 0 (leaving just the 1) – which I
did and this solved the prob., and I’ve since done another migration
without any probs, so that seems the prob.
Chris T
[Good book apart from that, and well worth the money]