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.

There was a problem

You must be a member of this account.

This project is archived and is in readonly mode.

negative migration version

#2725

a tiny patch which allows you to specify negative migration version:

rake db:migrate VERSION=-N

such command will revert last N migrations

Reported by keymone · May 27th, 2009 @ 07:28 AM

State: invalid
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. keymone
    keymone
    • Tag changed from 2.3.x, active_record, migrator to 2.3.x, active_record, migrator, patch

    May 27th, 2009 @ 07:41 AM

  2. Bart Zonneveld
  3. Michael Koziarski
    Michael Koziarski

    don't we already have db:migrate:down VERSION=...?

    August 3rd, 2009 @ 06:02 AM

  4. keymone
    keymone

    we do, but we still have to type full version number like 200910xxxxxxx and looking up for that number each time i do downgrades really frustrates me (even though i do not downgrade very frequently) and

    rake db:migrate VERSION=-1
    

    makes me feel happy

    August 3rd, 2009 @ 07:16 AM

  5. Michael Koziarski
    Michael Koziarski

    It just seems a little terse to me.

    Could we fix it by simply making sure db:migrate:down has sensible defaults?

    August 5th, 2009 @ 07:05 AM

  6. keymone
    keymone

    the only sensible default for db:migrate:down i can think of is to downgrade to previous version however if you want to downgrade 2 or 3 versions you still have to lookup for correct version number

    one more thing i noticed when downgrading using full version number - everytime i stop and think what exactly rake db:migrate:down VERSION=xxxxxx means? will it revert all migrations including xxxxxx nor will it leave database alone at that point? it is not a problem but it does confuse me sometimes on the other hand when i type VERSION=-5 i know it will revert exactly 5 migrations.

    August 5th, 2009 @ 08:02 AM

  7. José Valim
    José Valim

    Isn't db:rollback STEP=N used for this purpose?

    August 8th, 2009 @ 05:46 PM

  8. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  9. Dan Pickett
    Dan Pickett
    • Tag changed from 2.3.x, active_record, migrator, patch to 2.3.x, active_record, bugmash, migrator, patch

    May 9th, 2010 @ 07:29 PM

  10. Jeff Kreeftmeijer
    Jeff Kreeftmeijer

    -1

    Like José said, we have rake db:rollback STEP=n for this. I could be completely missing something though.
    Also, I don't really like the VERSION=-n syntax.

    May 15th, 2010 @ 05:45 PM

  11. Anil Wadghule
    Anil Wadghule

    -1 Not a necessary feature. VERSION value should only be timestamp or migration number. VERSION as count is confusing.

    May 15th, 2010 @ 05:49 PM

  12. keymone
    keymone

    yes, db:rollback is what i failed to find in the first place.

    May 15th, 2010 @ 05:51 PM

  13. Jeff Kreeftmeijer
    Jeff Kreeftmeijer

    Cool, this one can be closed then. :)

    May 15th, 2010 @ 05:56 PM

  14. José Valim
    José Valim
    • Tag changed from 2.3.x, active_record, bugmash, migrator, patch to 2.3.x, active_record, migrator, patch
    • State changed from new to invalid

    May 15th, 2010 @ 05:57 PM