Multi-tenant domain setup, PostgreSQL

27 days ago

Zapotocny
Member | 16
+
0
-

Hello,

is there any simple way of setting PostreSQL database schema on startup of whole application?

I would use difference database schemas for each tenant.

abc.domain.com → would look inside public schema inside table tenants,

it would find “schema_name” column where domain_url = abc.domain.com,
then it would set database cursor to that schema.

I want to have almost same functionality as this Django package https://github.com/…nant-schemas

Thank you so much, all tips are valuable.

27 days ago

CZechBoY
Member | 3015
+
0
-

What database library do you use?
but in general it would be same – listen on event Connect and then choose correct schema

27 days ago

Zapotocny
Member | 16
+
0
-

CZechBoY wrote:

What database library do you use?
but in general it would be same – listen on event Connect and then choose correct schema

I would like to use Doctrine, so https://github.com/Kdyby/Doctrine

27 days ago

Ondřej Kubíček
Member | 183
+
0
-

@Zapotocny off speech, you wanna use nettrine/doctrine because kdyby is no longer being developed :)

27 days ago

Zapotocny
Member | 16
+
0
-

Ondřej Kubíček wrote:

@Zapotocny off speech, you wanna use nettrine/doctrine because kdyby is no longer being developed :)

Ok, i will look at it. @OndřejKubíček do you have any idea how to implement that tenant behaviour?