Closed Wiejeben closed 2 years ago
Upgrading my Craft 3 site fails because in the old Craft matrixblocks table sortOrder was nullable and contained null values.
matrixblocks
sortOrder
null
To make sure it wasn't a 3.7.43 issue I did update to 3.7.53.1 before going to 4, however that did not make a difference.
Migrate successfully.
*** applying m220213_015220_matrixblocks_owners_table > dropping {{%matrixblocks_owners}} if it exists ... done (time: 0.001s) > create table {{%matrixblocks_owners}} ... done (time: 0.004s) > add foreign key fk_rnxmtowmkvlvfzldckjgsoxxiowoppkfyjty: {{%matrixblocks_owners}} (blockId) references {{%matrixblocks}} (id) ... done (time: 0.009s) > add foreign key fk_rsowucrlagsuqmmabmtxrfjjjyhdwwfbujci: {{%matrixblocks_owners}} (ownerId) references {{%elements}} (id) ... done (time: 0.014s) > execute SQL: INSERT INTO {{%matrixblocks_owners}} ([[blockId]], [[ownerId]], [[sortOrder]]) SELECT [[id]], [[ownerId]], [[sortOrder]] FROM {{%matrixblocks}} ...Exception: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'sortOrder' cannot be null The SQL being executed was: INSERT INTO `matrixblocks_owners` (`blockId`, `ownerId`, `sortOrder`) SELECT `id`, `ownerId`, `sortOrder` FROM `matrixblocks` (/var/www/vendor/yiisoft/yii2/db/Schema.php:676) #0 /var/www/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException() #1 /var/www/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute() #2 /var/www/vendor/yiisoft/yii2/db/Migration.php(219): yii\db\Command->execute() ... *** failed to apply m220213_015220_matrixblocks_owners_table (time: 0.058s) 12 from 23 migrations were applied. Migration failed. The rest of the migrations are canceled.
4.2.3
8.1.7
Docker Alpine PHP FPM
MySQL 8.0.29
Imagick 3.7.0 (ImageMagick 7.1.0-16)
Thanks for reporting! Fixed for the next release.
Craft 4.2.4 is tagged with that fix.
What happened?
Description
Upgrading my Craft 3 site fails because in the old Craft
matrixblocks
tablesortOrder
was nullable and containednull
values.To make sure it wasn't a 3.7.43 issue I did update to 3.7.53.1 before going to 4, however that did not make a difference.
Steps to reproduce
matrixblocks
wheresortOrder
isnull
Expected behavior
Migrate successfully.
Actual behavior
Craft CMS version
4.2.3
PHP version
8.1.7
Operating system and version
Docker Alpine PHP FPM
Database type and version
MySQL 8.0.29
Image driver and version
Imagick 3.7.0 (ImageMagick 7.1.0-16)
Installed plugins and versions