You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an issue when having multiple databases with tables with the same name.
The case I experienced is the following: I have 2 databases, the main postgres database that uses the citus extension, and a smaller sqlite db. There are some tables in both databases that have the same name.
I set up Active Record 6 to work with both databases and I use the multi-tenant extension in the main db. When I try to delete a record in the sqlite db the multi-tenant gem picks the model from the main db (that has a table with the same name) and inserts the tenant clause causing the query to fail.
There is an issue when having multiple databases with tables with the same name.
The case I experienced is the following: I have 2 databases, the main postgres database that uses the citus extension, and a smaller sqlite db. There are some tables in both databases that have the same name.
I set up Active Record 6 to work with both databases and I use the multi-tenant extension in the main db. When I try to delete a record in the sqlite db the multi-tenant gem picks the model from the main db (that has a table with the same name) and inserts the tenant clause causing the query to fail.
I believe this comes from the fact that the multi tenant models are stored in a hash indexed by table name https://github.com/citusdata/activerecord-multi-tenant/blob/master/lib/activerecord-multi-tenant/multi_tenant.rb#L27-L30
The text was updated successfully, but these errors were encountered: