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

Schema import issue: A primary key should not be a foreign key #22775

Open
u12206050 opened this issue Jun 17, 2024 · 0 comments
Open

Schema import issue: A primary key should not be a foreign key #22775

u12206050 opened this issue Jun 17, 2024 · 0 comments

Comments

@u12206050
Copy link
Contributor

Describe the Bug

When creating a schema and then attempting to import the schema into another environment we get the following error
A primary key should not be a foreign key.

We have two collections that have a one-to-one relationship with each other, meaning they both share the same primary key, however since Directus needs to to know which fields to use in the relation we have set them as the relation fields. This works as we want on the first environment but we are unable to sync this using the Directus schema.

To Reproduce

Not sure if you'll be able to achieve this using Directus, but with out existing tables with the following structure (simplified)

events: id(pk), name (string)
event_config: event(pk & fk), settings (json)

We mapped the event field to the events collection as a m2o relationship in order to get the select interface, and that seems to have worked.

Directus Version

10.10.7

Hosting Strategy

Self-Hosted (Docker Image)

Database

Mysql

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

2 participants