Change record status: 
Project: 
Introduced in branch: 
8.7.x
Introduced in version: 
8.7.0
Description: 

Drupal core requires entity type and field_name base fields on comment for the comments system to work, but this was not enforced by the schema.

Drupal 8.7 includes an update which changes the schema so that the fields in the database are NOT NULL.

This update can potentially fail on sites where comments have been saved with those fields as NULL (for example via custom code saving a comment entity without setting those field values).

If you have been unable to update from 8.6.x to 8.7.x and have reached this page, you can take the following action (or fix the bad data in a different way):

  1. Downgrade your codebase to Drupal 8.6.x
  2. Find the comments where these fields are null. This is an example database query which should return the comment IDs.
    SELECT cid FROM comment_field_data WHERE field_name IS NULL OR entity_type IS NULL;
    
  3. Delete the comments you just found, by browsing to example.com/comment/{comment_id}/delete for each comment returned by the query.

    Note: this is a destructive operation. If you discover a lot of comments with invalid data or would like to preserve the comments for any other reason, you will need to do further investigation and may need to write custom SQL updates or PHP. See #3052147: comment_update_8701 fails if there are comments without field_name for some discussion about approaches.
Impacts: 
Site builders, administrators, editors
Module developers