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

Primary keys that are also foreign keys not simplified #34

Closed
hgl opened this issue May 31, 2021 · 3 comments · Fixed by #35
Closed

Primary keys that are also foreign keys not simplified #34

hgl opened this issue May 31, 2021 · 3 comments · Fixed by #35
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@hgl
Copy link
Contributor

hgl commented May 31, 2021

Summary

See the code snippet

Steps to reproduce

Given this table design:

CREATE TABLE animal (
  id SERIAL PRIMARY KEY
);

CREATE TABLE cat (
  id integer PRIMARY KEY REFERENCES animal
);

Expected results

An animal query should expose cat, a cat query should expose animal

Actual results

An animal query exposes catById, a cat query exposes animalById

Additional context

Possible Solution

@hgl hgl added the 🐛 bug Something isn't working label May 31, 2021
@benjie
Copy link
Member

benjie commented May 31, 2021

What happens if you rename cat.id to cat.animal_id?

@hgl
Copy link
Contributor Author

hgl commented May 31, 2021

Ah, renaming to animal_id fixes it, but it does make the cat query cat(animalId: 10) slightly awkward.

Feel free to close the issue if you think it works as intended.

@benjie
Copy link
Member

benjie commented May 31, 2021

Nah, just making sure I understand the issue. I think this warrants improvement 👍 It's going to need special handling.

@benjie benjie added enhancement New feature or request good first issue Good for newcomers and removed 🐛 bug Something isn't working labels May 31, 2021
@benjie benjie closed this as completed in #35 Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants