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

o2m one to many failing on specific field, when many table name is 'invitation' #22247

Open
numito opened this issue Apr 18, 2024 · 2 comments
Open

Comments

@numito
Copy link

numito commented Apr 18, 2024

Describe the Bug

One to many relationship fails on existing schema if many table name is 'invitation'.
We have an existing schema with many o2m relationships configured with no issue. But we have one table 'invitation' where we have an error in the relationship.

To Reproduce

with any directus version after 10.9.3 (use to work correctly before)
One table: customer
Many table: invitation

simplified schema:

create table customer (
id int8 not null;
name varchar(200);
);

create table property_for_rent (
id int8 not null;
name varchar(200);
);

create table invitation (
id int8 not null;
name varchar(200);
customer_id int8 references customer(id) on delete set null;
property_for_rent_id int8 references property_for_rent(id) on delete set null;
);

In directus create a one to many relationship on the customer to the invitation called 'invitations', and a one to many relationship on the house to the invitation called 'invitations'.
The alias field 'invitations' gets created but then directus frontend interface shows a many to many interface with empty fields.
Capture d’écran 2024-04-18 à 17 42 27

once saved add data to to all tables and go to the customer or house table, the invitations field displays an error message: relationship not configured correctly.

We cannot edit the relationship anymore it gets locked. If we remove the alias field 'invitations' and try to recreate it we get an error telling this relation already exists. The only way to remove it is to purge the tables directus_fields, directus_relations.
Capture d’écran 2024-04-18 à 17 42 58

I have compared the data in directus tables with other one to many relations that work correctly and they are the same. I can't figure any difference, so it seems to be a front end problem.

It seems on of the table names trigger the error.

Directus Version

v10.10.7

Hosting Strategy

Self-Hosted (Docker Image)

@hanneskuettner
Copy link
Contributor

I am unable to reproduce this problem with the information you provided on my end. I've attached a video in which I show my collection setup, that follows your description / simplified schema and the correct relationship in the invitations field of the property_for_rent collection.

Are you able to reproduce the error on a clean database?
Do you see any errors in the JavaScript Console in your browser?

Screen.Recording.2024-04-19.at.09.07.11.mov

@numito
Copy link
Author

numito commented Apr 19, 2024

Hello,
Thank you for your response.
I have no error on the frontend and no error on the backend. Please find a video showing the problem.
Is there a way to completely reconfigure a field even if it has already been configured. Deleting field reference in table directus_fields and directus_relations seems like an option, but it's not very convenient, is there another way to completely reset a field so we reconfigure it ?

Would you like the rows in the directus tables ?

Enregistrement.de.l.ecran.2024-04-19.a.12.34.55.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 Needs Triage
Development

No branches or pull requests

2 participants