lib/multiverse/patches.rb in multiverse-0.0.2 vs lib/multiverse/patches.rb in multiverse-0.0.3
- old
+ new
@@ -14,35 +14,35 @@
end
end
module Migrator
def initialize(*_)
- puts "Migrator#initialize"
# ActiveRecord::Migration#initialize calls
- # ActiveRecord::SchemaMigration.create_table
+ # ActiveRecord::SchemaMigration.create_table and
# ActiveRecord::InternalMetadata.create_table
# which both inherit from ActiveRecord::Base
#
# We need to change this for migrations
- # but not for db:schema:load (messes up multiverse test env otherwise)
+ # but not for db:schema:load, as this
+ # will mess up the Multiverse test environment
ActiveRecord::SchemaMigration.singleton_class.prepend(Multiverse::Connection)
ActiveRecord::InternalMetadata.singleton_class.prepend(Multiverse::Connection)
super
end
end
+ module Connection
+ def connection
+ Multiverse.record_class.connection
+ end
+ end
+
module Migration
# TODO don't checkout main connection at all
def exec_migration(_, direction)
Multiverse.record_class.connection_pool.with_connection do |conn|
super(conn, direction)
end
- end
- end
-
- module Connection
- def connection
- Multiverse.record_class.connection
end
end
module SchemaDumper
def dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base)