You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi There, I just found out that when more than 2 tables are related and I try to display the related value then it shows empty value on UI, but after I save the record, the relation works perfectly, so I know the relation is not wrong there. Anyways I'm adding minimal tables schema so you know what I mean.
Schema:
CREATE TABLE public.users (
"uuid" uuid NOT NULL,
name varchar(100) NULL
);
CREATE TABLE public.permissions (
permission_key varchar(50) NOT NULL,
permission_label varchar(50) NULL,
CONSTRAINT permissions_pkey PRIMARY KEY (permission_key)
);
CREATE TABLE public.user_permissions (
"uuid" uuid NOT NULL,
user_uuid uuid NULL,
permission_key varchar(100) NULL,
CONSTRAINT user_permissions_pkey PRIMARY KEY (uuid)
);
ALTER TABLE public.user_permissions ADD CONSTRAINT user_permissions_user_uuid_fkey FOREIGN KEY (user_uuid) REFERENCES public.users("uuid") ON DELETE SET NULL;
ALTER TABLE public.user_permissions ADD CONSTRAINT user_permissions_permission_key_fkey FOREIGN KEY (permission_key) REFERENCES public.permissions(permission_key);
Basically in "users" collection, I've added a one to many field (permissions) which have a relation to user_permissions with users.uuid = user_permissions.user_uuid and "user_permissions.permission_key" is related to "permissions" table with user_permissions.permission_key = permissions.permission_key.
And in user_permissions.permission_key field's display settings, I've chose "Related Values" and displayed the value of permissions.permission_label and then in users collection, field users.permissions (one to many field) have display set to "Related Values" and I've selected related field user_permissions.permission_key. So it's a relation of 3 tables in this case. I'll attach screenshots to visually show the issue as well.
In following screenshot, I opened a user record and it shows permissions correctly, so that means the relation is working and it's showing value of permissions.permission_label
But when I add a new permission, the value appears empty.
And when I save the record, it'll save the permissions correctly and then when editing the same record again, it'll show the value correctly as shown in following screenshot.
I'm using Directus v10.10.4 with postgres v16.1
To Reproduce
Create the 3 tables in postgres database
Configure the fields as I've mentioned above
Try to select a permission and label will not appear there until you save the record
Directus Version
v10.10.4
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered:
It appears I have the same question:
I am using Gorm to create a table. When I define a many-to-many relationship and create the table,
the Directus UI does not display the field defined as many-to-many.
Describe the Bug
Hi There, I just found out that when more than 2 tables are related and I try to display the related value then it shows empty value on UI, but after I save the record, the relation works perfectly, so I know the relation is not wrong there. Anyways I'm adding minimal tables schema so you know what I mean.
Schema:
Basically in "users" collection, I've added a one to many field (permissions) which have a relation to
user_permissions
withusers.uuid = user_permissions.user_uuid
and "user_permissions.permission_key" is related to "permissions" table withuser_permissions.permission_key = permissions.permission_key
.And in
user_permissions.permission_key
field's display settings, I've chose "Related Values" and displayed the value ofpermissions.permission_label
and then inusers
collection, fieldusers.permissions
(one to many field) have display set to "Related Values" and I've selected related fielduser_permissions.permission_key
. So it's a relation of 3 tables in this case. I'll attach screenshots to visually show the issue as well.In following screenshot, I opened a user record and it shows permissions correctly, so that means the relation is working and it's showing value of
permissions.permission_label
But when I add a new permission, the value appears empty.
And when I save the record, it'll save the permissions correctly and then when editing the same record again, it'll show the value correctly as shown in following screenshot.
I'm using Directus v10.10.4 with postgres v16.1
To Reproduce
Directus Version
v10.10.4
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: