# Migrations schema\_info table, Rails Recipes Bug?

**URL:** <https://www.ruby-forum.com/t/migrations-schema-info-table-rails-recipes-bug/78225>\
**Category:** Rails\
**Created:** [March 8, 2006, 6:07am UTC](https://www.ruby-forum.com/t/migrations-schema-info-table-rails-recipes-bug/78225 "2006-03-08T06:07:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 8, 2006, 6:07am UTC](https://www.ruby-forum.com/t/migrations-schema-info-table-rails-recipes-bug/78225/1 "2006-03-08T06:07:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 8, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/migrations-schema-info-table-rails-recipes-bug/78225/2 "2006-03-08T18:59:26Z")

</div>

On 3/7/06, Manish S. [removed\_email\_address@domain.invalid](mailto: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://chadfowler.com)  
[http://pragmaticprogrammer.com/titles/fr\_rr/](http://pragmaticprogrammer.com/titles/fr_rr/) (Rails Recipes - In Beta!)  
[http://pragmaticprogrammer.com/titles/mjwti/](http://pragmaticprogrammer.com/titles/mjwti/) (My Job Went to India,  
and All I Got Was This Lousy Book)  
[http://rubycentral.org](http://rubycentral.org)  
[http://rubygarden.org](http://rubygarden.org)  
[http://rubygems.rubyforge.org](http://rubygems.rubyforge.org) (over one million gems served!)

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 8, 2006, 11:47pm UTC](https://www.ruby-forum.com/t/migrations-schema-info-table-rails-recipes-bug/78225/3 "2006-03-08T23:47:41Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 8, 2006, 11:47pm UTC](https://www.ruby-forum.com/t/migrations-schema-info-table-rails-recipes-bug/78225/4 "2006-03-08T23:47:40Z")

</div>

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]
