As originally reported here: #2155817-7: META: Verify upgrade process from 7.x-2.x to 7.x-3.x works

When running panelizer_update_7105() against a database that already contains data in the panelizer_entity or panelizer_defaults tables the following warning is encountered:
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'view_mode' at row 1

This is due to the fact that we're adding a NOT NULL field to a table with existing data and not providing a default.

I think it's reasonable to simply provide a default here but maybe we intentionally want to error if naive code in other modules tries to write to these tables without providing explicit values for these fields?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

azinck created an issue. See original summary.

azinck’s picture

Status: Active » Needs review
FileSize
1.25 KB

Provided an update path for folks stuck on a failed update hook. I'm leaving this field with no default value since I'm not 100% sure of the ramifications of changing that.

  • DamienMcKenna committed 8057130 on 7.x-3.x authored by azinck
    Issue #2796175 by azinck: Workaround for adding the view_mode column to...
DamienMcKenna’s picture

Status: Needs review » Fixed
Parent issue: » #2787147: Plan for Panelizer 7.x-3.5 release

Thanks for working that out!

Status: Fixed » Closed (fixed)

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

fredcy’s picture

I hit this same error while upgrading from 7.x-2.0 to 7.x-3.4. The above patch does seem to work around the problem but only if I start from scratch. That is, I had to reload the database from backup and try again. Otherwise I would just get the same "Data truncated" error again.

DamienMcKenna’s picture

@fredcy: Did you try the current -dev release?

nerdcore’s picture

Priority: Normal » Critical

I am encountering the following error on schema update 7105 also coming from 7.x-2.0. I encounter this same eror on 3.4 and 3.x-dev dated 2016-Dec-12:

PDOException: SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value: ALTER TABLE {panelizer_defaults} CHANGE `view_mode` `view_mode` VARCHAR(128) NOT NULL DEFAULT 'page_manager' COMMENT 'Contains the view mode this panelizer is for.'; Array ( ) in db_change_field() (line 3076 of includes/database/database.inc).

This failure is stopping me from applying 20 more schema updates following 7105. As such I cannot complete the security update to 7.x-3.4 so I am increasing the Priority of this to Critical.

nerdcore’s picture

At the stage of running 7105 and experiencing this error all my rows in the panelizer_defaults table have view_mode NULL, despite the schema update specifying NOT NULL and default="page_manager".

I don't understand why this schema update is failing.

azinck’s picture

FileSize
1.59 KB

@nerdcore: I didn't realize that the failed state would actually have 'not null' set. This patch should work for you. If it does then you need to take out another issue so that we can push this properly through the review and commit steps.

nerdcore’s picture

DamienMcKenna’s picture

fyi I paired down the patch to just include the bit that actually changed and uploaded it to #2846011: Unable to complete running update hooks after running bad version of panelizer_update_7105().

bobodrone’s picture

FileSize
1.58 KB

I updated this patch to work with the latest dev but I am not sure if we should use the shortend down version?