Closed jmauzyk closed 1 year ago
Thanks for reporting that! I wasn’t able to reproduce on Postgres, but we just released Craft 4.4.1 which includes a change to that migration which should fix this for you. Can you please try updating to 4.4.1 and see if it solves the issue?
@brandonkelly that did the trick, thanks!
Excellent, thanks for letting me know!
Hello, I'm also stuck at this particular migration with the following error:
*** applying m221027_160703_add_image_transform_fill
> add column fill string(11) NULL DEFAULT NULL to table {{%imagetransforms}} ... done (time: 0.004s)
> add column upscale boolean NOT NULL DEFAULT TRUE to table {{%imagetransforms}} ... done (time: 0.001s)
> execute SQL: alter table {{%imagetransforms}} drop constraint if exists {{%imagetransforms_mode_check}} ... done (time: 0.001s)
> execute SQL: alter table {{%imagetransforms}} drop constraint if exists {{%assettransforms_mode_check}} ... done (time: 0.001s)
> execute SQL: alter table {{%imagetransforms}} add check ([[mode]] in ('stretch','fit','crop','letterbox')) ...Exception: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input value for enum assettransforms_mode: "letterbox"
The SQL being executed was: alter table "imagetransforms" add check ("mode" in ('stretch','fit','crop','letterbox')) (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676)
I'm also on Postgres. Upgrading from Craft 3.8.11 to Craft 4.4.13.
Please do let me know if I can be of further assistance. Cheers!
@shoored Any chance you can send your database into support@craftcms.com?
@brandonkelly Sure thing, will sent one your way tomorrow morning.
For posterity, @shoored’s issue occurred because the database originated as MySQL and was converted to Postgres. Enum columns like imagetransforms.mode
were given a dynamic column type, rather than a check
constraint like Craft/Yii uses for enum values in Postgres.
We worked around it by ensuring the column is a varchar
type before adding the new check
constraint.
Thank you @brandonkelly for looking into this and for the workaround.
Craft 4.4.14 is out with that migration improvement.
In addition to my specific issue, here's something that might help other people.
We wrote a script that outputs all Postgres DB columns with a custom data_type along with the table it belongs to.
Then we created a custom DB migration that would alter these data_types to a varchar
type. Then the Craft 4 upgrade with 40 migrations went flawlessly.
What happened?
Description
Encountering errors when attempting to apply the m221027_160703_add_image_transform_fill migration. The install was at 4.3.11 prior to upgrading to 4.4.0, and was migrated to Craft 4 from Craft 3. The errors are as follows:
Steps to reproduce
craft migrate/all
Expected behavior
Successfully complete migration
Actual behavior
Migration fails with exit status 1
Craft CMS version
4.4.0
PHP version
8.2
Operating system and version
Linux 5.15.49-linuxkit
Database type and version
PostgreSQL 14.6
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
No response