[wp-trac] [WordPress Trac] #49364: dbDelta() should not change display width for integer data types on MySQL 8.0.17+

WordPress Trac noreply at wordpress.org
Wed Feb 5 04:17:54 UTC 2020


#49364: dbDelta() should not change display width for integer data types on MySQL
8.0.17+
----------------------------+----------------------------
 Reporter:  SergeyBiryukov  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Future Release
Component:  Database        |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+----------------------------
 Background: #49344

 [https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html
 MySQL 8.0.17 removed support for the display width attribute] for integer
 data types:
 > As of MySQL 8.0.17, the ZEROFILL attribute is deprecated for numeric
 data types, as is the display width attribute for integer data types.
 Support for ZEROFILL and display widths for integer data types will be
 removed in a future MySQL version. Consider using an alternative means of
 producing the effect of these attributes.

 With this change, when creating a table, `BIGINT(20)` becomes just
 `BIGINT`, causing quite a few failures in `tests/dbdelta.php` (25 in
 total). They all look similar to this:
 {{{
 2) Tests_dbDelta::test_column_type_change
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id
 from bigint(20) to int(11)'
 +    'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id
 from bigint to int(11)'
  )

 tests/phpunit/tests/dbdelta.php:151
 }}}

 Most of these failures will be addressed in #49344.

 This ticket is for addressing the remaining failure caused by the same
 `BIGINT(20)`/`BIGINT` discrepancy coming from `wp_get_db_schema()`:
 {{{
 1)
 Tests_dbDelta::test_wp_get_db_schema_does_no_alter_queries_on_existing_install
 Failed asserting that an array is empty.
 tests/phpunit/tests/dbdelta.php:693
 }}}

 Currently, when running on MySQL 8.0.17+, `dbDelta()` tries to convert
 `BIGINT` back to `BIGINT(20)`, `INT` back to `INT(11)`, etc. This does not
 have any effect on the database, but is pointless and should not happen.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49364>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list