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

[4.x]: Failed to run migration from CRAFT 3.x #12336

Closed
rajparekh-pd opened this issue Nov 17, 2022 · 6 comments
Closed

[4.x]: Failed to run migration from CRAFT 3.x #12336

rajparekh-pd opened this issue Nov 17, 2022 · 6 comments
Assignees

Comments

@rajparekh-pd
Copy link

rajparekh-pd commented Nov 17, 2022

What happened?

Description

We are trying to upgrade from craft 3.7.x to 4.3.2. We are facing this error when running the migrations.

Steps to reproduce

  1. Update the depenecies
  2. do composer upgrade
  3. Run the migrations

Expected behavior

Migrations should succeed

Actual behavior

*** applying m210724_180756_rename_source_cols
    > rename column sourceId in table {{%drafts}} to canonicalId ...Exception: SQLSTATE[0A000]: Feature not supported: 1846 ALGORITHM=COPY is not supported. Reason: Columns participating in a foreign key are renamed. Try ALGORITHM=INPLACE.
The SQL being executed was: ALTER TABLE `drafts` CHANGE `sourceId` `canonicalId` int DEFAULT NULL (/app/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /app/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE `dr...')
1 /app/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('ALTER TABLE `dr...')
2 /app/vendor/yiisoft/yii2/db/Migration.php(404): yii\db\Command->execute()
3 /app/vendor/craftcms/cms/src/migrations/m210724_180756_rename_source_cols.php(18): yii\db\Migration->renameColumn('{{%drafts}}', 'sourceId', 'canonicalId')
4 /app/vendor/craftcms/cms/src/db/Migration.php(49): craft\migrations\m210724_180756_rename_source_cols->safeUp()
5 /app/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
6 /app/vendor/craftcms/cms/src/console/controllers/MigrateController.php(360): yii\console\controllers\BaseMigrateController->migrateUp('m210724_180756_...')
7 [internal function]: craft\console\controllers\MigrateController->actionAll()
8 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
9 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
10 /app/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('all', Array)
11 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('all', Array)
12 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
13 /app/vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction('migrate/all', Array)
14 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
15 /app/vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest(Object(craft\console\Request))
16 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
17 /app/craft(21): yii\base\Application->run()
18 {main}
*** failed to apply m210724_180756_rename_source_cols (time: 0.004s)

0 from 37 migrations were applied.

Migration failed. The rest of the migrations are canceled.`

Craft CMS version

4.3.2

PHP version

8.0.24

Operating system and version

No response

Database type and version

8.0.28-14

Image driver and version

No response

Installed plugins and versions

@angrybrad
Copy link
Member

Huh... this is MySQL 8.0.28, no? Which container image or distro are you using?

Can you run the SHOW VARIABLES; SQL statement and share the output? Can send to support@craftcms.com is there are things you don't want public in there.

@rajparekh-pd
Copy link
Author

Hey, I have sent an email to support, with requested output.

@rajparekh-pd
Copy link
Author

Issue was related to old_alter_table was true. @angrybrad helped us figure out through support. Thank you. I think this issue can be closed.

@brianjhanson
Copy link
Contributor

👍 Glad you got it sorted out!

@DavidKabelitz
Copy link

Hi @angrybrad, what was the solution here? We have it also at one project

@rajparekh-pd
Copy link
Author

set old_alter_table to false in SQL config

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

4 participants