This project is archived and is in readonly mode.
Add other db:*:all rake tasks
-
Dan Pickett
- Tag changed from active_record, database, databases.rake, enhancement, patch, rake to active_record, bugmash, database, databases.rake, enhancement, patch, rake
-
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.
-
Anil Wadghule
Attached is an app where you can test rake tasks.
-
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?
-
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.
-
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.
-
Anil Wadghule
I've attached a patch. Attaching same patch. Looks like bugmash.com didn't notice it.
-
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.
-
José Valim
- Tag changed from active_record, bugmash, database, databases.rake, enhancement, patch, rake to active_record, database, databases.rake, enhancement, patch, rake
-
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
-
Jeremy Kemper
Could someone explain why they need any of these tasks?
What do you mean by migrating all environments at once?
-
Jeremy Kemper
- State changed from verified to wontfix
-
Rizwan Reza
- Tag changed from active_record, bugmash-review, database, databases.rake, enhancement, patch, rake to active_record, database, databases.rake, enhancement, patch, rake
-
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.
