directus icon indicating copy to clipboard operation
directus copied to clipboard

Cannot create Many to One field on System collection Directus Users

Open willemmulder opened this issue 2 years ago • 4 comments

Describe the Bug

When creating a Many to One field on Directus Users I get this error message

image

The field is generated regardless, but it is in an invalid state. It does appear in the users UI but the field just reads "The relationship is not configured correctly".

image

When I try to edit or delete the field, I get the same message.

image

Note: using Directus Cloud with a free project (https://b3339lek.directus.app/).

To Reproduce

Go to Settings > Data Model > System collections > directus_users

Then add a One to Many field. That does not work properly

Errors Shown

{
  "errors": [
    {
      "message": "DROP TABLE \"directus_users\" - SQLITE_CONSTRAINT: FOREIGN KEY constraint failed",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

What version of Directus are you using?

9.13.0

What version of Node.js are you using?

16.15.1

What database are you using?

SQLite (Directus Cloud with free project... that's SQLite right?)

What browser are you using?

Chrome

How are you deploying Directus?

Directus Cloud

willemmulder avatar Jul 28 '22 10:07 willemmulder

I am unable to reproduce the issue using the given instructions, could you elaborate on the specific O2M settings used? https://www.loom.com/share/fddd0a3d23f84b86b7720fdbd897bca5

br41nslug avatar Jul 28 '22 12:07 br41nslug

Thanks for checking!

Hmm interesting. Whenever I create a One to Many on the User table it gives me this error. Creating e.g. a text field works fine. I can make you admin on my project so you can check from your end? https://b3339lek.directus.app/admin/settings/data-model/directus_users

willemmulder avatar Jul 28 '22 12:07 willemmulder

I have the same issue.

image

image

image

image

tastnt avatar Aug 04 '22 19:08 tastnt

I was able to reproduce this now using a m2o from directus_user to another collection on a free tier cloud app.

br41nslug avatar Aug 05 '22 07:08 br41nslug

Same error for me on a free tier cloud app brand new

{
  "errors": [
    {
      "message": "DROP TABLE \"directus_users\" - SQLITE_CONSTRAINT: FOREIGN KEY constraint failed",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

Adding any many to one field will create this error message. No special settings just a field name and a collection linked to it

alexdabast avatar Aug 14 '22 21:08 alexdabast

I can't seem to reproduce this anymore on the current free Community Cloud which is on Directus 9.15.1 🤔

https://user-images.githubusercontent.com/42867097/185082062-d3b12ccd-0523-48f8-9dbd-23b0e81234a3.mp4

@alexdabast do you know what was the version when you had that error? Is it still reproducible on 9.15.1?

azrikahar avatar Aug 17 '22 09:08 azrikahar

On the already existing instance i have i am still able to reproduce it but after creating a new one i cannot reproduce it there anymore 🤔

br41nslug avatar Aug 17 '22 10:08 br41nslug

On the already existing instance i have i am still able to reproduce it but after creating a new one i cannot reproduce it there anymore 🤔

@br41nslug Just to confirm, the existing instance has been upgraded to 9.15.1 as well? Wondering if there's some form of version mismatch here. Or if it is in fact already upgraded to 9.15.1, maybe something is off with the upgrade 🤔

azrikahar avatar Aug 17 '22 10:08 azrikahar

It was but i suppose it could be an artifact in the database from that previous test

br41nslug avatar Aug 17 '22 10:08 br41nslug

Linear: ENG-220

rijkvanzanten avatar Dec 15 '22 22:12 rijkvanzanten