cms icon indicating copy to clipboard operation
cms copied to clipboard

[4.x]: Can't apply project config

Open CMeldgaard opened this issue 3 years ago • 4 comments

What happened?

Description

When i'm applying the project config changes on the production site, but the errorresponse is not helpfull in any way image

I can easily run "Reapply everything" locally, but not on production

Craft CMS version

4.3.3

PHP version

8.1.12

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

CMeldgaard avatar Nov 23 '22 12:11 CMeldgaard

Hi, thanks for reaching out. I think we're going to need a bit more info to have a chance to get to the bottom of this one.

On production are you trying to apply some changes that you've just pushed, or are you trying to "Reapply everything"?

Is there anything in the logs storage/logs/web.* that could shed some more light on this?

i-just avatar Nov 23 '22 13:11 i-just

Hi, i have tried both approaches - both gives this result.

It looks like it's an issue with fields it's trying to remove, but they reference something that already is delete - could it has something to do with the order in which the config gets applied.

2022-11-23 11:41:04 [web.ERROR] [yii\db\IntegrityException] SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`cobedk`.`anselImages`, CONSTRAINT `anselImages_fieldId_fk` FOREIGN KEY (`fieldId`) REFERENCES `fields` (`id`)) The SQL being executed was: DELETE FROM `fields` WHERE `id`=75 {"memory":16376408,"exception":"[object] (yii\\db\\IntegrityException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`cobedk`.`anselImages`, CONSTRAINT `anselImages_fieldId_fk` FOREIGN KEY (`fieldId`) REFERENCES `fields` (`id`))\nThe SQL being executed was: DELETE FROM `fields` WHERE `id`=75 at /var/www/vhosts/cobe.dk/web/craft/vendor/yiisoft/yii2/db/Schema.php:676)\n[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`cobedk`.`anselImages`, CONSTRAINT `anselImages_fieldId_fk` FOREIGN KEY (`fieldId`) REFERENCES `fields` (`id`)) at /var/www/vhosts/cobe.dk/web/craft/vendor/yiisoft/yii2/db/Command.php:1302)"} 

CMeldgaard avatar Nov 24 '22 11:11 CMeldgaard

Thanks for getting back to me. The order of things is taken into consideration with project config.

Would you be able to send your composer.json, composer.lock, pre-changes database and project config folder (config/project) you're trying to apply to [email protected], so that we can have a better look at what's going on? Info on your database type and version would also be appreciated.

i-just avatar Nov 24 '22 13:11 i-just

Same here cannot reapply everything, same message

stephanedemotte avatar Nov 07 '23 19:11 stephanedemotte