Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: Error when upgrading from Commerce 4 #3488

Closed
boboldehampsink opened this issue May 7, 2024 · 7 comments
Closed

[5.x]: Error when upgrading from Commerce 4 #3488

boboldehampsink opened this issue May 7, 2024 · 7 comments

Comments

@boboldehampsink
Copy link
Contributor

What happened?

Description

When upgrading from Commerce 4, while using the fix in #3486 to boot this on Postgres, I see the following error:

...
web-1  | *** applying m221122_055725_multi_store
web-1  |     > create table {{%commerce_storesettings}} ... done (time: 0.002s)
web-1  |     > add foreign key fk_ffmjdquysmkgdmcujclkcciweeclyswyijbf: {{%commerce_storesettings}} (id) references {{%commerce_stores}} (id) ... done (time: 0.000s)
web-1  |     > insert into {{%commerce_storesettings}} ... done (time: 0.004s)
web-1  |     > drop column locationAddressId from table {{%commerce_stores}} ... done (time: 0.000s)
web-1  |     > drop column countries from table {{%commerce_stores}} ... done (time: 0.000s)
web-1  |     > drop column marketAddressCondition from table {{%commerce_stores}} ... done (time: 0.000s)
web-1  |     > add column name string NOT NULL DEFAULT '' to table {{%commerce_stores}} ... done (time: 0.000s)
web-1  |     > add column handle string NOT NULL DEFAULT '' to table {{%commerce_stores}} ... done (time: 0.000s)
web-1  |     > add column primary boolean NOT NULL DEFAULT FALSE to table {{%commerce_stores}} ... done (time: 0.000s)
web-1  |     > update in {{%commerce_stores}} ... done (time: 0.003s)
web-1  | Exception: Undefined array key "autoSetNewCartAddresses" (/app/user/vendor/craftcms/commerce/src/services/Stores.php:385)
web-1  | #0 /app/user/vendor/craftcms/commerce/src/services/Stores.php(385): yii\base\ErrorHandler->handleError(2, 'Undefined array...', '/app/user/vendo...', 385)
web-1  | #1 /app/user/vendor/craftcms/cms/src/services/ProjectConfig.php(1177): craft\commerce\services\Stores->handleChangedStore(Object(craft\events\ConfigEvent))
web-1  | #2 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
web-1  | #3 /app/user/vendor/yiisoft/yii2/base/Component.php(633): call_user_func(Array, Object(craft\events\ConfigEvent))
web-1  | #4 /app/user/vendor/craftcms/cms/src/models/ProjectConfigData.php(82): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
web-1  | #5 /app/user/vendor/craftcms/cms/src/services/ProjectConfig.php(564): craft\models\ProjectConfigData->commitChanges(NULL, Array, 'commerce.stores...', true, 'Migration creat...', true)
...

Steps to reproduce

Upgrade from Commerce 4

Craft CMS version

5

Craft Commerce version

5

PHP version

8.3

Operating system and version

No response

Database type and version

PostgreSQL 15.3

Image driver and version

No response

Installed plugins and versions

Copy link

linear bot commented May 7, 2024

@lukeholder
Copy link
Member

lukeholder commented May 8, 2024

@boboldehampsink can you please send me your Craft Commerce 4 DB backup, with the config/project folder, and composer.json, and composer.lock to support@craftcms.com so I can debug this. Thanks.

@lukeholder
Copy link
Member

Thanks for that. I think the issues are now fixed.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "5.x-dev#323ac6403f8a91812af074811fab37fb5e021e93 as 5.0.3",
  "...": "..."
}

Then run composer update.

I will let you know once the release is out here.

@lukeholder
Copy link
Member

5.0.5 is out and contains fixes from upgrading from 4.x

@boboldehampsink
Copy link
Contributor Author

@lukeholder got 5.0.5 and now seeing this error when upgrading:

> add column autoSetPaymentSource boolean NOT NULL DEFAULT FALSE to table {{%commerce_stores}} ...Exception: SQLSTATE[42701]: Duplicate column: 7 ERROR:  column "autoSetPaymentSource" of relation "commerce_stores" already exists
web-1  | The SQL being executed was: ALTER TABLE "commerce_stores" ADD "autoSetPaymentSource" boolean NOT NULL DEFAULT FALSE (/app/user/vendor/yiisoft/yii2/db/Schema.php:676)
web-1  | #0 /app/user/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE "co...')

@boboldehampsink
Copy link
Contributor Author

@lukeholder is this related or do I need to create a new issue?

@lukeholder
Copy link
Member

This should be fixed in 5.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants