craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
226 stars 170 forks source link

m170830_130000_order_refactor fails after upgrade from Commerce 1 to 2 #1576

Closed RitterKnightCreative closed 4 years ago

RitterKnightCreative commented 4 years ago

Description Getting a migration error when upgrading an old Commerce 1 / Craft 2 install to Craft 3/Commerce 2.

To Reproduce

  1. Setup Craft 2 install on Craft 3. Point it to CP to start upgrade via web GUI.
  2. The initial C2 to C3 database upgrade works.
  3. Craft wants to upgrade again, I assume it's Commerce's migrations
  4. Upgrade fails with duplicate column name.

Expected behavior Migration succeeds.

Additional info

Dump below

The SQL being executed was: ALTER TABLE craft_commerce_orderadjustments ADD lineItemId int(11)

Migration: craft\commerce\migrations\m170830_130000_order_refactor

Output:

> add column lineItemId integer to table {{%commerce_orderadjustments}} ...Exception: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'lineItemId'
The SQL being executed was: ALTER TABLE craft_commerce_orderadjustments ADD lineItemId int(11) (/site/vendor/yiisoft/yii2/db/Schema.php:674)
#0 /site/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE cr...')
#1 /site/vendor/yiisoft/yii2/db/Command.php(1093): yii\db\Command->internalExecute('ALTER TABLE cr...')
#2 /site/vendor/yiisoft/yii2/db/Migration.php(377): yii\db\Command->execute()
#3 /site/vendor/craftcms/commerce/src/migrations/m170830_130000_order_refactor.php(26): yii\db\Migration->addColumn('{{%commerce_ord...', 'lineItemId', Object(craft\db\mysql\ColumnSchemaBuilder))
#4 /site/vendor/craftcms/cms/src/db/Migration.php(52): craft\commerce\migrations\m170830_130000_order_refactor->safeUp()
#5 /site/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#6 /site/vendor/craftcms/cms/src/db/MigrationManager.php(153): craft\db\MigrationManager->migrateUp(Object(craft\commerce\migrations\m170830_130000_order_refactor))
#7 /site/vendor/craftcms/cms/src/services/Updates.php(233): craft\db\MigrationManager->up()
#8 /site/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(510): craft\services\Updates->runMigrations(Array)
#9 /site/vendor/craftcms/cms/src/controllers/pluginstore/InstallController.php(118): craft\controllers\BaseUpdaterController->runMigrations(Array)
#10 [internal function]: craft\controllers\pluginstore\InstallController->actionMigrate()
#11 /site/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /site/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /site/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('migrate', Array)
#14 /site/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('migrate', Array)
#15 /site/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('pluginstore/ins...', Array)
#16 /site/vendor/craftcms/cms/src/web/Application.php(646): craft\web\Application->runAction('pluginstore/ins...')
#17 /site/vendor/craftcms/cms/src/web/Application.php(243): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#18 /site/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /site/web/index.php(21): yii\base\Application->run()
#20 {main}
lukeholder commented 4 years ago

From the error, it looks like your original migration failed, and you tried it again. Could you start from your original database backup and try again then send us the log to see what the original error was? Please send to support@craftcms.com

Thanks