aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAlexander <dembskoi@gmail.com>2013-03-19 19:34:56 +0400
committerAlexander <dembskoi@gmail.com>2013-03-19 19:34:56 +0400
commitca6a12d6e5a8e1034e8d472fb6652111e1314a70 (patch)
treecca8dd93c37c19c40076246865e6dc41fd5d04d5 /activerecord
parent2cf38aebacaf78260848a54bfbb5bf5a9b627598 (diff)
downloadrails-ca6a12d6e5a8e1034e8d472fb6652111e1314a70.tar.gz
rails-ca6a12d6e5a8e1034e8d472fb6652111e1314a70.tar.bz2
rails-ca6a12d6e5a8e1034e8d472fb6652111e1314a70.zip
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
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md7
-rw-r--r--activerecord/lib/active_record/railties/databases.rake1
2 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 608bfa81a2..e55367662b 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -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.
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index 7f1b84b848..b8aed49854 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -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}`