influitive / apartment

Database multi-tenancy for Rack (and Rails) applications
2.66k stars 464 forks source link

Reverting schema based multi tenancy to single schema foreign key based multi tenancy #648

Open bipashant opened 4 years ago

bipashant commented 4 years ago

This is not an actual issue with theapartment.

Because of the drastic changes in our business requirements, we decided to revert the Postgres multi-tenancy implemented using the apartment gem.

We are now adding a foreign key in all the tables for the data isolation which is working great. Our concern is how can we migrate the data from all the other schemas to the public maintaining foreign keys and references? We have nearly 100+ tables and some of the tables are highly associated with other tables. Does anybody have experience with this? Thanks

tmvst commented 2 years ago

Hey @bipashant have you figured it out? I'm starting the same process for a project and would love some tips. Did you keep Apartment for switching tenants in the single schema, or did you switch to something else entirely?