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.
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
“db:setup”.
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
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' ]
Contrast with:
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?
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.