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

Allow join types in many-to-many to not have a primary key #779

Open
ramnivas opened this issue May 29, 2023 · 0 comments
Open

Allow join types in many-to-many to not have a primary key #779

ramnivas opened this issue May 29, 2023 · 0 comments
Milestone

Comments

@ramnivas
Copy link
Contributor

ramnivas commented May 29, 2023

Consider Concert -> [ConcertArtist] <- Artist. Currently, we require that all Postgres types carry a field marked as @pk, but in case of many-to-many relations, it doesn't make much sense for the joining entity to carry a primary key.

type Concert {
   @pk id: Int ...
   title: String
   concertArtists: Set<ConcertArtist>?
}

type Artist {
   @pk id: Int ...
   name: String
   concertArtists: Set<ConcertArtist>?
}

type ConcertArtist {
   @unique("participation") concert: Concert
   @unique("participation") artist: Artist
   role: String
}

We should examine if there is a broader use case for pk-less types ("value types").

@ramnivas ramnivas changed the title Allow types without a primary key Allow join types in many-to-many to not have a primary key May 29, 2023
@ramnivas ramnivas added this to the M2 milestone Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant