-
-
Notifications
You must be signed in to change notification settings - Fork 569
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
Feature request: one-to-one relations the other way also (breaking change) #432
Comments
Any news on this? |
Raising the priority of this because I've hit it again; and v4 would be the perfect time to introduce a breaking change for the better. |
barsByFooId will work, though, right? It just returns a collection with only one element? And is it a breaking change because it introduces a new function name? |
It's a breaking change because if we detect the relation to be one-to-one we'd be removing the false one-to-many relationship that's currently present and using the one-to-one instead. I think we can detect it quite easily: if the reference is on a primary or unique key then it's one-to-one. We might be able to add some command-line flags to retain the previous behaviour, but that adds more work. |
Note to self: add an option people can use to gain backwards compatibility. |
I just want to emphasise that it would be nice to have it on "UNIQUE" references as well as foreign keys (I need it for one of my projects). Looking forward to see this feature land! |
Does this mean that if we have a join table, it will register as a one-to-one relationship because the foreign key is a primary or unique key? |
No, this is only for a single column primary key (or other unique key); I think there’s another issue for many-to-many relations. |
Added in graphile/graphile-engine#177 |
@benjie we've got Edit: OK this was a one-to-one with a view, and required a |
It would be nice in this case if
foo
had abarByFooId
record rather thanbarsByFooId
collection, since thebar.foo_id
column is unique/primary key.(It works fine if you model this the other way:
but this isn't always optimal)
The text was updated successfully, but these errors were encountered: