Permalink
Browse files

Made rake db:create also create the test database if you are in devel…

…opment mode
  • Loading branch information...
1 parent 76d5428 commit fbdef7aafe753d2375b16c5dcf70a463996b929f @mikel mikel committed Feb 3, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/railties/databases.rake
@@ -26,8 +26,12 @@ namespace :db do
end
end
- desc 'Create the database defined in config/database.yml for the current Rails.env'
+ desc 'Create the database defined in config/database.yml for the current Rails.env - also makes test database if in development mode'
task :create => :load_config do
+ # Make the test database at the same time as the development one
+ if Rails.env == 'development'
+ create_database(ActiveRecord::Base.configurations['test'])
+ end
create_database(ActiveRecord::Base.configurations[Rails.env])
end

7 comments on commit fbdef7a

@carlosantoniodasilva

Cool, I was getting tired of creating both. Just a question, why didn't you use Rails.env.development?. I haven't seem people using this that much..

@mikel
Member
mikel replied Feb 3, 2010

good point :)

@mikel
Member
mikel replied Feb 3, 2010

I'll fix that on my next patch

@carlosantoniodasilva

@mikel nice! thanks :)

@seban
seban replied Feb 3, 2010

Finally!

@nateware

Unless I'm missing something, this breaks people like us do not use a db called test.

Shell aliases should be used for this type of stuff. I don't want an extra db created when I ask to creat development.

Please sign in to comment.