Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Only create test databases when Rails.env.test?
Browse files Browse the repository at this point in the history
Previously, running rake db:create with either no
RAILS_ENV or RAILS_ENV=development also created
the test database(s).

A typical DM app will probably have some sort of
auto_migrate! or auto_upgrade! call in spec_helper
anyway, so this seems redundant
  • Loading branch information
snusnu committed Sep 13, 2010
1 parent 7620b28 commit 0a196c4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/dm-rails/railties/database.rake
Expand Up @@ -17,12 +17,9 @@ namespace :db do
end
end

desc "Create the database(s) defined in config/database.yml for the current Rails.env - also creates the test database(s) if Rails.env.development?"
desc "Create all local databases defined for the current Rails.env"
task :create => :environment do
Rails::DataMapper.storage.create_environment(Rails::DataMapper.configuration.repositories[Rails.env])
if Rails.env.development? && Rails::DataMapper.configuration.repositories['test']
Rails::DataMapper.storage.create_environment(Rails::DataMapper.configuration.repositories['test'])
end
end

namespace :drop do
Expand All @@ -32,7 +29,7 @@ namespace :db do
end
end

desc "Drops the database(s) for the current Rails.env - also drops the test database(s) if Rails.env.development?"
desc "Drop all local databases defined for the current Rails.env"
task :drop => :environment do
Rails::DataMapper.storage.drop_environment(Rails::DataMapper.configuration.repositories[Rails.env])
end
Expand Down

0 comments on commit 0a196c4

Please sign in to comment.