- Issue created by @andypost
- 🇫🇷France andypost
the commit which breaks https://git.drupalcode.org/project/drupal/-/commit/eea37702137e1dce6036f...
it means mysql require to pass "fields" but other drivers are not (as doc block said)
@daffie please check if it works for mongodb
- 🇫🇷France andypost
It was added in #1314214: MySQL driver does not support full UTF-8 (emojis, asian symbols, mathematical symbols) →
The
mysql/Schema::getNormalizedIndexes()
requirefields
to be passed - 🇳🇱Netherlands daffie
The
fields
key needs to be set inmysql/Schema::getNormalizedIndexes()
, because we are want the resulting index name to be less than 191 characters. When we use utf8mb4 the resulting index name will be below 756 bytes. That is the maximum name length for an index in InnoDB when the row format is REDUNDANT or COMPACT. See: https://dev.mysql.com/doc/refman/8.4/en/innodb-limits.html.If it is up to me we would not be doing index changes in the method
Schema::addField()
. For the better and more stable solution would be the add a field first and then add an index in a seperate call withSchema::AddIndex()
. That would be the better solution for all databases, including MongoDB. - 🇫🇷France andypost
Then at least doc-block needs rewording to point out that fields are required
without the 'fields' element
from
\Drupal\Core\Database\Schema::addField()
* @param array|null $keys_new * (optional) Keys and indexes specification to be created on the * table along with adding the field. The format is the same as a * table specification but without the 'fields' element. If you are * adding a type 'serial' field, you MUST specify at least one key * or index including it in this array. See ::changeField() for more * explanation why.