Forum: Ruby on Rails migrations schema_info table, Rails Recipes Bug?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F10f95926f620318a71c102f207649b7?d=identicon&s=25 Manish Shah (Guest)
on 2006-03-08 06:07
(Received via mailing list)
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.
7ed3175d60e44aa7cb891973223e3998?d=identicon&s=25 Chad Fowler (Guest)
on 2006-03-08 18:59
(Received via mailing list)
On 3/7/06, Manish Shah <mnshah@gmail.com> 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 Fowler
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!)
92dafea96df3ff949b426b235a19ae0e?d=identicon&s=25 Chris Taggart (Guest)
on 2006-03-08 23:47
(Received via mailing list)
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]
92dafea96df3ff949b426b235a19ae0e?d=identicon&s=25 ChrisT (Guest)
on 2006-03-08 23:47
(Received via mailing list)
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]
This topic is locked and can not be replied to.