V8-archive: API removes auto increment if hidden on browse is changed

Created on 22 Jan 2020  Â·  18Comments  Â·  Source: directus/v8-archive

Version - v8.4.0
Error Message - id: This value should not be blank.

Steps

  • Created new collection - turn on the Sort toggle, Modified On and Modified By
  • Edit the Default primary key column 'id' by selecting it
  • Go to schema Tab, Turn off 'Hidden on Browse'
  • Click on 'Next'
  • Click on 'Save'
  • Go to the newly created collection to add new Row
  • Click on '+' at top right
  • You will see only status with default 'Draft' selected - Leave it as is
  • Click on 'Tick' button at top right.
  • Displays Error Message 'id: This value should not be blank.'

My expectation is that the id column should be displayed on the list, but during add/edit, should not display. During add it should auto generate the id.

bug

Most helpful comment

@ithiru this hasn't been released to directus/directus yet. I'm planning on pushing out a release tomorrow.

All 18 comments

NOTE: It seems this "error" is triggered when the ID Field in the Collection is not set to Auto Increment.

Ah in that case it makes perfect sense that the error is returned. If you don't have auto increment enabled, and you don't pass a primary key manually, the API will error out as a primary is always required.

By default, Auto Increment should be added to the Primary Int Key, no?
It seems the only change made above was hiding on browse.

Correct, auto-increment is enabled by default. @ithiru Could you confirm if auto increment is turned on on your end?

Correct, auto-increment is enabled by default. @ithiru Could you confirm if auto increment is turned on on your end?

is there a way we can turn on the auto increment through UI? I don't see an option to do that. I just did the steps mentioned above.

@ithiru — if your created the collection through Directus it would have automatically created an id column/field with auto increment on. Something seems amiss here. Could you check the database directly to see if that table's primary key has auto increment?

Also, as far as I know, there's no way to change the auto-increment from the Directus App... so I don't think this happened on our side. Was any part of this table created/edited directly within the database?

@benhaynes I just simulated this @ demo.directus.io by following the steps I provided above. https://demo.directus.io/admin/#/thumper/collections/testprimaryautoincrement/+ please check..

Thanks! I have confirmed your issue... very weird indeed!

Thanks for making it as critical, it is indeed..

Can confirm exact same case. Reproducible. If its any help, the table was created from outside of directus app, then the primary key is added by alter table fullmaps modify id int auto_increment primary key;

Quick vid of reproduction

I took the tag 8.5.0 and tried this, I see the same issue. It is not allowing and throwing the same error. This is the steps I followed.

git pull
git checkout v8.5.0
php bin/directus db:upgrade -N - Verified the migrations ran by checking the directus_migrations table.

Accessed the app via url,
modified the id field and disable Hidden on Browse

Add new Item to collection and gets the same error. - 'id: This value should not be blank.'

Am I missing anything? Please assist

Tested the same in v8.5.4 and the default value is not saving..:-(

@rijkvanzanten I think it is related to #1601.

@ithiru
I fixed this issue with PR #1764.
Please check it and if issue is solved then close it.

@hemratna Thanks, did this change go to directus/directus repo? I see the latest tag is v8.5.5. Should I wait the push or the 8.5.5. has all these changes?

Please confirm

@ithiru this hasn't been released to directus/directus yet. I'm planning on pushing out a release tomorrow.

Fixed in #1764

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ondronix picture ondronix  Â·  3Comments

Varulv1997 picture Varulv1997  Â·  3Comments

metalmarco picture metalmarco  Â·  3Comments

chintohere picture chintohere  Â·  3Comments

Nitwel picture Nitwel  Â·  3Comments