Skip to content

Commit

Permalink
make schema_migrations run separately for each schema
Browse files Browse the repository at this point in the history
  • Loading branch information
dceballos committed Jun 5, 2013
1 parent ed58552 commit 46cb1b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/roomer/helpers/postgres_helper.rb
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/roomer/schema.rb
Expand Up @@ -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

Expand Down

0 comments on commit 46cb1b0

Please sign in to comment.