Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add the VERSION to the contents of a database migration

#1139

If anyone else is like me, when they're developing their database, they may want to remigrate some of their migrations while developing the schema rather than creating multiple migrations to create one table before any real code development has started. In that case, the developer will run 'rake db:migrate:down' and 'rake db:migrate:up' multiple times. Each time the rake command will require the VERSION number, which is now a 14 digit number, much harder to type in than the old-styled 3 digit number. Copying and pasting this VERSION number is usually the preferred route for the lazy developer, but even that method is troubled by having to begin renaming the file, selecting just the numbers and pasting it into the command line.

In the style of 'annotate_models' this patch puts the migration's version number into a comment at the top of the file in the form of 'VERSION=XXXX' which allows developers to quickly copy and paste the suffices of the db:migrate:up/down rake commands.

Also included in this patch is an update to the documentation on migrations, as well as fixing a grammar issue for a rake task's description.

Reported by Mike Weber · September 29th, 2008 @ 09:56 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper

    Instead of passing VERSION every time, you can use rake db:rollback, edit the migration, then rake db:migrate.

    December 4th, 2008 @ 09:48 PM

  2. Pratik
    Pratik
    • State changed from new to wontfix

    Agree with what Jeremy said.

    December 19th, 2008 @ 02:09 PM

  3. bingbing