Skip to content

[5.x]: Craft 4 β†’ 5 m221026_105212_add_catalog_pricing_table migration fails with max_allowed_packet error.Β #4044

@joshuapease

Description

@joshuapease

What happened?

Description

πŸ˜… Our "quite large" Commerce project strikes again (700,000-ish SKUs)! We're in the process of migrating it from Craft 4 to 5.

When we hit the m221026_105212_add_catalog_pricing_table migration we get the following errors.

Image

Image

This migration works well enough locally on DDEV because our max_allowed_packet is configured to a whopping 268435456 (268-ish MB?).

On our testing servers, it's set to 67108864 (67-ish MB?).

It seems like this migration could use some better batching. It appears to be creating all 700,000 catalog pricing rows in a single query.

By adding these admittedly naive batching lines to the migration, our testing server could run the migration without a hitch.

Image

Steps to reproduce

Run m221026_105212_add_catalog_pricing_table with roughly 700k SKUs on a MySQL database with max_allowed_packet = 67108864

Craft CMS version

5.7.4

Craft Commerce version

5.3.13

PHP version

8.3

Operating system and version

No response

Database type and version

MySQL 8.0.40

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions