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.

rake db:migrate:status

#4947

New feature:
A rake task to display the current status of migrations by comparing db/migrate/* with schema_migrations.

>rake db:migrate:status

database: simple_cms_development

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20100123211421  Create users
   up     20100123232138  Create subjects
  down    20100123240347  Create pages
   up     20100123215534  *** NO FILE ***

As a bonus, it makes it easy to get a migration ID (double-click & copy) for running up/down/redo tasks.

Reported by Kevin Skoglund · June 23rd, 2010 @ 05:42 PM

State: resolved
Milestone: 3.x
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. Kevin Skoglund
    Kevin Skoglund
    • Title changed from rake db:migration:status to rake db:migrate:status

    June 23rd, 2010 @ 05:47 PM

  2. Kevin Skoglund
  3. Rohit Arondekar
    Rohit Arondekar
    • Milestone set to 3.x
    • State changed from new to verified
    • Assigned user set to José Valim

    +1 I would really love this rake task! :)

    But the patch has a trailing whitespace problem. Attaching a patch with this fixed. (Preserves complete authorship).

    I tried this on a couple of apps and it worked fine.

    June 24th, 2010 @ 02:24 PM

  4. Damien MATHIEU
  5. Kevin Skoglund
    Kevin Skoglund

    Thanks, Rohit. I overlooked that.

    June 24th, 2010 @ 02:30 PM

  6. José Valim
    José Valim

    Would be nice to send this to rails-core list and see people feedback on this. We already have too many tasks and I honestly can't remember a situation in which I needed a task like this although I understand a few people may have had.

    June 24th, 2010 @ 08:16 PM

  7. Kevin Skoglund
    Kevin Skoglund

    Thanks, José. I just sent it to the list.

    June 24th, 2010 @ 09:34 PM

  8. Jeffrey Hardy
    Jeffrey Hardy

    Not quite the same thing, but we do have rake db:version.

    $ rake db:version
    Current version: 20100419141336
    

    June 24th, 2010 @ 10:41 PM

  9. Repository
    Repository
    • State changed from verified to resolved
    • Importance changed from to Low

    (from [8e3e117dbe58fd4fedbb78a3d8e398ab0e415634]) rake db:migrate:status displays status of migrations [#4947 rake db:migrate:status state:resolved]

    Signed-off-by: Michael Koziarski michael@koziarski.com
    http://github.com/rails/rails/commit/8e3e117dbe58fd4fedbb78a3d8e398...

    June 28th, 2010 @ 03:09 AM

  10. Michael Koziarski
    Michael Koziarski
    • State changed from resolved to verified

    Personally I've wanted this for a while when you merge a long-lived branch it's nice to be able to get a list of everything which has been applied and has yet-to-be-applied. applied to 3,0

    June 28th, 2010 @ 03:10 AM

  11. Michael Koziarski
    Michael Koziarski
    • State changed from verified to resolved

    stupid lighthouse

    June 28th, 2010 @ 03:10 AM

  12. Akira Matsuda
    Akira Matsuda

    Very cool feature! I love it!

    As I found some problems while playing with it, posted patches on #4990 rake db:migrate:status fails when schema migrations table does not exist.

    June 28th, 2010 @ 04:33 AM

  13. MatthewRudy
    MatthewRudy

    This is a good idea,
    but perhaps it needs to be honed.

    I have 172 migrations in my project.

    Perhaps it needs some LIMIT=10 option.

    June 28th, 2010 @ 04:54 AM

  14. José Valim
    José Valim

    @Koz, if you like it, I like it! ;)

    @Akira, thanks!

    @Matthew, could you please provide a patch?

    June 28th, 2010 @ 09:06 AM

  15. Kevin Skoglund
    Kevin Skoglund

    Thanks, Michael and Akira!

    Matthew: would "rake db:migrate:status | more" do what you need?

    June 28th, 2010 @ 01:59 PM