I have set up the schema file but unable to define seed file for tenant such that it can run only for tenant migration only. Also I ma trying to create schema once a user has been created and its tenant is created.
require 'apartment/elevators/subdomain'
#
# Apartment Configuration
#
Apartment.configure do |config|
config.excluded_models = ["Admin","Contractor", "ContractorPackage","ContractorTransaction","Country","Currency","Faq","FaqCategory","Language","Package","Page","PaymentType","Setting","TempTransaction","Testimonial","Timezone","Tutorial"]
# use postgres schemas?
config.use_schemas = true
config.tenant_names = lambda{ Contractor.pluck("CONCAT('contractor_',id)") }
end
# overriding module schema file here
module Apartment
class << self
def database_schema_file
@database_schema_file=Rails.root.join('db', 'contractor_schema.rb')
end
end
end
Rails.application.config.middleware.use 'Apartment::Elevators::Subdomain'