Cross-schema foreign keys #464
Unanswered
simon-sugarcrm
asked this question in
Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The company where I work have just started using DBMate. It's working really well for us, thanks very much.
We have a single PostgreSQL database, with multiple tenants and each tenant has three schemas.
My question is about how to write cross_schema foreign keys. I'm a production DBA with a release management hat, so I'm just a user of DBMate with little/to no understanding of how it works. Many apologies for the extreme newbie nature of this, but the developer who set this up is no longer available to ask.
Quick yes/no question:
Given
1 a database with schemas named
tenantA_schema1
tenantA_schema2
tenantB_schema1
tenantB_schema2 etc, and
2 given that we have DBMate applying schema1 patches just to all the tenantX_schema1 schemas etc
should we be able to re-work the git workflow to define a foreign key on tableP in tenantA_schema1 that references tableQ in tenantA_schema2?
I'm pretty sure DBMate must be able to do this but don't want to set off on a wild goose chase.
I'm presuming the schema name is inserted into the patch code before running or does it use SET search path?
Many thanks
Beta Was this translation helpful? Give feedback.
All reactions