Output what commands a rake task is executing

I just want to better understand how some of the built in rake tasks are operating, in particular rake db:create.

Is there a way I can view the sql commands being executed to create the database? I tried rake db:create --verbose --trace, but all I got was

** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute (dry run) db:load_config
** Invoke rails_env (first_time)
** Execute (dry run) rails_env
** Execute (dry run) db:create

I'm running rails 3.2.13 and rake 10.0.4


You can write a custom rake task which will do require task given below

desc "Rake db:create with SQL logging"
task :db_create => :environment do
  Rails.logger.level = Logger::DEBUG
  `rake db:create`

It will gives your required output.

Need Your Help

Pass variable data from PHP to shell_exec command

php command-line mysqli variable-assignment shell-exec

I have a script that clones tables on to uniquely named MySQL databases from a master sql dump file . Each account has their own database, but the table structure is the same for all accounts. My

SQL table results for previous day not accurate

sql-server-2008 datetime-format

I had the following query running in a package setup that gets the records for the previous day in a table that includes the following columns: