diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-11 09:50:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-11 09:50:42 +0000 |
commit | 8e9484d3c1e822b797322505d659c6c4e6d13878 (patch) | |
tree | b381cd14859a69b8e035ecd5dd3285b19fe08c33 | |
parent | b81c46e6bd6997bf6637b5086bbb9cbb32664974 (diff) | |
download | rails-8e9484d3c1e822b797322505d659c6c4e6d13878.tar.gz rails-8e9484d3c1e822b797322505d659c6c4e6d13878.tar.bz2 rails-8e9484d3c1e822b797322505d659c6c4e6d13878.zip |
Make sure that legacy db tasks also reference :database for SQLite (closes #2830) [kazuhiko@fdiary.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2978 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/lib/tasks/databases.rake | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index c9a081502e..64f3a0c2ee 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -48,7 +48,8 @@ task :db_structure_dump => :environment do search_path = "--schema=#{search_path}" if search_path `pg_dump -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{search_path} #{abcs[RAILS_ENV]["database"]}` when "sqlite", "sqlite3" - `#{abcs[RAILS_ENV]["adapter"]} #{abcs[RAILS_ENV]["dbfile"]} .schema > db/#{RAILS_ENV}_structure.sql` + dbfile = abcs[RAILS_ENV]["database"] || abcs[RAILS_ENV]["dbfile"] + `#{abcs[RAILS_ENV]["adapter"]} #{dbfile} .schema > db/#{RAILS_ENV}_structure.sql` 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` @@ -77,7 +78,8 @@ task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"] `psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}` when "sqlite", "sqlite3" - `#{abcs["test"]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql` + dbfile = abcs[RAILS_ENV]["database"] || abcs[RAILS_ENV]["dbfile"] + `#{abcs["test"]["adapter"]} #{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" @@ -105,7 +107,8 @@ task :purge_test_database => :environment do `dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` `createdb #{enc_option} -T template0 -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` when "sqlite","sqlite3" - File.delete(abcs["test"]["dbfile"]) if File.exist?(abcs["test"]["dbfile"]) + dbfile = abcs[RAILS_ENV]["database"] || abcs[RAILS_ENV]["dbfile"] + File.delete(dbfile) if File.exist?(dbfile) when "sqlserver" dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-') `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}` |