AR::migrations

June 9th, 2008

ActiveRecord database schema migration info is stored in the main database, so that if one needs to manually hack a migration (fastforward/rewind), just update TABLENAME_schema_infos column ‘version’ to a new value and manually change your schema. Next ‘boot’ may generate (or not) new migrations.

riverside=# select * from foobar_schema_infos;
id | version
—+———
1 | 1.4
(1 row)

In a self note, forget not to set option :id => false on join tables for has_and_belongs_to_many relations.


2 Comments to “AR::migrations”


  1. Ruben Fonseca said:

    Hi Pedro! You can always look at the rake db:migrate namespace. They have useful tasks for this kind of situations like

    rake db:migrate:down
    rake db:migrate:redo
    rake db:migrate:reset
    rake db:migrate:up

    and others :)


  2. pedro said:

    Hi Ruben,

    yes, we can too do self.up and self..down on the Camping Model. I was referring to a pure hack situation. But thanx for the tip ;)
    How’s everything down there at 7Syntax ? Say hi to cpinto and vd for me ;)

Leave a Reply