-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Updating Doctrine migrations package #14821
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes look good to me. The Doctrine migration command works, although it outputs an error that isn't caused by this PR. This error also occurs in the 7.x branch.
Looks like there's an issue with Mautic\Migrations\Version20241212090146
.
gitpod /workspace/mautic (updating-doctrine-migrations) $ ddev exec bin/console doctrine:migrations:migrate
...
[notice] Column draft_custom_mjml already exists
[notice] Migration Mautic\Migrations\Version20240611103824 skipped during Pre-Checks. Reason: "Schema includes this migration"
[error] Migration Mautic\Migrations\Version20241212090146 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx'"
15:18:05 ERROR [mautic] Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx' (uncaught exception) at /var/www/html/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 117 while running console command `doctrine:migrations:migrate`
[stack trace]
#0 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1938): Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert()
#1 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1880): Doctrine\DBAL\Connection->handleDriverException()
#2 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1105): Doctrine\DBAL\Connection->convertExceptionDuringQuery()
#3 /var/www/html/vendor/doctrine/migrations/src/Version/DbalExecutor.php(275): Doctrine\DBAL\Connection->executeQuery()
#4 /var/www/html/vendor/doctrine/migrations/src/Version/DbalExecutor.php(152): Doctrine\Migrations\Version\DbalExecutor->executeResult()
#5 /var/www/html/vendor/doctrine/migrations/src/Version/DbalExecutor.php(72): Doctrine\Migrations\Version\DbalExecutor->executeMigration()
#6 /var/www/html/vendor/doctrine/migrations/src/DbalMigrator.php(87): Doctrine\Migrations\Version\DbalExecutor->execute()
#7 /var/www/html/vendor/doctrine/migrations/src/DbalMigrator.php(54): Doctrine\Migrations\DbalMigrator->executePlan()
#8 /var/www/html/vendor/doctrine/migrations/src/DbalMigrator.php(134): Doctrine\Migrations\DbalMigrator->executeMigrations()
#9 /var/www/html/vendor/doctrine/migrations/src/Tools/Console/Command/MigrateCommand.php(225): Doctrine\Migrations\DbalMigrator->migrate()
#10 /var/www/html/vendor/symfony/console/Command/Command.php(326): Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute()
#11 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#12 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand()
#13 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()
#14 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun()
#15 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
#16 /var/www/html/bin/console(16): Symfony\Component\Console\Application->run()
#17 {main} ["hostname" => "mautic-web","pid" => 4579]
15:18:05 CRITICAL [console] Error thrown while running command "doctrine:migrations:migrate". Message: "An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx'" ["exception" => Doctrine\DBAL\Exception\DriverException^ { …},"command" => "doctrine:migrations:migrate","message" => "An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx'"] ["hostname" => "mautic-web","pid" => 4579]
15:18:05 WARNING [mautic] Command `doctrine:migrations:migrate` exited with status code 255 ["hostname" => "mautic-web","pid" => 4579]
In ExceptionConverter.php line 117:
An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx'
In Exception.php line 28:
SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx'
In Connection.php line 71:
SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'internal_object_id_idx'
doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--no-all-or-nothing] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] [<version>]
Failed to execute command bin/console doctrine:migrations:migrate: exit status 255
gitpod /workspace/mautic (updating-doctrine-migrations) $
That's a migration I have added. I don't see any issue when looking at the code. It didn't error out on my company laptop. On my personal laptop it fails on a different migration where I see an issue:
I'll get to this tomorrow. Just wanted to make a note about this for myself. |
One of the migrations is fixed in #14824. |
With fix #14824 applied, I can confirm that the error no longer occurs and the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 7.x #14821 +/- ##
============================================
- Coverage 65.59% 65.59% -0.01%
Complexity 34908 34908
============================================
Files 2296 2296
Lines 140433 140433
============================================
- Hits 92115 92114 -1
- Misses 48318 48319 +1 🚀 New features to boost your workflow:
|
Description
This PR updates another package that is blocking updating Symfony to v7:
All the changes in this PR were generated by this command:
It output this:
Now we should be closer to updating Symfony:
📋 Steps to test this PR:
bin/console doctrine:migrations:migrate
to check that the Doctrine migration command won't fail with an error.