commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[5.x]: "Data too long for column ‘sku’ at row" when switching revisions

Open gopeter opened this issue 1 year ago • 2 comments
trafficstars

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

  1. Create a product with some variants (we have 6 variants)
  2. Save multiple edits
  3. Open an old revision
  4. 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 avatar Oct 16 '24 11:10 gopeter

@gopeter we have a fix forthcoming for this, will update you soon!

lukeholder avatar Oct 21 '24 12:10 lukeholder

This should be fixed as of Craft Commerce 5.2.2.

Thanks!

lukeholder avatar Nov 13 '24 08:11 lukeholder