concretecms / migration_tool

Migration tool for Concrete CMS version 9+.
9 stars 5 forks source link

Incorrect integer value error when importing empty value for integer columns #39

Open hissy opened 5 months ago

hissy commented 5 months ago
Handling "PortlandLabs\Concrete5\MigrationTool\Publisher\Command\PublishPageContentCommand" failed: An exception occurred while executing 'INSERT INTO btImageSliderEntries (bID, id, cID, fID, linkURL, internalLinkCID, title, description, sortOrder) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [187, "4262", "0", "", "", "0", "\u30bf\u30a4\u30c8\u30eb\u3068", "
\u672c\u6587\u306e\u307f<\/p>\n", "0"]: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'fID' at row 1

You can reproduce this issue by adding an image slider block with entries with no images selected.

hissy commented 5 months ago

I gave up trying to fix this issue on Version 9 because I couldn't decide how to fix it.

This issue is quite similar to https://github.com/concretecms/addon_migration_tool/pull/104 and can be reproduced using the same XML file, but the same change for StandardPublisher doesn't solve this issue on Concrete version 9.

I think the best way is to check the column definition before saving data to the database in the \Concrete\Core\Legacy\BlockRecord class. However, the class is already deprecated, so we may have to create a new modern BlockRecord class to handle additional tables.