commerce
commerce copied to clipboard
[5.x]: "Data too long for column ‘sku’ at row" when switching revisions
What happened?
Description
I wanted to roll back to an older revision of a product, but suddenly all variants were removed. A look at the logs revealed the reason:
caught exception ‘yii\db\Exception’ with message ’SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column ‘sku’ at row 1
The SQL being executed was: UPDATE commerce_purchasables SET sku=‘__temp_cpdwvjihrjmpahvaqhwhhbbiffopyqdlljsj-__temp_oweumktnbvwppomffaukwnqnuwcextywsshx-__temp_ljqqafnpzbnqknjymlmirpbucfxitrwzhnwe-__temp_ygrszrxrooylsbqdwdhygsjoeqlcfpowveom-__temp_pygflgannthbmegmnladmxvavkyqgqjnmnpj-__temp_ahxizahtwavkunnbvdlfutihqgktsckpgchi-myvariant-150’, dateUpdated=‘2024-10-16 08:16:39’ WHERE id=194914' in
Steps to reproduce
- Create a product with some variants (we have 6 variants)
- Save multiple edits
- Open an old revision
- Variants field is empty, even if that revision had variants originally
Expected behavior
That it opens a revision with the variants that were saved for that revision
Actual behavior
It opens the revision, but without any variants
Craft CMS version
Craft Pro 5.4.8
Craft Commerce version
5.1.3
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
@gopeter we have a fix forthcoming for this, will update you soon!
This should be fixed as of Craft Commerce 5.2.2.
Thanks!