lib/penthouse/migrator.rb in penthouse-0.7.5 vs lib/penthouse/migrator.rb in penthouse-0.8.0
- old
+ new
@@ -40,79 +40,59 @@
end
end
module ClassMethods
def migrate_with_penthouse(migrations_paths, target_version = nil, &block)
- puts "#migrate_with_penthouse called"
-
unless Penthouse.configuration.migrate_tenants?
- puts "Skipping penthouse integration"
return migrate_without_penthouse(migrations_paths, target_version, &block)
end
Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
- puts "Migrating #{tenant.identifier}"
- puts "calling #migrate_without_penthouse"
migrate_without_penthouse(migrations_paths, target_version, &block)
end
end
def up_with_penthouse(migrations_paths, target_version = nil, &block)
- puts "#up_with_penthouse called"
-
unless Penthouse.configuration.migrate_tenants?
- puts "Skipping penthouse integration"
return up_without_penthouse(migrations_paths, target_version, &block)
end
Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
- puts "Migrating #{tenant.identifier}"
- puts "calling #up_without_penthouse"
up_without_penthouse(migrations_paths, target_version, &block)
end
end
def down_with_penthouse(migrations_paths, target_version = nil, &block)
- puts "#down_with_penthouse called"
-
unless Penthouse.configuration.migrate_tenants?
- puts "Skipping penthouse integration"
return down_without_penthouse(migrations_paths, target_version, &block)
end
Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
- puts "Migrating #{tenant.identifier}"
- puts "calling #down_without_penthouse"
down_without_penthouse(migrations_paths, target_version, &block)
end
end
def run_with_penthouse(direction, migrations_paths, target_version)
- puts "#run_with_penthouse called"
-
unless Penthouse.configuration.migrate_tenants?
- puts "Skipping penthouse integration"
return run_without_penthouse(direction, migrations_paths, target_version)
end
Penthouse.each_tenant(tenant_identifiers: tenants_to_migrate) do |tenant|
- puts "Migrating #{tenant.identifier}"
- puts "calling #run_without_penthouse"
run_without_penthouse(direction, migrations_paths, target_version)
end
end
+ private
+
def tenants_to_migrate
return @tenants_to_migrate if defined?(@tenants_to_migrate)
@tenants_to_migrate = begin
- if (t = ENV["TENANT"] || ENV["TENANTS"])
+ if !!(t = (ENV["TENANT"] || ENV["TENANTS"]))
t.split(",").map(&:strip)
else
Penthouse.tenant_identifiers
end
end
- puts "#tenants_to_migrate = #{@tenants_to_migrate}"
- @tenants_to_migrate
end
end
end
end