Skip to content

Commit

Permalink
Reset postgreSQL search path in db:test:clone_structure.
Browse files Browse the repository at this point in the history
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 22, 2011
1 parent fa5adfb commit 5662ea5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions activerecord/lib/active_record/railties/databases.rake
Expand Up @@ -387,6 +387,7 @@ db_namespace = namespace :db do
end end
`pg_dump -i -s -x -O -f #{filename} #{search_path} #{abcs[Rails.env]['database']}` `pg_dump -i -s -x -O -f #{filename} #{search_path} #{abcs[Rails.env]['database']}`
raise 'Error dumping database' if $?.exitstatus == 1 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/ when /sqlite/
dbfile = abcs[Rails.env]['database'] dbfile = abcs[Rails.env]['database']
`sqlite3 #{dbfile} .schema > #{filename}` `sqlite3 #{dbfile} .schema > #{filename}`
Expand Down

0 comments on commit 5662ea5

Please sign in to comment.