Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make schema_migrations run separately for each schema

  • Loading branch information...
commit 46cb1b047d5394ceac77bb4ef417c08ba1c55d1f 1 parent ed58552
dceballos dceballos authored
Showing with 6 additions and 2 deletions.
  1. +6 −1 lib/roomer/helpers/postgres_helper.rb
  2. +0 −1  lib/roomer/schema.rb
7 lib/roomer/helpers/postgres_helper.rb
View
@@ -108,7 +108,12 @@ def create_sequence(table_name, pk="id")
# Ensures schema_migrations table exists and creates otherwise
# @see ActiveRecord::Base.connection#initialize_schema_migrations_table
def ensure_schema_migrations
- ActiveRecord::Base.connection.initialize_schema_migrations_table
+ old_search_path = ActiveRecord::Base.connection.schema_search_path
+ old_search_path.split(",").each do |search_path|
+ ActiveRecord::Base.connection.schema_search_path = search_path
+ ActiveRecord::Base.connection.initialize_schema_migrations_table
+ end
+ ActiveRecord::Base.connection.schema_search_path = old_search_path
end
# Determine if there are any pending migrations in the shared migrations directory
1  lib/roomer/schema.rb
View
@@ -61,7 +61,6 @@ def self.define(info={}, &block)
end
def self.current_schema
- $stderr.puts "current search path is #{ActiveRecord::Base.connection.schema_search_path}"
ActiveRecord::Base.connection.schema_search_path.split(",")[0]
end
Please sign in to comment.
Something went wrong with that request. Please try again.