N
Neon2mo ago
wise-white

Foreign Key Problem

When creating a foreign key to a table in another schema, the constraint is generated using the current schema instead of the one explicitly specified. Example:
FOREIGN KEY (member_id)
REFERENCES keywords.members(id)
FOREIGN KEY (member_id)
REFERENCES keywords.members(id)
But it should be:
FOREIGN KEY (member_id)
REFERENCES clients.members(id)
FOREIGN KEY (member_id)
REFERENCES clients.members(id)
This causes the constraint to fail because keywords.members does not exist.
5 Replies
conscious-sapphire
conscious-sapphire2mo ago
When you say the constraint is generated, does that mean you are creating it using an ORM? I am wondering if it might be picking up your default Postgres search_path.
wise-white
wise-whiteOP2mo ago
i use the web dashboard
wise-white
wise-whiteOP2mo ago
but the keywords.members doesnt exist
No description
conscious-sapphire
conscious-sapphire2mo ago
Ok. You're on our Tables page. I'll bring this up with the Drizzle Studio team. This is a bug. It will be fixed in the next release of Drizzle Studio. We're currently at version 1.2.3. It will be fixed in 1.2.4. I'd expect that to go out early next week. Sorry for the inconvenience. An alternative would be to use the SQL Editor to add constraints.
wise-white
wise-whiteOP2mo ago
Okay thanks

Did you find this page helpful?