Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The update hook fails to set NOT NULL if there are data in the table that are missing from the field data table (for whatever reason):
SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value: ALTER TABLE {node} CHANGE `langcode` `langcode` VARCHAR(12) NOT NULL; Array [error]
(
)
Comment | File | Size | Author |
---|---|---|---|
#5 | beta2beta-update-2431329-catch-05.patch | 1.11 KB | jhedstrom |
Comments
Comment #1
jhedstromComment #2
jhedstromCommitted #1.
Comment #5
jhedstromHmm, this fix only works until the next time the langcode column is altered (update 81103), where it then fails again since the schema declares this column to be not null.
This patch still catches the exception, then sets the null values to the default langcode for the site.
Comment #6
jhedstromCommitted #5. It seems to be working as expected.