Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persistent-postgresql getColumn throws an error when a column has more than one foreign key constraint #1009

Closed
jkeuhlen opened this issue Jan 8, 2020 · 3 comments

Comments

@jkeuhlen
Copy link

jkeuhlen commented Jan 8, 2020

As discussed on #979, there is currently a bug in persistent-postgresql that causes migrations to fail when there is more than one constraint on a single column.

This is an issue when you have e.g. a foreign key to a field and a compound foreign key with that same field included as shown in #979 (comment).

I've already written a failing test on another branch, and @robbassi has an incoming PR to fix this issue, so this is just for documentation purposes.

@robbassi
Copy link
Contributor

robbassi commented Jan 8, 2020

Adding to what @jkeuhlen mentioned above, this issue is also present in persistent-mysql, which was the reference implementation for this functionality. Once we get the fix reviewed and merged for persistent-postgresql, I'll make another PR for the mysql backend.

MaxGabriel pushed a commit that referenced this issue Jan 11, 2020
* [postgres] Fix multiple foreign keys on a single column

This PR addresses issue #1009 for the PostgreSQL backend. In order to support multiple foreign keys on a single column, we now pass the reference name to getColumn, and use it in the where clause when querying foreign keys for the column.

Adds failing tests for this, and gives a better error message if someone runs into the error.
@MaxGabriel
Copy link
Member

Oh wait, this is still open for MySQL

@parsonsmatt
Copy link
Collaborator

This was fixed by #1025 for MySQL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants