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...
1 parent 2cf38ae commit ca6a12d6e5a8e1034e8d472fb6652111e1314a70 @dembskoi dembskoi committed Mar 19, 2013
Showing with 8 additions and 0 deletions.
  1. +7 −0 activerecord/CHANGELOG.md
  2. +1 −0 activerecord/lib/active_record/railties/databases.rake
@@ -1,5 +1,12 @@
## unreleased ##
+* 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 #9796.
+
+ *Juan M. Cuello + Dembskiy Alexander*
+
* Reload the association target if it's stale. `@stale_state` should be nil
when a model isn't saved.
Fixes #7526.
@@ -427,6 +427,7 @@ db_namespace = namespace :db do
end
`pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['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 = config['database']
`sqlite3 #{dbfile} .schema > #{filename}`

0 comments on commit ca6a12d

Please sign in to comment.