influitive / apartment

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

Not able find a solution for multi db connection #674

Closed vinaysharma4362 closed 1 year ago

vinaysharma4362 commented 1 year ago

I need to setup multi db environment but in our existing database has multiple schemas and i'm not able to perform Apartment::Tenant.switch('subdomain') command

Error

troya2 commented 1 year ago

The error message means that the postgresql database you are connected to does not have a schema named "iso". To confirm this, use psql to open a connection to your database from the command line and issue the "\dn" command tpo see a list of schemas.

Using apartment, to create a new tenant. For example, in a rails console, execute Apartment::Tenant.create "iso".

vinaysharma4362 commented 1 year ago

The error message means that the postgresql database you are connected to does not have a schema named "iso". To confirm this, use psql to open a connection to your database from the command line and issue the "\dn" command tpo see a list of schemas.

Using apartment, to create a new tenant. For example, in a rails console, execute Apartment::Tenant.create "iso".

@troya2 thanks for the response, For my project this scenario will not work, because I've to access this tenant-based project into another project. and if I've recreate each and every schema files into another project this cause too much hurdle for the database.
Currently I'm using API based approach to safely perform CRUD operations.

Thanks