diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-24 14:05:09 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-24 14:05:09 +0000 |
commit | 852e5a435de6413785b21fdbf6ba6175a0bc09f3 (patch) | |
tree | 7123803736b46f5eee7954b6a50271a1f68f46d8 | |
parent | 14ea312808599001674784a839bf7cf5a8eea872 (diff) | |
download | rails-852e5a435de6413785b21fdbf6ba6175a0bc09f3.tar.gz rails-852e5a435de6413785b21fdbf6ba6175a0bc09f3.tar.bz2 rails-852e5a435de6413785b21fdbf6ba6175a0bc09f3.zip |
Made Oracle a first-class connection adapter by adhering closer to idiomatic Oracle style #1798 [The Gang of Oracles]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1913 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-x | railties/fresh_rakefile | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/railties/fresh_rakefile b/railties/fresh_rakefile index 8e88a4e85f..34b0d24c4d 100755 --- a/railties/fresh_rakefile +++ b/railties/fresh_rakefile @@ -137,6 +137,11 @@ task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do `#{abcs[RAILS_ENV]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql` when "sqlserver" `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` + when "oci", + ActiveRecord::Base.establish_connection(:test) + IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl| + ActiveRecord::Base.connection.execute(ddl) + end else raise "Unknown database adapter '#{abcs["test"]["adapter"]}'" end @@ -146,7 +151,7 @@ desc "Dump the database structure to a SQL file" task :db_structure_dump => :environment do abcs = ActiveRecord::Base.configurations case abcs[RAILS_ENV]["adapter"] - when "mysql" + when "mysql", "oci" ActiveRecord::Base.establish_connection(abcs[RAILS_ENV]) File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump } when "postgresql" @@ -183,7 +188,12 @@ task :purge_test_database => :environment do dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-') `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}` `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` - else + when "oci" + ActiveRecord::Base.establish_connection(:test) + ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl| + ActiveRecord::Base.connection.execute(ddl) + end + else raise "Unknown database adapter '#{abcs["test"]["adapter"]}'" end end |