Closed kp666 closed 1 year ago
Can you please elaborate on this? What do you mean by syncing indexes?
When you do Nobrainer.sync_schema, it loads table names from models. But when you have multi tenancy setup, all table names wont be loaded. Correct me if I am wrong in this assumption.
It does when a seperate db is used, but not in the case of seperate models for each tenant. For example:
class Project
table_config :name => ->{ "project_#{Thread.current[:client]}" }
end
I would not be able to make indices for each client as when the models are loaded, it will only create indices for one table. So what I am doing right now is something like this:
class Project
def configure_table(name)
table_config(name: name)
return unless NoBrainer.run(rql_table.index_status).blank?
NoBrainer.sync_indexes # Ideally I only want to index this table
end
end
I think this behaviour is not supported by this gem, and it wouldn't since what you said is true:
when you have multi tenancy setup, all table names wont be loaded.
You need your own task to load each of your clients in order to get the Thread.current[:client]
being filled before to call the sync_indexes and it's what you're doing already.
I'm closing this but in the case there's something we can do in this gem to help, feel free to re-open it or open a new one.
is it possible to sync indices in a multi tenancy setup?
I could add it to documentation with the relevant guideline.