Skip to content

Commit

Permalink
Excluding default schema from tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rpbaltazar committed Jun 1, 2020
1 parent 3cfaeb4 commit 443bebf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/tasks/apartment.rake
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ apartment_namespace = namespace :apartment do
end

def each_tenant(&block)
Parallel.each(tenants, in_threads: Apartment.parallel_migration_threads) do |tenant|
Parallel.each(tenants_without_default, in_threads: Apartment.parallel_migration_threads) do |tenant|
block.call(tenant)
end
end

def tenants_without_default
tenants - [Apartment.default_schema]
end

def tenants
ENV['DB'] ? ENV['DB'].split(',').map(&:strip) : Apartment.tenant_names || []
end
Expand Down

0 comments on commit 443bebf

Please sign in to comment.