craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
220 stars 170 forks source link

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

Open gopeter opened 3 hours ago

gopeter commented 3 hours ago

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

linear[bot] commented 3 hours ago

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