lib/apartment/migrator.rb in ros-apartment-2.3.0 vs lib/apartment/migrator.rb in ros-apartment-2.4.0
- old
+ new
@@ -1,17 +1,18 @@
+# frozen_string_literal: true
+
require 'apartment/tenant'
module Apartment
module Migrator
-
extend self
# Migrate to latest
def migrate(database)
Tenant.switch(database) do
- version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
+ version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
- migration_scope_block = -> (migration) { ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope) }
+ migration_scope_block = ->(migration) { ENV['SCOPE'].blank? || (ENV['SCOPE'] == migration.scope) }
if activerecord_below_5_2?
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, version, &migration_scope_block)
else
ActiveRecord::Base.connection.migration_context.migrate(version, &migration_scope_block)