-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Version Information
Server Version: 2.0.9
CLI Version (for CLI related issue): 2.0.9
Environment
Tested on hasura cloud
What is the expected behaviour?
One to one relationships are possible if the foreign key on the child table is also unique.
Parent tables should be able to have multiple object relationships to different tables.
What is the current behaviour?
When I track an object relationship from the parent table, the other suggested object relationships disappear and are not suggested anymore. They come back if I remove the object relationship.
How to reproduce the issue?
My test schema is as follows: a main table, and 3 related children table.
Two are object relationships, and one is an array relationship, that one works as expected.
Note the person_id column of the pet table is not unique
CREATE TABLE public.person (
id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name TEXT
);
CREATE TABLE public.pet (
id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name TEXT,
person_id INT NOT NULL REFERENCES public.person(id)
);
CREATE TABLE public.color (
id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name TEXT,
person_id INT UNIQUE NOT NULL REFERENCES public.person(id)
);
CREATE TABLE public.car (
id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name TEXT,
person_id INT UNIQUE NOT NULL REFERENCES public.person(id)
);- Apply the above schema
- Track all tables
- Go to the relationships tab of the
persontable - The 3 relationships are suggested as expected
- Click "add" and then "save" on the relationship with the
cartable - The
carrelationship is added correctly. **Thecolorrelationship is no longer suggested
- Delete the
carrelationship - The
colorrelationship is suggested again.
Any possible solutions?
This can currently be worked around by removing any existing object relationship, going to the schema root, and clicking "track all". This is a workaround and not a solution.
Can you identify the location in the source code where the problem exists?
This happens in console, I have not had the time to look for it yet.
If the bug is confirmed, would you be willing to submit a PR?
Absolutely