V8-archive: Field default value not saving in Directus v8.4.0-v8.5.5

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

Steps to Reproduce

  1. Create a new collection
  2. Add a text or status field
  3. Set a default value
  4. Save the field
  5. Open the field again: the default value is gone

Expected Behavior

The default value is stored in the table's schema.

Actual Behavior

The default value is not stored in the table's schema.

Technical Details

  • Device: Desktop / Firefox 72.0.1
  • OS: macOS Catalina 10.15.2
  • Web Server: nginx 1.14
  • PHP Version: 7.3
  • Database: tested on MariaDB 10.2, 10.3 and MySQL 8.0.15
  • Directus Release Version: 8.4.0
  • Install Method: clone, checkout of v8.4.0 tag

Going back to 8.3.1 solves the issue.

bug

Most helpful comment

Please make sure to run this on PHP 7.3 and MySQL 8.0.15.
Ah, that's most likely what the problem is.. Directus doesn't support MySQL v8 yet..

Ah, based on "MySQL 5.7+" as stated on the page below, I thought it was supported.

https://docs.directus.io/installation/git.html

But it seems weird that the same database version worked in 8.3.1 but not in 8.4.0?

All 18 comments

Hmm, that's odd. This has been working for me (unless it was broken very recently). @rijkvanzanten — App or API?

I don't seem to have this problem on the live demo on v8.4.0.. @GMTA would you be able to share a sql dump so we can reproduce this?

I can not remember how I have been related to this issue?

oh my bad, GitHub put your name first on the list.. That's normally the poster of the issue. No idea what happened there!

Same problem for me after the 8.4.0 update

Hi @rijkvanzanten,

Please see the following database that exposes the issue:
example-db.sql.gz

I've created a table named test_table with a column name. I'm unable to set the default value for this column.

Please make sure to run this on PHP 7.3 and MySQL 8.0.15.

Please make sure to run this on PHP 7.3 and MySQL 8.0.15.

Ah, that's most likely what the problem is.. Directus doesn't support MySQL v8 yet..

Directus: 8.4.0
PHP: 7.4.1
MySQL: 5.7.28
I'm having troubles with this bug. When I edit "ID" primary key stops working

demo has the same bug

  1. https://demo.directus.io/admin/#/thumper/settings/collections/services
  2. Update Field: Status
  3. Default Value set "published"
  4. Saved
  5. Check Default Value
  6. Omg? NULL?
  1. Update Field: ID
  2. Saved
  3. https://demo.directus.io/admin/#/thumper/collections/services/+
  4. "id: This value should not be blank."

Please make sure to run this on PHP 7.3 and MySQL 8.0.15.

Ah, that's most likely what the problem is.. Directus doesn't support MySQL v8 yet..

@rijkvanzanten on version 8.3.1 worked fine with MySQL v8, the default value was saved

Please make sure to run this on PHP 7.3 and MySQL 8.0.15.
Ah, that's most likely what the problem is.. Directus doesn't support MySQL v8 yet..

Ah, based on "MySQL 5.7+" as stated on the page below, I thought it was supported.

https://docs.directus.io/installation/git.html

But it seems weird that the same database version worked in 8.3.1 but not in 8.4.0?

I've tested on MySQL 5.7 with Directus v8.4.0 and the same issue pops up. Might this be the same as #1676 ?

I took the tag 8.5.0 and tried this, I see the same issue. It is not persisting default value. 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 a field and set the default value.
Opened the same field again, it didn't save the default value.

Am I missing anything? Please assist

@rijkvanzanten Could you please remove the alt-stack label? It's not working on the default supported stack as well.

After trying out v8.5.4, I noticed that not only the default value is broken, but also unsigned/signed for integers is completely ignored and always set to signed.

@rijkvanzanten I think it is related to this #1601.
If we will revert changes of #1601 It will work perfectly fine.

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

Fixed in #1764

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cdwmhcc picture cdwmhcc  Â·  3Comments

vuhrmeister picture vuhrmeister  Â·  3Comments

binary-koan picture binary-koan  Â·  3Comments

maettyhawk picture maettyhawk  Â·  3Comments

ondronix picture ondronix  Â·  3Comments