diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-09 00:36:49 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-09 00:36:49 +0000 |
commit | e34de4dc24fbfad3a80a063b0127242c83e485a3 (patch) | |
tree | 0c10579d5ce1b1246eb487b2491fa9f676cc119f /railties | |
parent | 2a12b56841bd6fd3998050e7677a1b2c08257479 (diff) | |
download | rails-e34de4dc24fbfad3a80a063b0127242c83e485a3.tar.gz rails-e34de4dc24fbfad3a80a063b0127242c83e485a3.tar.bz2 rails-e34de4dc24fbfad3a80a063b0127242c83e485a3.zip |
Firebird database tasks.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4597 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/tasks/databases.rake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 551fc8c590..cd91a94416 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -54,6 +54,10 @@ namespace :db do when "sqlserver" `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r` `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r` + when "firebird" + set_firebird_env(abcs[RAILS_ENV]) + db_string = firebird_db_string(abcs[RAILS_ENV]) + sh "isql -a #{db_string} > db/#{RAILS_ENV}_structure.sql" else raise "Task not supported by '#{abcs["test"]["adapter"]}'" end @@ -98,6 +102,10 @@ namespace :db do IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl| ActiveRecord::Base.connection.execute(ddl) end + when "firebird" + set_firebird_env(abcs["test"]) + db_string = firebird_db_string(abcs["test"]) + sh "isql -i db/#{RAILS_ENV}_structure.sql #{db_string}" else raise "Task not supported by '#{abcs["test"]["adapter"]}'" end @@ -129,6 +137,9 @@ namespace :db do ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl| ActiveRecord::Base.connection.execute(ddl) end + when "firebird" + ActiveRecord::Base.establish_connection(:test) + ActiveRecord::Base.connection.recreate_database! else raise "Task not supported by '#{abcs["test"]["adapter"]}'" end @@ -163,3 +174,12 @@ end def session_table_name ActiveRecord::Base.pluralize_table_names ? :sessions : :session end + +def set_firebird_env(config) + ENV["ISC_USER"] = config["username"].to_s if config["username"] + ENV["ISC_PASSWORD"] = config["password"].to_s if config["password"] +end + +def firebird_db_string(config) + FireRuby::Database.db_string_for(config.symbolize_keys) +end |