N
Neon3mo ago
eastern-cyan

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
stormy-gold
stormy-gold3mo 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.
eastern-cyan
eastern-cyanOP3mo ago
i use the web dashboard
eastern-cyan
eastern-cyanOP3mo ago
but the keywords.members doesnt exist
No description
stormy-gold
stormy-gold3mo 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.
eastern-cyan
eastern-cyanOP3mo ago
Okay thanks

Did you find this page helpful?