mautic / mautic

Mautic: Open Source Marketing Automation Software.
https://www.mautic.org
Other
6.82k stars 2.5k forks source link

Update to 5.1 - doctrine:schema:update problem #13845

Open magician7 opened 1 week ago

magician7 commented 1 week ago

Mautic Version

5.1.x series

Way of installing

I installed with composer using https://github.com/mautic/recommended-project

PHP version

8.1.29

What browsers are you seeing the problem on?

Not relevant

What happened?

When try to run bin/console doctrine:schema:update --no-interaction --force i got errors.

How can we reproduce this issue?

Edited composer.json - changing 5.0.4 to 5.1, then composer update --with-dependencies bin/console cache:clear bin/console mautic:update:apply --finish bin/console doctrine:migration:migrate --no-interaction bin/console doctrine:schema:update --no-interaction --force

Relevant log output

bin/console doctrine:schema:update --no-interaction --force

 [WARNING] Not passing the "--complete" option to "doctrine:schema:update" is deprecated and will not be supported when 
           using doctrine/dbal 4                                                                                        

 Updating database schema...

In ExceptionConverter.php line 117:

  An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP INDEX `IDX_1AE3441319EB6921`; check that it  
   exists                                                                                                                                                        

In Exception.php line 28:

  SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP INDEX `IDX_1AE3441319EB6921`; check that it exists  

In Connection.php line 33:

  SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP INDEX `IDX_1AE3441319EB6921`; check that it exists  

doctrine:schema:update [--em EM] [--complete] [--dump-sql] [-f|--force]

Code of Conduct



Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.

mautibot commented 1 week ago

This issue has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/trying-to-update-to-5-1-from-5-0-4/32361/18

uhlhosting commented 6 days ago

I got the same issue.

yet I managed to run migrate:migrate again manually still I am stuck at:

root@ma:/var/www/html/mautic# php bin/console doctrine:migration:status
+----------------------+----------------------+------------------------------------------------------------------------+
| Configuration                                                                                                        |
+----------------------+----------------------+------------------------------------------------------------------------+
| Storage              | Type                 | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |
|                      | Table Name           | migrations                                                             |
|                      | Column Name          | version                                                                |
|----------------------------------------------------------------------------------------------------------------------|
| Database             | Driver               | Doctrine\DBAL\Driver\PDO\MySQL\Driver                                  |
|                      | Name                 | uhlmautic                                                              |
|----------------------------------------------------------------------------------------------------------------------|
| Versions             | Previous             | 0                                                                      |
|                      | Current              | 0                                                                      |
|                      | Next                 | Mautic\Migrations\Version020230615115326                               |
|                      | Latest               | Mautic\Migrations\Version20230627140512                                |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 0                                                                      |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 19                                                                     |
|                      | New                  | 19                                                                     |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | Mautic\Migrations    | /var/www/html/mautic/app/migrations                                    |
+----------------------+----------------------+------------------------------------------------------------------------+
root@ma:/var/www/html/mautic# php bin/console doctrine:migration:migrate

 WARNING! You are about to execute a migration in database "uhlmautic" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 > yes

[notice] Migrating up to Mautic\Migrations\Version20230627140512
[notice] Table contact_export_scheduler already exists
[notice] Migration Mautic\Migrations\Version20220429091934 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20220722074516 skipped during Pre-Checks. Reason: "The deduplicate column has already been added to the notifications table."
[notice] Migration Mautic\Migrations\Version20221014061125 skipped during Pre-Checks. Reason: "Index webhook_id_date_added already exists"
[notice] Migration Mautic\Migrations\Version20221014081742 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20221128145933 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20230131133732 skipped during Pre-Checks. Reason: "The last_built_time column has already been added to the lead_lists table."
[warning] Migration Mautic\Migrations\Version20230311195347 was executed but did not result in any SQL statements.
[notice] Column asset_downloads.utm_campaign already exists
[notice] Column asset_downloads.utm_content already exists
[notice] Column asset_downloads.utm_medium already exists
[notice] Column asset_downloads.utm_source already exists
[notice] Column asset_downloads.utm_term already exists
[notice] Migration Mautic\Migrations\Version20230321133733 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Table plugin_crm_pipedrive_owners was already removed
[notice] Migration Mautic\Migrations\Version20230519154448 skipped during Pre-Checks. Reason: "Schema includes this migration"
[warning] Migration Mautic\Migrations\Version20230522141144 was executed but did not result in any SQL statements.
[notice] Migration is not required.
[notice] Migration Mautic\Migrations\Version20230606111852 skipped during Pre-Checks. Reason: "Schema includes this migration"
[warning] Migration Mautic\Migrations\Version20230615101328 was executed but did not result in any SQL statements.
[notice] Table point_groups already exists
[notice] Table point_group_contact_score already exists
[notice] Column points.group_id already exists
[notice] Column point_triggers.group_id already exists
[notice] Column lead_points_change_log.group_id already exists
[notice] Foreign key FK_9D85A703E7A1254A already exists in point_group_contact_score table
[notice] Foreign key FK_9D85A703FE54D947 already exists in point_group_contact_score table
[notice] Foreign key FK_27BA8E29FE54D947 already exists in points table
[notice] Foreign key FK_9CABD32FFE54D947 already exists in point_triggers table
[notice] Foreign key FK_949C2CCCFE54D947 already exists in lead_points_change_log table
[notice] Migration Mautic\Migrations\Version20230621074925 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20230627140512 skipped during Pre-Checks. Reason: "The deprecated %kernel.root_dir% is unused. Your local.php file is just fine. Skipping the migration."
[notice] finished in 4153.9ms, used 58.5M memory, 19 migrations executed, 36 sql queries

root@ma:/var/www/html/mautic# php bin/console doctrine:migration:status
+----------------------+----------------------+------------------------------------------------------------------------+
| Configuration                                                                                                        |
+----------------------+----------------------+------------------------------------------------------------------------+
| Storage              | Type                 | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |
|                      | Table Name           | migrations                                                             |
|                      | Column Name          | version                                                                |
|----------------------------------------------------------------------------------------------------------------------|
| Database             | Driver               | Doctrine\DBAL\Driver\PDO\MySQL\Driver                                  |
|                      | Name                 | uhlmautic                                                              |
|----------------------------------------------------------------------------------------------------------------------|
| Versions             | Previous             | Mautic\Migrations\Version20230525202700                                |
|                      | Current              | Mautic\Migrations\Version20230615101328                                |
|                      | Next                 | Mautic\Migrations\Version20220429091934                                |
|                      | Latest               | Mautic\Migrations\Version20230627140512                                |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 8                                                                      |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 19                                                                     |
|                      | New                  | 11                                                                     |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | Mautic\Migrations    | /var/www/html/mautic/app/migrations                                    |
+----------------------+----------------------+------------------------------------------------------------------------+
root@ma:/var/www/html/mautic# php bin/console doctrine:migration:migrate

 WARNING! You are about to execute a migration in database "uhlmautic" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 > yes

[notice] Migrating up to Mautic\Migrations\Version20230627140512
[notice] Table contact_export_scheduler already exists
[notice] Migration Mautic\Migrations\Version20220429091934 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20220722074516 skipped during Pre-Checks. Reason: "The deduplicate column has already been added to the notifications table."
[notice] Migration Mautic\Migrations\Version20221014061125 skipped during Pre-Checks. Reason: "Index webhook_id_date_added already exists"
[notice] Migration Mautic\Migrations\Version20221014081742 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20221128145933 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20230131133732 skipped during Pre-Checks. Reason: "The last_built_time column has already been added to the lead_lists table."
[notice] Column asset_downloads.utm_campaign already exists
[notice] Column asset_downloads.utm_content already exists
[notice] Column asset_downloads.utm_medium already exists
[notice] Column asset_downloads.utm_source already exists
[notice] Column asset_downloads.utm_term already exists
[notice] Migration Mautic\Migrations\Version20230321133733 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Table plugin_crm_pipedrive_owners was already removed
[notice] Migration Mautic\Migrations\Version20230519154448 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration is not required.
[notice] Migration Mautic\Migrations\Version20230606111852 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Table point_groups already exists
[notice] Table point_group_contact_score already exists
[notice] Column points.group_id already exists
[notice] Column point_triggers.group_id already exists
[notice] Column lead_points_change_log.group_id already exists
[notice] Foreign key FK_9D85A703E7A1254A already exists in point_group_contact_score table
[notice] Foreign key FK_9D85A703FE54D947 already exists in point_group_contact_score table
[notice] Foreign key FK_27BA8E29FE54D947 already exists in points table
[notice] Foreign key FK_9CABD32FFE54D947 already exists in point_triggers table
[notice] Foreign key FK_949C2CCCFE54D947 already exists in lead_points_change_log table
[notice] Migration Mautic\Migrations\Version20230621074925 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20230627140512 skipped during Pre-Checks. Reason: "The deprecated %kernel.root_dir% is unused. Your local.php file is just fine. Skipping the migration."
[notice] finished in 1200ms, used 56.5M memory, 11 migrations executed, 0 sql queries

root@ma:/var/www/html/mautic# php bin/console doctrine:migration:status
+----------------------+----------------------+------------------------------------------------------------------------+
| Configuration                                                                                                        |
+----------------------+----------------------+------------------------------------------------------------------------+
| Storage              | Type                 | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |
|                      | Table Name           | migrations                                                             |
|                      | Column Name          | version                                                                |
|----------------------------------------------------------------------------------------------------------------------|
| Database             | Driver               | Doctrine\DBAL\Driver\PDO\MySQL\Driver                                  |
|                      | Name                 | uhlmautic                                                              |
|----------------------------------------------------------------------------------------------------------------------|
| Versions             | Previous             | Mautic\Migrations\Version20230525202700                                |
|                      | Current              | Mautic\Migrations\Version20230615101328                                |
|                      | Next                 | Mautic\Migrations\Version20220429091934                                |
|                      | Latest               | Mautic\Migrations\Version20230627140512                                |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 8                                                                      |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 19                                                                     |
|                      | New                  | 11                                                                     |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | Mautic\Migrations    | /var/www/html/mautic/app/migrations                                    |
+----------------------+----------------------+------------------------------------------------------------------------+
root@ma:/var/www/html/mautic# php bin/console doctrine:migration:migrate

 WARNING! You are about to execute a migration in database "uhlmautic" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 > yes

[notice] Migrating up to Mautic\Migrations\Version20230627140512
[notice] Table contact_export_scheduler already exists
[notice] Migration Mautic\Migrations\Version20220429091934 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20220722074516 skipped during Pre-Checks. Reason: "The deduplicate column has already been added to the notifications table."
[notice] Migration Mautic\Migrations\Version20221014061125 skipped during Pre-Checks. Reason: "Index webhook_id_date_added already exists"
[notice] Migration Mautic\Migrations\Version20221014081742 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20221128145933 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20230131133732 skipped during Pre-Checks. Reason: "The last_built_time column has already been added to the lead_lists table."
[notice] Column asset_downloads.utm_campaign already exists
[notice] Column asset_downloads.utm_content already exists
[notice] Column asset_downloads.utm_medium already exists
[notice] Column asset_downloads.utm_source already exists
[notice] Column asset_downloads.utm_term already exists
[notice] Migration Mautic\Migrations\Version20230321133733 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Table plugin_crm_pipedrive_owners was already removed
[notice] Migration Mautic\Migrations\Version20230519154448 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration is not required.
[notice] Migration Mautic\Migrations\Version20230606111852 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Table point_groups already exists
[notice] Table point_group_contact_score already exists
[notice] Column points.group_id already exists
[notice] Column point_triggers.group_id already exists
[notice] Column lead_points_change_log.group_id already exists
[notice] Foreign key FK_9D85A703E7A1254A already exists in point_group_contact_score table
[notice] Foreign key FK_9D85A703FE54D947 already exists in point_group_contact_score table
[notice] Foreign key FK_27BA8E29FE54D947 already exists in points table
[notice] Foreign key FK_9CABD32FFE54D947 already exists in point_triggers table
[notice] Foreign key FK_949C2CCCFE54D947 already exists in lead_points_change_log table
[notice] Migration Mautic\Migrations\Version20230621074925 skipped during Pre-Checks. Reason: "Schema includes this migration"
[notice] Migration Mautic\Migrations\Version20230627140512 skipped during Pre-Checks. Reason: "The deprecated %kernel.root_dir% is unused. Your local.php file is just fine. Skipping the migration."
[notice] finished in 1131.4ms, used 56.5M memory, 11 migrations executed, 0 sql queries

root@ma:/var/www/html/mautic# php bin/console doctrine:migration:status
+----------------------+----------------------+------------------------------------------------------------------------+
| Configuration                                                                                                        |
+----------------------+----------------------+------------------------------------------------------------------------+
| Storage              | Type                 | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |
|                      | Table Name           | migrations                                                             |
|                      | Column Name          | version                                                                |
|----------------------------------------------------------------------------------------------------------------------|
| Database             | Driver               | Doctrine\DBAL\Driver\PDO\MySQL\Driver                                  |
|                      | Name                 | uhlmautic                                                              |
|----------------------------------------------------------------------------------------------------------------------|
| Versions             | Previous             | Mautic\Migrations\Version20230525202700                                |
|                      | Current              | Mautic\Migrations\Version20230615101328                                |
|                      | Next                 | Mautic\Migrations\Version20220429091934                                |
|                      | Latest               | Mautic\Migrations\Version20230627140512                                |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 8                                                                      |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 19                                                                     |
|                      | New                  | 11                                                                     |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | Mautic\Migrations    | /var/www/html/mautic/app/migrations                                    |
+----------------------+----------------------+------------------------------------------------------------------------+
root@ma:/var/www/html/mautic# 
uhlhosting commented 6 days ago

Meanwhile my UI in web shows still very old release of Mautic.

also regardless of the execution status of the migrations it is visible in above status, that only 8 migrations are shown as executed, available 19 and New 11, while I had 19 at first New, 8 were executed, while it failed to execute the rest 11. These issues were reported and are tied to older failed upgrades, yet were failed to be properly addressed in my previous issue.

uhlhosting commented 6 days ago

Also the fact that Next | Mautic\Migrations\Version20220429091934 s shown as a such a old date is ... showing where issues started.