Permalink
Browse files

More specific for jdbc-sqlite

  • Loading branch information...
1 parent 3e7af42 commit 14bfe83144786fbfb3aa1af9822ae4590228c001 @arunagw arunagw committed Jun 21, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/railties/databases.rake
@@ -364,7 +364,7 @@ namespace :db do
end
`pg_dump -i -U "#{abcs[Rails.env]["username"]}" -s -x -O -f db/#{Rails.env}_structure.sql #{search_path} #{abcs[Rails.env]["database"]}`
raise "Error dumping database" if $?.exitstatus == 1
- when /sqlite/
+ when /^(jdbc)?sqlite/
dbfile = abcs[Rails.env]["database"] || abcs[Rails.env]["dbfile"]
`sqlite3 #{dbfile} .schema > db/#{Rails.env}_structure.sql`
when "sqlserver"
@@ -410,7 +410,7 @@ namespace :db do
ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
`psql -U "#{abcs["test"]["username"]}" -f #{Rails.root}/db/#{Rails.env}_structure.sql #{abcs["test"]["database"]}`
- when /sqlite/
+ when /^(jdbc)?sqlite/
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
`sqlite3 #{dbfile} < #{Rails.root}/db/#{Rails.env}_structure.sql`
when "sqlserver"
@@ -440,7 +440,7 @@ namespace :db do
ActiveRecord::Base.clear_active_connections!
drop_database(abcs['test'])
create_database(abcs['test'])
- when /sqlite/
+ when /^(jdbc)?sqlite/
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
File.delete(dbfile) if File.exist?(dbfile)
when "sqlserver"
@@ -492,7 +492,7 @@ def drop_database(config)
when /mysql/
ActiveRecord::Base.establish_connection(config)
ActiveRecord::Base.connection.drop_database config['database']
- when /sqlite/
+ when /^(jdbc)?sqlite/
require 'pathname'
path = Pathname.new(config['database'])
file = path.absolute? ? path.to_s : File.join(Rails.root, path)

0 comments on commit 14bfe83

Please sign in to comment.