lib/migration_tools/tasks.rb in migration_tools-1.4.0 vs lib/migration_tools/tasks.rb in migration_tools-1.5.0
- old
+ new
@@ -27,10 +27,15 @@
ActiveRecord::Migrator.migrations_paths
end
def migrator(target_version = nil)
if ActiveRecord::VERSION::MAJOR > 3
- ActiveRecord::Migrator.new(:up, ActiveRecord::Migrator.migrations(migrations_paths), target_version)
+ migrations = if defined?(::ActiveRecord::MigrationContext)
+ ActiveRecord::MigrationContext.new(migrations_paths).migrations
+ else
+ ActiveRecord::Migrator.migrations(migrations_paths)
+ end
+ ActiveRecord::Migrator.new(:up, migrations, target_version)
else
ActiveRecord::Migrator.new(:up, migrations_paths, target_version)
end
end