Skip to content
Browse files

Remove pre-emptive adapter name check from databases.rake so third pa…

…rty adapters can register rake tasks
  • Loading branch information...
1 parent efd2be3 commit a374366720a42fa5720992b2f80ba72180319bc5 @dazuma dazuma committed Jan 29, 2013
Showing with 3 additions and 9 deletions.
  1. +3 −9 activerecord/lib/active_record/railties/databases.rake
View
12 activerecord/lib/active_record/railties/databases.rake
@@ -284,8 +284,6 @@ db_namespace = namespace :db do
filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql")
current_config = ActiveRecord::Tasks::DatabaseTasks.current_config
case current_config['adapter']
- when /mysql/, /postgresql/, /sqlite/
- ActiveRecord::Tasks::DatabaseTasks.structure_dump(current_config, filename)
when 'oci', 'oracle'
ActiveRecord::Base.establish_connection(current_config)
File.open(filename, "w:utf-8") { |f| f << ActiveRecord::Base.connection.structure_dump }
@@ -296,7 +294,7 @@ db_namespace = namespace :db do
db_string = firebird_db_string(current_config)
sh "isql -a #{db_string} > #{filename}"
else
- raise "Task not supported by '#{current_config["adapter"]}'"
+ ActiveRecord::Tasks::DatabaseTasks.structure_dump(current_config, filename)
end
if ActiveRecord::Base.connection.supports_migrations?
@@ -312,8 +310,6 @@ db_namespace = namespace :db do
current_config = ActiveRecord::Tasks::DatabaseTasks.current_config
filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql")
case current_config['adapter']
- when /mysql/, /postgresql/, /sqlite/
- ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename)
when 'sqlserver'
`sqlcmd -S #{current_config['host']} -d #{current_config['database']} -U #{current_config['username']} -P #{current_config['password']} -i #{filename}`
when 'oci', 'oracle'
@@ -326,7 +322,7 @@ db_namespace = namespace :db do
db_string = firebird_db_string(current_config)
sh "isql -i #{filename} #{db_string}"
else
- raise "Task not supported by '#{current_config['adapter']}'"
+ ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename)
end
end
@@ -384,8 +380,6 @@ db_namespace = namespace :db do
task :purge => [:environment, :load_config] do
abcs = ActiveRecord::Base.configurations
case abcs['test']['adapter']
- when /mysql/, /postgresql/, /sqlite/
- ActiveRecord::Tasks::DatabaseTasks.purge abcs['test']
when 'sqlserver'
test = abcs.deep_dup['test']
test_database = test['database']
@@ -401,7 +395,7 @@ db_namespace = namespace :db do
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.recreate_database!
else
- raise "Task not supported by '#{abcs['test']['adapter']}'"
+ ActiveRecord::Tasks::DatabaseTasks.purge abcs['test']
end
end

0 comments on commit a374366

Please sign in to comment.
Something went wrong with that request. Please try again.