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]
(
)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhedstrom’s picture

Status: Active » Needs review
FileSize
1.44 KB
jhedstrom’s picture

Status: Needs review » Fixed

Committed #1.

  • jhedstrom committed 425dff4 on 8.x-1.x
    Issue #2538756 by jhedstrom: head2head_2431329() can fail if there are...

  • jhedstrom committed 967bd7b on 8.x-1.x
    Follow-up to issue #2538756: Set warning instead of error in...
jhedstrom’s picture

Status: Fixed » Needs review
FileSize
1.11 KB

Hmm, 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.

jhedstrom’s picture

Status: Needs review » Fixed

Committed #5. It seems to be working as expected.

  • jhedstrom committed b3cccae on 8.x-1.x
    Issue #2538756 by jhedstrom: head2head_2431329() can fail if there are...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.