diff options
author | kennyj <kennyj@gmail.com> | 2013-03-28 03:17:52 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-04-03 00:54:32 +0900 |
commit | 742d0901893fc96ff2951a580110aadd1953aecf (patch) | |
tree | fe7ccf70684050a1879d665bcf45e8bba1030659 /activerecord/lib/active_record/railties | |
parent | 0f313fce1c35113170d5f110d8c17694535871c1 (diff) | |
download | rails-742d0901893fc96ff2951a580110aadd1953aecf.tar.gz rails-742d0901893fc96ff2951a580110aadd1953aecf.tar.bz2 rails-742d0901893fc96ff2951a580110aadd1953aecf.zip |
Extract Oracle database tasks.
Diffstat (limited to 'activerecord/lib/active_record/railties')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index cabc6be7bb..513b1bb488 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -274,13 +274,7 @@ db_namespace = namespace :db do task :dump => [:environment, :load_config] do filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql") current_config = ActiveRecord::Tasks::DatabaseTasks.current_config - case current_config['adapter'] - when 'oci', 'oracle' - ActiveRecord::Base.establish_connection(current_config) - File.open(filename, "w:utf-8") { |f| f << ActiveRecord::Base.connection.structure_dump } - else - ActiveRecord::Tasks::DatabaseTasks.structure_dump(current_config, filename) - end + ActiveRecord::Tasks::DatabaseTasks.structure_dump(current_config, filename) if ActiveRecord::Base.connection.supports_migrations? File.open(filename, "a") do |f| @@ -294,15 +288,7 @@ db_namespace = namespace :db do task :load => [:environment, :load_config] do current_config = ActiveRecord::Tasks::DatabaseTasks.current_config filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql") - case current_config['adapter'] - when 'oci', 'oracle' - ActiveRecord::Base.establish_connection(current_config) - IO.read(filename).split(";\n\n").each do |ddl| - ActiveRecord::Base.connection.execute(ddl) - end - else - ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename) - end + ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename) end task :load_if_sql => ['db:create', :environment] do @@ -357,16 +343,7 @@ db_namespace = namespace :db do # desc "Empty the test database" task :purge => [:environment, :load_config] do - abcs = ActiveRecord::Base.configurations - case abcs['test']['adapter'] - when "oci", "oracle" - ActiveRecord::Base.establish_connection(:test) - ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl| - ActiveRecord::Base.connection.execute(ddl) - end - else - ActiveRecord::Tasks::DatabaseTasks.purge abcs['test'] - end + ActiveRecord::Tasks::DatabaseTasks.purge ActiveRecord::Base.configurations['test'] end # desc 'Check for pending migrations and load the test schema' |