- Merge request !54Issue #3553199: Ensure JsonItem::schema() definition provides default type if size not in expected list β (Open) created by xurizaemon
A project had JSON (text) fields of size 16K. With recent JSON Field, installs of the codebase using drush --existing-config began to fail with:
[error] Unexpected error during import with operation create for field.storage.node.field_data: Exception thrown while performing a schema update. SQLSTATE[HY000]: General error: 4161 Unknown data type: 'NOT': CREATE TABLE "node__field_data" (
"bundle" VARCHAR(128) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance',
"deleted" TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted',
"entity_id" INT unsigned NOT NULL COMMENT 'The entity id this data is attached to',
"revision_id" INT unsigned NOT NULL COMMENT 'The entity revision id this data is attached to',
"langcode" VARCHAR(32) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'The language code for this data item.',
"delta" INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
"field_data_value" NOT NULL,
PRIMARY KEY ("entity_id", "deleted", "delta", "langcode"),
INDEX "bundle" ("bundle"),
INDEX "revision_id" ("revision_id")
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Data storage for node field field_data.'; Array
(
)
Table generation statements were invalid as the field schema was not being generated correctly for field sizes other than \Drupal\json_field\Plugin\Field\FieldType\JsonItem::SIZE_SMALL, SIZE_NORMAL, SIZE_MEDIUM or SIZE_BIG. Setting a column type is required.
Install from --existing-config using config like:
langcode: en
status: true
dependencies:
module:
- json_field
- node
id: node.field_data
field_name: field_data
entity_type: node
type: json
settings:
size: 16384
module: json_field
locked: false
cardinality: -1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Ensure that \Drupal\json_field\Plugin\Field\FieldType\JsonItem::schema returns a valid schema by providing a default value.
I see this relates to π Field length limit logic is incorrect Active and that another user has reported issues with the update script there on sites with existing data. I haven't tested with existing data.
- Test coverage
- Fix
none
none
Storage schema contains required keys.
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.