Permalink
Browse files

Reset postgreSQL search path in db:test:clone_structure.

This patch resets the postgres search path in the structure.sql after
the structure is dumped in order to find schema_migrations table when
multiples schemas are used.

Fixes #945
  • Loading branch information...
Juanmcuello committed Dec 21, 2011
1 parent fa5adfb commit 5662ea511225b34d3b533d03614c496c007215b0
Showing with 1 addition and 0 deletions.
  1. +1 −0 activerecord/lib/active_record/railties/databases.rake
@@ -387,6 +387,7 @@ db_namespace = namespace :db do
end
`pg_dump -i -s -x -O -f #{filename} #{search_path} #{abcs[Rails.env]['database']}`
raise 'Error dumping database' if $?.exitstatus == 1
+ File.open(filename, "a") { |f| f << "SET search_path TO #{ActiveRecord::Base.connection.schema_search_path};\n\n" }
when /sqlite/
dbfile = abcs[Rails.env]['database']
`sqlite3 #{dbfile} .schema > #{filename}`

0 comments on commit 5662ea5

Please sign in to comment.