Is there any reason why db:setup and
db:reset don’t show any more on “rake -T db”?
I guess any rake task that is defined only as a group of other
tasks (without any ruby blocks attached) presents this problem.
Also let me write this as a remember note to myself for when I
have some time: the Rails Guides on Migrations should be updated
to include instructions about db:load and to add the information
that it, alongside with “db:reset”, also loads the seed data after
(re)creating the database from schema.rb.
I cannot reproduce your problem on latest 3.0.5. Here’s my gist showing the test: https://gist.github.com/854691
Pretty interesting! I misread the output. In fact, my output is like
yours. I didn’t see “db:setup” (which I wrongly called “db:load”)
before. But, as you can see, “db:reset” only shows up mentioned in
It is not possible to "rake -D db:reset", for instance.
That is what first called my attention and then I was fast on my
I don’t see
db:reset in the list.
Apparently not all tasks are meant to show in output, although I can't
understand why db:reset should out of the list. I guess this decision
is by design:
railties/database.rake (in activerecord gem):
# desc 'Drops and recreates the database from db/schema.rb for the
current environment and loads the seeds.'
task :reset => [ 'db:drop', 'db:setup' ]
desc 'Create the database, load the schema, and initialize with the
seed data (use db:reset to also drop the db first)'
task :setup => [ 'db:create', 'db:schema:load', 'db:seed' ]
Note that several tasks have their descriptions commented out for some
reason. Is there any reasons to hide db:reset?
Thanks in advance,
Answering my own question, after git blame and git log 98381563:
"Cut down even further on rake -T noise"
It seems David thinks the db:reset task is a noise...
db:migrate:* are also missing, ie. down, redo, and up
There should be a rake -all option or something perhaps. If these
"hidden" tasks aren't documented anywhere that a newbie can easily
find them, then removing them doesn't seem like a good idea.