Skip to content

[5.x]: Integrity constraint violation: SQLSTATE[23000]: Integrity constraint violation #4074

@Liamm3

Description

@Liamm3

What happened?

Description

When updating from Commerce 5.4.0 to 5.4.1 or 5.4.1.1 we get the following error:

Integrity constraint violation: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (db.#sql-1_e7c, CONSTRAINT fk_qfcfjpljhisnsbyzvkaackxfktauevwgwbnk FOREIGN KEY (defaultVariantId) REFERENCES elements (id) ON DELETE SET NULL)

Is there any possible way to fix this? We tried running craft gc/run and craft commerce/reset-data without any success.

Steps to reproduce

1.Update from Commerce 5.4.0 to 5.4.1

Expected behavior

Finish the update without errors.

Actual behavior

The update fails.

Craft CMS version

5.8.5

Craft Commerce version

5.4.0

PHP version

8.3

Operating system and version

No response

Database type and version

MySQL

Image driver and version

No response

Installed plugins and versions

"craftcms/ckeditor": "4.9.0",
"craftcms/cms": "5.8.5",
"craftcms/commerce": "5.4.1.1",
"craftcms/commerce-stripe": "5.1.0.1",
"mmikkel/cp-clearcache": "2.0.1",
"studioespresso/craft-dumper": "5.0.1",
"twig/string-extra": "^3.19",
"vlucas/phpdotenv": "^5.4.0"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions