This project is archived and is in readonly mode.

#2762 ✓wontfix
Kerry Buckley

Add other db:*:all rake tasks

Reported by Kerry Buckley | June 4th, 2009 @ 10:54 PM | in 3.x

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

Comments and changes to this ticket

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Dan Pickett

    Dan Pickett May 9th, 2010 @ 07:29 PM

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

    Rizwan Reza May 16th, 2010 @ 03:50 AM

    • State changed from “new” to “open”

    We need someone to test this.

  • Anil Wadghule

    Anil Wadghule May 16th, 2010 @ 10:05 AM

    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.

  • Anil Wadghule

    Anil Wadghule May 16th, 2010 @ 10:07 AM

    Attached is an app where you can test rake tasks.

  • José Valim

    José Valim May 16th, 2010 @ 10:15 AM

    • 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?

  • Kerry Buckley

    Kerry Buckley May 16th, 2010 @ 10:18 AM

    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.

  • Anil Wadghule

    Anil Wadghule May 16th, 2010 @ 11:52 AM

    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.

  • Anil Wadghule

    Anil Wadghule May 16th, 2010 @ 12:17 PM

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

  • Wijnand Wiersma

    Wijnand Wiersma May 16th, 2010 @ 02:49 PM

    +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.

  • José Valim

    José Valim May 16th, 2010 @ 05:03 PM

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

    Rizwan Reza May 16th, 2010 @ 05:13 PM

    • 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”
  • Jeremy Kemper

    Jeremy Kemper May 16th, 2010 @ 09:54 PM

    Could someone explain why they need any of these tasks?

    What do you mean by migrating all environments at once?

  • Jeremy Kemper

    Jeremy Kemper May 16th, 2010 @ 09:55 PM

    • State changed from “verified” to “wontfix”
  • Rizwan Reza

    Rizwan Reza May 16th, 2010 @ 09:57 PM

    • Tag changed from active_record, bugmash-review, database, databases.rake, enhancement, patch, rake to active_record, database, databases.rake, enhancement, patch, rake
  • Kerry Buckley

    Kerry Buckley May 17th, 2010 @ 10:52 AM

    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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages