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 other db:*:all rake tasks

#2762

This patch adds the following rake tasks, which act similarly to the existing db:create:all and db:drop:all:

  • db:migrate:all
  • db:migrate:down:all
  • db:migrate:redo:all
  • db:migrate:reset:all
  • db:migrate:up:all
  • db:reset:all
  • db:rollback:all
  • db:schema:load:all
  • db:seed:all
  • db:setup:all

Reported by Kerry Buckley · June 4th, 2009 @ 10:54 PM

State: wontfix
Milestone: 3.x
Assigned to: José Valim José Valim
Importance: none

Activity

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

    May 4th, 2010 @ 06:48 PM

  2. Dan Pickett
    Dan Pickett
    • Tag changed from active_record, database, databases.rake, enhancement, patch, rake to active_record, bugmash, database, databases.rake, enhancement, patch, rake

    May 9th, 2010 @ 07:29 PM

  3. Rizwan Reza
    Rizwan Reza
    • State changed from new to open

    We need someone to test this.

    May 16th, 2010 @ 03:50 AM

  4. Anil Wadghule
    Anil Wadghule

    Rewritten the patch for Rails master branch

    task db:seed:all is currently not working. Need help in fix it.

    Basically for rake db:seed:all, it say's 'uninitialized constant User' as we don't load rails environment in case of all tasks. And seeding requires User class to be defined.

    May 16th, 2010 @ 10:05 AM

  5. Anil Wadghule
    Anil Wadghule

    Attached is an app where you can test rake tasks.

    May 16th, 2010 @ 10:07 AM

  6. José Valim
    José Valim
    • Assigned user set to José Valim

    What is the point of having this extra tasks? When do I need to migrate in all environments? Do you have some use-cases?

    May 16th, 2010 @ 10:15 AM

  7. Kerry Buckley
    Kerry Buckley

    To be honest, I only really use db:migrate:all (because I have development, test and "production" environments running on my development machine), but when writing the original patch it seemed more consistent to add the other tasks too.

    May 16th, 2010 @ 10:18 AM

  8. Anil Wadghule
    Anil Wadghule

    Attached is a correct patch which runs all the rake tasks correctly including task db:seed:all

    I found these all tasks very helpful. As a developer, there are times when I want to migrate in all the environments on my dev machine. These tasks are not very helpful for production/test environment in practical sense.

    And also code wise, we have not added much complexity and without very bigger change, we are getting db all rake tasks.

    As Kerry said, this patch adds consistency with other tasks.

    May 16th, 2010 @ 11:52 AM

  9. Anil Wadghule
    Anil Wadghule

    I've attached a patch. Attaching same patch. Looks like bugmash.com didn't notice it.

    May 16th, 2010 @ 12:17 PM

  10. Wijnand Wiersma
    Wijnand Wiersma

    +1 I remember having to had a use case for a migrate all (did it manually all the time) and I like the consistency by having it for all tasks.

    May 16th, 2010 @ 02:49 PM

  11. José Valim
    José Valim
    • Tag changed from active_record, bugmash, database, databases.rake, enhancement, patch, rake to active_record, database, databases.rake, enhancement, patch, rake

    May 16th, 2010 @ 05:03 PM

  12. Rizwan Reza
    Rizwan Reza
    • Tag changed from active_record, database, databases.rake, enhancement, patch, rake to active_record, bugmash-review, database, databases.rake, enhancement, patch, rake
    • State changed from open to verified

    May 16th, 2010 @ 05:13 PM

  13. Jeremy Kemper
    Jeremy Kemper

    Could someone explain why they need any of these tasks?

    What do you mean by migrating all environments at once?

    May 16th, 2010 @ 09:54 PM

  14. Jeremy Kemper
    Jeremy Kemper
    • State changed from verified to wontfix

    May 16th, 2010 @ 09:55 PM

  15. Rizwan Reza
    Rizwan Reza
    • Tag changed from active_record, bugmash-review, database, databases.rake, enhancement, patch, rake to active_record, database, databases.rake, enhancement, patch, rake

    May 16th, 2010 @ 09:57 PM

  16. Kerry Buckley
    Kerry Buckley

    Here's my use case:

    I generally use the development environment/schema for fiddling around, test for running specs and features, and production (a local version -- I don't keep the actual production config in version control) for a local copy of the app that talks to real services instead of stubs. Sometimes I may have other environments, for example when I have several apps that interact, and have end-to-end integration tests.

    When I make a database change, I run a version of rake db:migrate:all (in a project rakefile) to bring all these local environments up to the same version. I would occasionally use db:rollback:all to undo the migration, but I never got round to adding the task.

    I can understand not wanting to accept this patch if most people don't work this way, but I don't understand why there are db:create:all and db:drop:all tasks, which are rarely needed after initial project setup, but no equivalent for migration, which is a common task.

    May 17th, 2010 @ 10:52 AM