Conversation
tomhoule
commented
Jun 12, 2024
| /// True, if the referenced row is unique, this means there can only be at most one related row. | ||
| pub fn is_referenced_row_unique(self) -> bool { | ||
| /// True, if the referenced column(s) is (are) unique, this means there can only be at most one row on the other side of the relation. | ||
| pub fn is_other_side_one(self) -> bool { |
Contributor
Author
There was a problem hiding this comment.
Renaming and rewriting the docstring because this is really not about the foreign key. Maybe other_side_is_one() would be a better name?
689047d to
9ec09a8
Compare
pimeys
reviewed
Jun 12, 2024
engine/crates/integration-tests/tests/postgres/find_one/joins.rs
Outdated
Show resolved
Hide resolved
pimeys
reviewed
Jun 12, 2024
engine/crates/integration-tests/tests/postgres/find_one/joins.rs
Outdated
Show resolved
Hide resolved
Given a table with two foreign keys referencing the same table, for example:
```sql
CREATE TABLE public.colors (
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
name VARCHAR(255) NOT NULL UNIQUE,
rgb INT NOT NULL
);
CREATE TABLE public.users (
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
name VARCHAR(255) NOT NULL UNIQUE,
favorite_color_id INT NOT NULL REFERENCES colors(id),
least_favorite_color_id INT REFERENCES colors(id)
);
```
Previously, we would have only a `colors` field on the `users` type, using
one of the two relations at random.
This commit changes the connector so we have two fields:
`colorsByFavoriteColorId` and `colorsByLeastFavoriteColorId`. The fields
on `colors` that walk the relation in the other direction are also adapted.
closes GB-6878
9ec09a8 to
8a0b192
Compare
pimeys
approved these changes
Jun 13, 2024
tomhoule
added a commit
that referenced
this pull request
Jun 13, 2024
Features - You can now filter on text columns with the LIKE operator on the postgres connector (https://www.postgresql.org/docs/current/functions-matching.html). #1764 - The postgres connector now uses a connection pool instead of a single connection in `grafbase start`. #1771 - The postgres connector now supports multiple relations between two tables. See the pull request (#1770) for an example. - Fixed a bug with enum values sent to subgraphs in `grafbase dev` for federated graphs. #1766
Merged
tomhoule
added a commit
that referenced
this pull request
Jun 13, 2024
Features - You can now filter on text columns with the LIKE operator on the postgres connector (https://www.postgresql.org/docs/current/functions-matching.html). #1764 - The postgres connector now uses a connection pool instead of a single connection in `grafbase start`. #1771 - The postgres connector now supports multiple relations between two tables. See the pull request (#1770) for an example. - Fixed a bug with enum values sent to subgraphs in `grafbase dev` for federated graphs. #1766 - Expand the scope of files watched for changes in `grafbase dev`. #1774
tomhoule
added a commit
that referenced
this pull request
Jun 13, 2024
Features - You can now filter on text columns with the LIKE operator on the postgres connector (https://www.postgresql.org/docs/current/functions-matching.html). #1764 - The postgres connector now uses a connection pool instead of a single connection in `grafbase start`. #1771 - The postgres connector now supports multiple relations between two tables. See the pull request (#1770) for an example. - Fixed a bug with enum values sent to subgraphs in `grafbase dev` for federated graphs. #1766 - Expand the scope of files watched for changes in `grafbase dev`. #1774
tomhoule
added a commit
that referenced
this pull request
Jun 13, 2024
Features - You can now filter on text columns with the LIKE operator on the postgres connector (https://www.postgresql.org/docs/current/functions-matching.html). #1764 - The postgres connector now uses a connection pool instead of a single connection in `grafbase start`. #1771 - The postgres connector now supports multiple relations between two tables. See the pull request (#1770) for an example. - Fixed a bug with enum values sent to subgraphs in `grafbase dev` for federated graphs. #1766 - Expand the scope of files watched for changes in `grafbase dev`. #1774
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Given a table with two foreign keys referencing the same table, for example:
Previously, we would have only a
colorsfield on theuserstype, using one of the two relations at random.This commit changes the connector so we have two fields:
colorsByFavoriteColorIdandcolorsByLeastFavoriteColorId. The fields oncolorsthat walk the relation in the other direction are also adapted.closes GB-6878