Apartment gem is used for handling multi tenancy on database level. This means, having multiple databases which should have the same schema.
Octopus can be used to take care of master / slave mysql structure and route the queires to the right node (shard)
When using departure in an environment together with apartment and octopus, we are getting the following error:
ActiveRecord::RecordNotUnique: Mysql2::Error: Duplicate entry '20180109094356' for key 'unique_schema_migrations': INSERT INTO `schema_migrations` (`version`) VALUES ('20180109094356'): INSERT INTO `schema_migrations` (`version`) VALUES ('20180109094356')
Doing some investigation, it looks like we are always trying to connect to the same database (the main database which is set in the config file) and not to the one, which was selected by apartment