March 18, 2019 admin

Updating text formats in Drupal 8 via database.

During my migration from Drupal 7 to Drupal 8, I relieved an error regarding updating text filter formats so I decided to do it post migration.

To see all columns that need updating

SELECT DISTINCT TABLE_NAME, COLUMN_NAME  
FROM INFORMATION_SCHEMA.COLUMNS  
WHERE column_name LIKE '%format%'  
AND TABLE_SCHEMA='Your_Drupal_database_name'

You can use this information to run queries like below.

For nodes

  UPDATE Your_Drupal_database_name.node__body 
SET 
    body_format = 'html_editor'
WHERE entity_id > 0

For comments

UPDATE Your_Drupal_Database_Name.comment__comment_body 
SET 
  comment_body_format = 'html_editor'
WHERE entity_id > 0

Leave a Reply

Your email address will not be published. Required fields are marked *