Module: Penthouse::Migrator::ClassMethods

Defined in:
lib/penthouse/migrator.rb

Instance Method Summary collapse

Instance Method Details

#down_with_penthouse(migrations_paths, target_version = nil, &block) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/penthouse/migrator.rb', line 64

def down_with_penthouse(migrations_paths, target_version = nil, &block)
  unless Penthouse.configuration.migrate_tenants?
    return down_without_penthouse(migrations_paths, target_version, &block)
  end

  Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
    down_without_penthouse(migrations_paths, target_version, &block)
  end
end

#migrate_with_penthouse(migrations_paths, target_version = nil, &block) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/penthouse/migrator.rb', line 44

def migrate_with_penthouse(migrations_paths, target_version = nil, &block)
  unless Penthouse.configuration.migrate_tenants?
    return migrate_without_penthouse(migrations_paths, target_version, &block)
  end

  Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
    migrate_without_penthouse(migrations_paths, target_version, &block)
  end
end

#run_with_penthouse(direction, migrations_paths, target_version) ⇒ Object



74
75
76
77
78
79
80
81
82
# File 'lib/penthouse/migrator.rb', line 74

def run_with_penthouse(direction, migrations_paths, target_version)
  unless Penthouse.configuration.migrate_tenants?
    return run_without_penthouse(direction, migrations_paths, target_version)
  end

  Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
    run_without_penthouse(direction, migrations_paths, target_version)
  end
end

#up_with_penthouse(migrations_paths, target_version = nil, &block) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/penthouse/migrator.rb', line 54

def up_with_penthouse(migrations_paths, target_version = nil, &block)
  unless Penthouse.configuration.migrate_tenants?
    return up_without_penthouse(migrations_paths, target_version, &block)
  end

  Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
    up_without_penthouse(migrations_paths, target_version, &block)
  end
end