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

Unable to pass DB migrations: Table 'point_groups' already exists #12993

Closed
1 task done
uhlhosting opened this issue Dec 6, 2023 · 51 comments · Fixed by #13195
Closed
1 task done

Unable to pass DB migrations: Table 'point_groups' already exists #12993

uhlhosting opened this issue Dec 6, 2023 · 51 comments · Fixed by #13195
Labels
bug Issues or PR's relating to bugs db-migrations

Comments

@uhlhosting
Copy link

Mautic Version

5.0.x series

PHP version

8.1.26

What browsers are you seeing the problem on?

Not relevant

What happened?

Unable to pass DB migrations

How can we reproduce this issue?

Step 1: php bin/console doctrine:migration:migrate

Relevant log output

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
[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists"

In ExceptionConverter.php line 45:
                                                                                                                                               
  An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists  
                                                                                                                                               

In Exception.php line 28:
                                                                                                
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists  
                                                                                                

In Connection.php line 71:
                                                                                                
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists  
                                                                                                

doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] [<version>]

root@ma:/var/www/html/mautic#

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct
@uhlhosting uhlhosting added bug Issues or PR's relating to bugs needs-triage For new issues/PRs that need to be triaged labels Dec 6, 2023
@uhlhosting uhlhosting changed the title Your bug title goes here! Unable to pass DB migrations Dec 23, 2023
@escopecz
Copy link
Sponsor Member

escopecz commented Jan 9, 2024

@patrykgruszka could you please take a look? It seems that it's coming from Version20230621074925

@escopecz escopecz added db-migrations and removed needs-triage For new issues/PRs that need to be triaged labels Jan 9, 2024
@patrykgruszka
Copy link
Member

It looks like this migration has failed to create the foreign keys. I'm afraid I don't know why, because the error occurred in the previous run and it's not in the log you posted.

@uhlhosting you can add the missing keys manually:

  1. Run command to view the queries: php bin/console doctrine:migrations:execute --up "Mautic\\\Migrations\\\Version20230621074925" --dry-run --write-sql -vv
  2. Manually add the missing constraints, it should be something like this:
ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703E7A1254A` FOREIGN KEY (`contact_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE 
ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703FE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
ALTER TABLE `points` ADD CONSTRAINT `FK_27BA8E29FE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
ALTER TABLE `point_triggers` ADD CONSTRAINT `FK_9CABD32FFE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
ALTER TABLE `lead_points_change_log` ADD CONSTRAINT `FK_949C2CCCFE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE

@escopecz I wonder how could we avoid a problems like this, when migrations are partially executed. Maybe we could execute each query conditionally, but I'm not sure that's a good approach.

@escopecz
Copy link
Sponsor Member

escopecz commented Jan 9, 2024

We've added the skipAssertion checks to our migrations. Like https://github.com/mautic/mautic/blob/5.x/app/migrations/Version20230522141144.php#L14. It makes more sense if there are more queries to execute. But it was mostly to ensure all queries are executed and not silently skipped during our release process.

Another approach is to split the alter tables into multiple migrations.

@uhlhosting
Copy link
Author

uhlhosting commented Jan 9, 2024

@patrykgruszka

Thanks for the follow up, I have made some attempts in past to recover from that, It could be maybe useful for me to know why I cannot apply the remaining upgrades.

right now I got this: https://bin.uhl.cloud/?a21fbb0795b63b3c#2szrGX82hnEHdJPX1qD7ChQ9Z1SGi3uVfmUZ7e9wAmum

Anyhow I tried running first CLI in MYSQL, got:

Database changed
MariaDB [uhlmautic]> ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703E7A1254A` FOREIGN KEY (`contact_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE;
ERROR 1005 (HY000): Can't create table `uhlmautic`.`point_group_contact_score` (errno: 121 "Duplicate key on write or update")

I still do not know for certainty how to apply all migrations and be up to date from this point on. Any advice is welcomed.

@escopecz
Copy link
Sponsor Member

@uhlhosting can you confirm that you've run the migrations once, it failed on something and then when you run it again this error happens? If so, what was the first error?

@uhlhosting
Copy link
Author

It is all explained in this issue. All previous and current status and errors. Check the bin link please.

@escopecz
Copy link
Sponsor Member

I the bin link you are trying to execute a specific migration and it's replying it doesn't exist. Try to run it with

php bin/console doctrine:migrations:execute 'Mautic\Migrations\Version20230621074925' --dry-run --write-sql -vv

Then you are checking status, listing migration commands and executing migrations that are all passing. I think you are good to go! Or is Mautic erroring out on something? Don't worry about the migration status. Are you looking at the "New" count or what's the issue?

@SayHeyD
Copy link

SayHeyD commented Jan 10, 2024

We are experiencing a similar issue when trying to upgrade from 4.4.10 to 5.0.1

PHP Version 8.0.30

[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table `marketing`.`point_group_contact_score` (errno: 150 "Foreign key constraint is incorrectly formed")"

In ExceptionConverter.php line 117:

  An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table `marketing`.`point_group_contact_score` (errno: 150 "Foreign key constraint is in
  correctly formed")


In Exception.php line 28:

  SQLSTATE[HY000]: General error: 1005 Can't create table `marketing`.`point_group_contact_score` (errno: 150 "Foreign key constraint is incorrectly formed")


In Connection.php line 70:

  SQLSTATE[HY000]: General error: 1005 Can't create table `marketing`.`point_group_contact_score` (errno: 150 "Foreign key constraint is incorrectly formed")

@escopecz escopecz changed the title Unable to pass DB migrations Unable to pass DB migrations: Table 'point_groups' already exists Jan 10, 2024
@mautibot
Copy link

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

https://forum.mautic.org/t/how-to-update-5-to-5-0-1-via-composer/30430/7

@patrykgruszka
Copy link
Member

The migration fix is ready to test in #13195

@RCheesley
Copy link
Sponsor Member

Awesome, thanks @patrykgruszka - @uhlhosting @SayHeyD please can you review the fix in #13195 and leave a review as documented here: https://contribute.mautic.org/contributing-to-mautic/tester#leaving-your-review so we can get this merged and released asap?

Many thanks for reporting & helping with troubleshooting!

@RCheesley RCheesley linked a pull request Jan 11, 2024 that will close this issue
@mautibot
Copy link

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

https://forum.mautic.org/t/mautic-upgrade-to-4-4-10-5-0-1-breaks/30440/2

@Napsty
Copy link

Napsty commented Jan 12, 2024

Ran into the same issue as mentioned here, trying to update Mautic 5.0.0-alpha1 to 5.0.1.

# php8.1 bin/console mautic:update:apply --finish
Step    1 [>---------------------------] Migrating database schema...

An error occurred while updating the database. Check log for more details.

After applying patch #13195 migration/update has worked.

# php8.1 bin/console mautic:update:apply --finish
Step    2 [============================] Success! You are now running version 5.0.1 of Mautic.

Thanks for the patch!

Note: Users not able to manually apply the match should probably wait until 5.0.2 is released.

@patrykgruszka
Copy link
Member

Thank you for the info. Could you leave a review comment in #13195? It will help us merge this faster.

@uhlhosting
Copy link
Author

uhlhosting commented Jan 14, 2024

I the bin link you are trying to execute a specific migration and it's replying it doesn't exist. Try to run it with

php bin/console doctrine:migrations:execute 'Mautic\Migrations\Version20230621074925' --dry-run --write-sql -vv

Then you are checking status, listing migration commands and executing migrations that are all passing. I think you are good to go! Or is Mautic erroring out on something? Don't worry about the migration status. Are you looking at the "New" count or what's the issue?

Hi,

this is the result:

root@ma:/var/www/html/mautic# php bin/console doctrine:migrations:execute 'Mautic\Migrations\Version20230621074925' --dry-run --write-sql -vv
[notice] Executing (dry-run) Mautic\Migrations\Version20230621074925 up
[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
[info] ++ migrating Mautic\Migrations\Version20230621074925
[debug] CREATE TABLE `point_groups`
(
    `id`                  INT UNSIGNED AUTO_INCREMENT NOT NULL,
    `is_published`        TINYINT(1)                  NOT NULL,
    `date_added`          DATETIME     DEFAULT NULL,
    `created_by`          INT          DEFAULT NULL,
    `created_by_user`     VARCHAR(191) DEFAULT NULL,
    `date_modified`       DATETIME     DEFAULT NULL,
    `modified_by`         INT          DEFAULT NULL,
    `modified_by_user`    VARCHAR(191) DEFAULT NULL,
    `checked_out`         DATETIME     DEFAULT NULL,
    `checked_out_by`      INT          DEFAULT NULL,
    `checked_out_by_user` VARCHAR(191) DEFAULT NULL,
    `name`                VARCHAR(191)                NOT NULL,
    `description`         LONGTEXT     DEFAULT NULL,
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4
  COLLATE `utf8mb4_unicode_ci`
  ENGINE = InnoDB
  ROW_FORMAT = DYNAMIC; 
[debug] CREATE TABLE `point_group_contact_score`
(
    `contact_id`          BIGINT UNSIGNED NOT NULL,
    `group_id`           INT UNSIGNED    NOT NULL,
    `score`               INT             NOT NULL,
    PRIMARY KEY (`contact_id`, `group_id`)
) DEFAULT CHARACTER SET utf8mb4
  COLLATE `utf8mb4_unicode_ci`
  ENGINE = InnoDB
  ROW_FORMAT = DYNAMIC; 
[debug] ALTER TABLE `points` ADD group_id INT UNSIGNED DEFAULT NULL 
[debug] ALTER TABLE `point_triggers` ADD group_id INT UNSIGNED DEFAULT NULL 
[debug] ALTER TABLE `lead_points_change_log` ADD group_id INT UNSIGNED DEFAULT NULL 
[debug] ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703E7A1254A` FOREIGN KEY (`contact_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE 
[debug] ALTER TABLE `point_group_contact_score` ADD CONSTRAINT `FK_9D85A703FE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
[debug] ALTER TABLE `points` ADD CONSTRAINT `FK_27BA8E29FE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
[debug] ALTER TABLE `point_triggers` ADD CONSTRAINT `FK_9CABD32FFE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
[debug] ALTER TABLE `lead_points_change_log` ADD CONSTRAINT `FK_949C2CCCFE54D947` FOREIGN KEY (`group_id`) REFERENCES `point_groups` (`id`) ON DELETE CASCADE 
[info] Migration Mautic\Migrations\Version20230621074925 migrated (took 331.2ms, used 54.5M memory)
[notice] finished in 334.8ms, used 54.5M memory, 1 migrations executed, 12 sql queries
[info] Writing migration file to "/var/www/html/mautic/doctrine_migration_20240114083426.sql"

root@ma:/var/www/html/mautic# 

only confusion starts here when i rerun migrate:

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] 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] 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 798.2ms, used 56.5M memory, 9 migrations executed, 0 sql queries

then again when I run :status:

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\Version20230615101328                                |
|                      | Current              | Mautic\Migrations\Version20230621074925                                |
|                      | Next                 | Mautic\Migrations\Version20220722074516                                |
|                      | Latest               | Mautic\Migrations\Version20230627140512                                |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 10                                                                     |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 19                                                                     |
|                      | New                  | 9                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | Mautic\Migrations    | /var/www/html/mautic/app/migrations                                    |
+----------------------+----------------------+------------------------------------------------------------------------+
root@ma:/var/www/html/mautic# 

@uhlhosting
Copy link
Author

uhlhosting commented Jan 14, 2024

The bottom line, is no matter if I run succesfully composer update / upgrade my Mautic does not bumps the version. My migration tables are clearly damaged or have some issues in a way or another, id appreciate if we can work this out.

Why is next migration one from 2022, and why. 9 more shows are missing, and then they are skipped at migration process.

root@ma:/var/www/html/mautic# php bin/console doctrine:migration:up-to-date

                                                                                                                        
 [ERROR] Out-of-date! 9 migrations are available to execute. 
 
 root@ma:/var/www/html/mautic# php bin/console doctrine:migration:list
+------------------------------------------+--------------+---------------------+----------------+-------------+
| Migration Versions                                                                             |             |
+------------------------------------------+--------------+---------------------+----------------+-------------+
| Migration                                | Status       | Migrated At         | Execution Time | Description |
+------------------------------------------+--------------+---------------------+----------------+-------------+
| Mautic\Migrations\Version020230615115326 | migrated     | 2023-12-06 00:45:17 | 0.692s         |             |
| Mautic\Migrations\Version20220216161028  | migrated     | 2023-12-06 00:45:18 | 0.019s         |             |
| Mautic\Migrations\Version20220428083702  | migrated     | 2023-12-06 00:45:18 | 0.009s         |             |
| Mautic\Migrations\Version20220429091934  | migrated     | 2023-12-06 00:28:57 | 0.195s         |             |
| Mautic\Migrations\Version20220722074516  | not migrated |                     |                |             |
| Mautic\Migrations\Version20221010121758  | migrated     | 2023-12-06 00:45:18 | 0.017s         |             |
| Mautic\Migrations\Version20221014061125  | not migrated |                     |                |             |
| Mautic\Migrations\Version20221014081742  | not migrated |                     |                |             |
| Mautic\Migrations\Version20221128145933  | not migrated |                     |                |             |
| Mautic\Migrations\Version20230131133732  | not migrated |                     |                |             |
| Mautic\Migrations\Version20230311195347  | migrated     | 2023-12-06 00:45:19 | 0s             |             |
| Mautic\Migrations\Version20230321133733  | not migrated |                     |                |             |
| Mautic\Migrations\Version20230519154448  | not migrated |                     |                |             |
| Mautic\Migrations\Version20230522141144  | migrated     | 2023-12-06 00:45:19 | 0.134s         |             |
| Mautic\Migrations\Version20230525202700  | migrated     | 2023-12-06 00:45:19 | 0.098s         |             |
| Mautic\Migrations\Version20230606111852  | not migrated |                     |                |             |
| Mautic\Migrations\Version20230615101328  | migrated     | 2023-12-06 00:45:19 | 0.001s         |             |
| Mautic\Migrations\Version20230621074925  | migrated     |                     |                |             |
| Mautic\Migrations\Version20230627140512  | not migrated |                     |                |             |
+------------------------------------------+--------------+---------------------+----------------+-------------+
root@ma:/var/www/html/mautic# 

@escopecz
Copy link
Sponsor Member

@uhlhosting is this with the changes in #13195? We'll be releasing Mautic 5.0.2 today if you don't know how to apply the change. I can see that the info in the migration:status command is confusing. But what is the actual issue? What is the error you cannot upgrade? I don't see any error in the last 2 comments from you.

If you want to dig deeper into the specific migrations, check the files. For example:

https://github.com/mautic/mautic/blob/5.x/app/migrations/Version20220722074516.php

It may not be executed because your schema already contains the change.

@uhlhosting
Copy link
Author

@escopecz hi

I tried at first my own attempts to manually run the commands inside the migration against the db. What ever happened the instance seems stuck. And not sure what to do to allow the instance to upgrade the db.

@escopecz
Copy link
Sponsor Member

Stuck how? What is the error? Can you check the logs?

@uhlhosting
Copy link
Author

The error is above, nothing else.

this is what happends when I run migrate:

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] 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] 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 798.2ms, used 56.5M memory, 9 migrations executed, 0 sql queries

@escopecz
Copy link
Sponsor Member

I'm confused. I don't see the error Base table or view already exists: 1050 Table 'point_groups' already exists anymore in your output. The output you shared is completely fine.

@uhlhosting
Copy link
Author

uhlhosting commented Jan 17, 2024

I'm confused. I don't see the error Base table or view already exists: 1050 Table 'point_groups' already exists anymore in your output. The output you shared is completely fine.

I got it now, You do miss the part that this is there because I added it manually, not the change itself. Hope this helps, was above described, must have missed it.

I did my best to explain the situation, hope this time, someone will see what I try too hard by now to explain.

@escopecz
Copy link
Sponsor Member

@uhlhosting please try to be supportive to all people who try to help you with your issue. They are doing it for free in their free time and the only intention is to help you. Please, consider that. Perhaps summarize your current state into one comment would be a good way forward.

And to be honest, I'm also confused. You say that you are getting an error from "above" yet output of the same command has changed in the following comments and the original error is gone. So I'm sorry, I do not understand what error are we solving now.

You do miss the part that this is there because I added it manually, not the change itself

What have you done manually? I'm searching for "manually" in this issue and cannot find anything that you described you've done manually.

Just so you'd understand how the migrations work; there is always a pre-check whether the migration should run or if the change that the migration is suppose to be making is already in place. All the messages in #12993 (comment) are saying that the pre-check found that the migration does not have to run because the change is already there. That's all. It's not an error. It's an information. Please, ignore it.

So again, what error are you having?

@uhlhosting
Copy link
Author

@escopecz there are no errors beside the fact that migration of DBs never fully completes as explained above.

root@ma:/var/www/html/mautic# php bin/console doctrine:migration:up-to-date

 [ERROR] Out-of-date! 9 migrations are available to execute.

This is an error to me. I cannot bypass it no matter what actions I did, and is al related to this single issue overall aand me trying to fix it ofcourse.

@uhlhosting
Copy link
Author

And any guide on how to bring my database to date. Would be really appreciated. As of now I am stuck at alpha version. And cant seem to upgrade to stable release.

@technik-kvz
Copy link

technik-kvz commented Jan 23, 2024

Hi. I have the same error after update from 4.4.11 to 5.0.2.

Site works, but migrations cannot be finished:

Migrations with migrate:

php -d memory_limit=4096M bin/console doctrine:migration:migrate --no-interaction
[2024-01-23 08:22:15]
[2024-01-23 08:22:15]
[2024-01-23 08:22:15] [WARNING] You have 183 previously executed migrations in the database that are not registered migrations.
[2024-01-23 08:22:15]
[2024-01-23 08:22:15]
[2024-01-23 08:22:15] >> (20150402000000)
[2024-01-23 08:22:15] >> (20150504000000)
[2024-01-23 08:22:15] >> (20150521000000)
[2024-01-23 08:22:15] >> (20150718000000)
[2024-01-23 08:22:15] >> (20150724000000)
[2024-01-23 08:22:15] >> (20150801000000)
[2024-01-23 08:22:15] >> (20150829000000)
[2024-01-23 08:22:15] >> (20150901000000)
[2024-01-23 08:22:15] >> (20151022000000)
[2024-01-23 08:22:15] >> (20151120000000)
[2024-01-23 08:22:15] >> (20151207000000)
[2024-01-23 08:22:15] >> (20160114000000)
[2024-01-23 08:22:15] >> (20160225000000)
[2024-01-23 08:22:15] >> (20160405000000)
[2024-01-23 08:22:15] >> (20160414000000)
[2024-01-23 08:22:15] >> (20160420000000)
[2024-01-23 08:22:15] >> (20160426000000)
[2024-01-23 08:22:15] >> (20160429000000)
[2024-01-23 08:22:15] >> (20160504000000)
[2024-01-23 08:22:15] >> (20160506000000)
[2024-01-23 08:22:15] >> (20160520000000)
[2024-01-23 08:22:15] >> (20160523000000)
[2024-01-23 08:22:15] >> (20160606000000)
[2024-01-23 08:22:15] >> (20160615000000)
[2024-01-23 08:22:15] >> (20160617000318)
[2024-01-23 08:22:15] >> (20160624032452)
[2024-01-23 08:22:15] >> (20160630000000)
[2024-01-23 08:22:15] >> (20160630000001)
[2024-01-23 08:22:15] >> (20160630000002)
[2024-01-23 08:22:15] >> (20160712000000)
[2024-01-23 08:22:15] >> (20160712000001)
[2024-01-23 08:22:15] >> (20160719000000)
[2024-01-23 08:22:15] >> (20160720000000)
[2024-01-23 08:22:15] >> (20160722000000)
[2024-01-23 08:22:15] >> (20160725161822)
[2024-01-23 08:22:15] >> (20160726000000)
[2024-01-23 08:22:15] >> (20160726000001)
[2024-01-23 08:22:15] >> (20160728000000)
[2024-01-23 08:22:15] >> (20160731000000)
[2024-01-23 08:22:15] >> (20160805000123)
[2024-01-23 08:22:15] >> (20160808000000)
[2024-01-23 08:22:15] >> (20160916000000)
[2024-01-23 08:22:15] >> (20160919204648)
[2024-01-23 08:22:15] >> (20160920195943)
[2024-01-23 08:22:15] >> (20160926000000)
[2024-01-23 08:22:15] >> (20160926000001)
[2024-01-23 08:22:15] >> (20160926182807)
[2024-01-23 08:22:15] >> (20161004080958)
[2024-01-23 08:22:15] >> (20161004090629)
[2024-01-23 08:22:15] >> (20161004123446)
[2024-01-23 08:22:15] >> (20161024162029)
[2024-01-23 08:22:15] >> (20161026110456)
[2024-01-23 08:22:15] >> (20161026202839)
[2024-01-23 08:22:15] >> (20161031134707)
[2024-01-23 08:22:15] >> (20161116195435)
[2024-01-23 08:22:15] >> (20161122172519)
[2024-01-23 08:22:15] >> (20161122215214)
[2024-01-23 08:22:15] >> (20161123225456)
[2024-01-23 08:22:15] >> (20161124145649)
[2024-01-23 08:22:15] >> (20161125002837)
[2024-01-23 08:22:15] >> (20161222183556)
[2024-01-23 08:22:15] >> (20170106102310)
[2024-01-23 08:22:15] >> (20170108012944)
[2024-01-23 08:22:15] >> (20170109025947)
[2024-01-23 08:22:15] >> (20170113015255)
[2024-01-23 08:22:15] >> (20170113143922)
[2024-01-23 08:22:15] >> (20170127205928)
[2024-01-23 08:22:15] >> (20170216221648)
[2024-01-23 08:22:15] >> (20170303000000)
[2024-01-23 08:22:15] >> (20170323111702)
[2024-01-23 08:22:15] >> (20170324112219)
[2024-01-23 08:22:15] >> (20170330165232)
[2024-01-23 08:22:15] >> (20170404173451)
[2024-01-23 08:22:15] >> (20170405194627)
[2024-01-23 08:22:15] >> (20170410210055)
[2024-01-23 08:22:15] >> (20170420122443)
[2024-01-23 08:22:15] >> (20170429092049)
[2024-01-23 08:22:15] >> (20170503143650)
[2024-01-23 08:22:15] >> (20170506144649)
[2024-01-23 08:22:15] >> (20170515222314)
[2024-01-23 08:22:15] >> (20170516000000)
[2024-01-23 08:22:15] >> (20170517091309)
[2024-01-23 08:22:15] >> (20170607150241)
[2024-01-23 08:22:15] >> (20170607155015)
[2024-01-23 08:22:15] >> (20170621081811)
[2024-01-23 08:22:15] >> (20170621082116)
[2024-01-23 08:22:15] >> (20170628191405)
[2024-01-23 08:22:15] >> (20170725155053)
[2024-01-23 08:22:15] >> (20170728110351)
[2024-01-23 08:22:15] >> (20170810120452)
[2024-01-23 08:22:15] >> (20170829081048)
[2024-01-23 08:22:15] >> (20170906161951)
[2024-01-23 08:22:15] >> (20170923014659)
[2024-01-23 08:22:15] >> (20170926105027)
[2024-01-23 08:22:15] >> (20170928132035)
[2024-01-23 08:22:15] >> (20171024153459)
[2024-01-23 08:22:15] >> (20171027134920)
[2024-01-23 08:22:15] >> (20171031164327)
[2024-01-23 08:22:15] >> (20171208130606)
[2024-01-23 08:22:15] >> (20180105090000)
[2024-01-23 08:22:15] >> (20180117141613)
[2024-01-23 08:22:15] >> (20180201184933)
[2024-01-23 08:22:15] >> (20180220212444)
[2024-01-23 08:22:15] >> (20180329185634)
[2024-01-23 08:22:15] >> (20180329200949)
[2024-01-23 08:22:15] >> (20180404185715)
[2024-01-23 08:22:15] >> (20180406233027)
[2024-01-23 08:22:15] >> (20180410101632)
[2024-01-23 08:22:15] >> (20180419145934)
[2024-01-23 08:22:15] >> (20180507150753)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:08 (20180508202930)
[2024-01-23 08:22:15] >> (20180515082957)
[2024-01-23 08:22:15] >> (20180516201301)
[2024-01-23 08:22:15] >> (20180516211256)
[2024-01-23 08:22:15] >> (20180604000000)
[2024-01-23 08:22:15] >> (20180622152140)
[2024-01-23 08:22:15] >> (20180625222654)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:09 (20180702014364)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:09 (20180702014365)
[2024-01-23 08:22:15] >> (20180702145735)
[2024-01-23 08:22:15] >> (20180722100755)
[2024-01-23 08:22:15] >> (20180730070549)
[2024-01-23 08:22:15] >> (20180801081855)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:09 (20180821144204)
[2024-01-23 08:22:15] >> (20180829202029)
[2024-01-23 08:22:15] >> (20180830004341)
[2024-01-23 08:22:15] >> (20180906165938)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:09 (20180921144421)
[2024-01-23 08:22:15] >> (20180924120832)
[2024-01-23 08:22:15] >> (20180924120833)
[2024-01-23 08:22:15] >> (20180924120834)
[2024-01-23 08:22:15] >> (20181004211855)
[2024-01-23 08:22:15] >> (20181008234543)
[2024-01-23 08:22:15] >> (20181011150000)
[2024-01-23 08:22:15] >> (20181017154600)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:26 (20181111095447)
[2024-01-23 08:22:15] >> (20181128122944)
[2024-01-23 08:22:15] >> (20181129105419)
[2024-01-23 08:22:15] >> (20181204000000)
[2024-01-23 08:22:15] >> (20190704154940)
[2024-01-23 08:22:15] >> (20190715065013)
[2024-01-23 08:22:15] >> (20190724110039)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:10 (20191017140848)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:26 (20191126093923)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:10 (20191206113956)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:28 (20191219155630)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:30 (20200211095409)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:32 (20200212141530)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:33 (20200220172041)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:35 (20200227110431)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:36 (20200302164801)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:11 (20200331160919)
[2024-01-23 08:22:15] >> 2022-02-02 13:10:02 (20200409102100)
[2024-01-23 08:22:15] >> 2020-07-28 07:18:38 (20200422144300)
[2024-01-23 08:22:15] >> 2022-02-02 13:10:02 (20200507122854)
[2024-01-23 08:22:15] >> 2022-02-02 13:10:03 (20200729170800)
[2024-01-23 08:22:15] >> 2020-10-28 10:21:26 (20200805185714)
[2024-01-23 08:22:15] >> 2021-11-15 11:39:47 (20200810153131)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:10 (20200812180900)
[2024-01-23 08:22:15] >> 2020-10-28 10:21:26 (20200815153711)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:11 (20200924080139)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:11 (20201015084627)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:11 (20201102120710)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:11 (20201102133546)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:12 (20201105120328)
[2024-01-23 08:22:15] >> 2022-02-02 13:10:03 (20201120122846)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:10 (20201123070813)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:10 (20201125155904)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:12 (20201130201631)
[2024-01-23 08:22:15] >> 2021-11-15 11:39:47 (20201207114926)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:12 (20201207140911)
[2024-01-23 08:22:15] >> 2021-11-15 11:39:47 (20201228041109)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:13 (20210104171005)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:10 (20210203143600)
[2024-01-23 08:22:15] >> 2021-06-07 07:13:13 (20210223174702)
[2024-01-23 08:22:15] >> 2021-11-15 11:39:47 (20210502162314)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:10 (20210520100503)
[2024-01-23 08:22:15] >> 2021-11-15 11:39:47 (20210609191822)
[2024-01-23 08:22:15] >> 2021-11-15 11:39:47 (20210614151138)
[2024-01-23 08:22:15] >> 2022-02-02 13:10:03 (20210623071326)
[2024-01-23 08:22:15] >> 2022-03-01 13:06:10 (20220111202917)
[2024-01-23 08:22:15] >> 2024-01-19 07:53:22 (20230519081315)
[2024-01-23 08:22:15] >> 2024-01-19 07:53:22 (20230522115137)
[2024-01-23 08:22:15] [notice] Migrating up to Mautic\Migrations\Versionzz20230929183000
[2024-01-23 08:22:15] [notice] Table contact_export_scheduler already exists
[2024-01-23 08:22:15] [notice] Migration Mautic\Migrations\Version20220429091934 skipped during Pre-Checks. Reason: "Schema includes this migration"
[2024-01-23 08:22:15] [notice] Migration Mautic\Migrations\Version20221128145933 skipped during Pre-Checks. Reason: "Schema includes this migration"
[2024-01-23 08:22:15] [notice] Table plugin_citrix_events already exists
[2024-01-23 08:22:15] [notice] Migration Mautic\Migrations\Version20230522141144 skipped during Pre-Checks. Reason: "Schema includes this migration"
[2024-01-23 08:22:15] [notice] Migration is not required.
[2024-01-23 08:22:15] [notice] Migration Mautic\Migrations\Version20230606111852 skipped during Pre-Checks. Reason: "Schema includes this migration"
[2024-01-23 08:22:15] [notice] Table point_groups already exists
[2024-01-23 08:22:15] [notice] Table point_group_contact_score already exists
[2024-01-23 08:22:15] [notice] Column points.group_id already exists
[2024-01-23 08:22:15] [notice] Column point_triggers.group_id already exists
[2024-01-23 08:22:15] [notice] Column lead_points_change_log.group_id already exists
[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists"

In ExceptionConverter.php line 45:

An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists

In Exception.php line 28:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists

In Connection.php line 71:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists

doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] []

Only the 20230621074925 --down

/php -d memory_limit=4096M bin/console doctrine:migration:execute 'Mautic\Migrations\Version20230621074925' --down

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

[notice] Executing Mautic\Migrations\Version20230621074925 down
[notice] finished in 356.5ms, used 58.5M memory, 1 migrations executed, 5 sql queries

Only the 20230621074925 --up

php -d memory_limit=4096M bin/console doctrine:migration:execute 'Mautic\Migrations\Version20230621074925' --up

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

[notice] Executing Mautic\Migrations\Version20230621074925 up
[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table mauticbeta.point_group_contact_score (errno: 150 "Foreign key constraint is incorrectly formed")"

In ExceptionConverter.php line 117:

An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table mauticbeta.point_group_contact_score (errno: 150 "Foreign key constraint is incorrectly formed")

In Exception.php line 28:

SQLSTATE[HY000]: General error: 1005 Can't create table mauticbeta.point_group_contact_score (errno: 150 "Foreign key constraint is incorrectly formed")

In Connection.php line 71:

SQLSTATE[HY000]: General error: 1005 Can't create table mauticbeta.point_group_contact_score (errno: 150 "Foreign key constraint is incorrectly formed")

doctrine:migrations:execute [--write-sql [WRITE-SQL]] [--dry-run] [--up] [--down] [--query-time] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] ...

Again only the 20230621074925 --up

php -d memory_limit=4096M bin/console doctrine:migration:execute 'Mautic\Migrations\Version20230621074925' --up

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

[notice] Executing Mautic\Migrations\Version20230621074925 up
[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
[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists"

In ExceptionConverter.php line 45:

An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists

In Exception.php line 28:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists

In Connection.php line 71:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'point_groups' already exists

doctrine:migrations:execute [--write-sql [WRITE-SQL]] [--dry-run] [--up] [--down] [--query-time] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] ...

Site runs:

mautic5_s_sysinfo

@saschafoerster
Copy link

Might it have something to do with "prefixes"? My tables have prefixes and I am not sure if this is respected in the migration.
And I get the same error as here:
#9718 (comment)

mautic# php bin/console doctrine:migration:migrate

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

                                                                                                                        
 [WARNING] You have 183 previously executed migrations in the database that are not registered migrations.              
                                                                                                                        

 >>  (20150402000000)
 >>  (20150504000000)
 >>  (20150521000000)
 >>  (20150718000000)
 >>  (20150724000000)
 >>  (20150801000000)
 >>  (20150829000000)
 >>  (20150901000000)
 >>  (20151022000000)
 >>  (20151120000000)
 >>  (20151207000000)
 >>  (20160114000000)
 >>  (20160225000000)
 >>  (20160405000000)
 >>  (20160414000000)
 >>  (20160420000000)
 >>  (20160426000000)
 >>  (20160429000000)
 >>  (20160504000000)
 >>  (20160506000000)
 >>  (20160520000000)
 >>  (20160523000000)
 >>  (20160606000000)
 >>  (20160615000000)
 >>  (20160617000318)
 >>  (20160624032452)
 >>  (20160630000000)
 >>  (20160630000001)
 >>  (20160630000002)
 >>  (20160712000000)
 >>  (20160712000001)
 >>  (20160719000000)
 >>  (20160720000000)
 >>  (20160722000000)
 >>  (20160725161822)
 >>  (20160726000000)
 >>  (20160726000001)
 >>  (20160728000000)
 >>  (20160731000000)
 >>  (20160805000123)
 >>  (20160808000000)
 >>  (20160916000000)
 >>  (20160919204648)
 >>  (20160920195943)
 >>  (20160926000000)
 >>  (20160926000001)
 >>  (20160926182807)
 >>  (20161004080958)
 >>  (20161004090629)
 >>  (20161004123446)
 >>  (20161024162029)
 >>  (20161026110456)
 >>  (20161026202839)
 >>  (20161031134707)
 >>  (20161116195435)
 >>  (20161122172519)
 >>  (20161122215214)
 >>  (20161123225456)
 >>  (20161124145649)
 >>  (20161125002837)
 >>  (20161222183556)
 >>  (20170106102310)
 >>  (20170108012944)
 >>  (20170109025947)
 >>  (20170113015255)
 >>  (20170113143922)
 >>  (20170127205928)
 >>  (20170216221648)
 >>  (20170303000000)
 >>  (20170323111702)
 >>  (20170324112219)
 >>  (20170330165232)
 >>  (20170404173451)
 >>  (20170405194627)
 >>  (20170410210055)
 >>  (20170420122443)
 >>  (20170429092049)
 >>  (20170503143650)
 >>  (20170506144649)
 >>  (20170515222314)
 >>  (20170516000000)
 >>  (20170517091309)
 >>  (20170607150241)
 >>  (20170607155015)
 >>  (20170621081811)
 >>  (20170621082116)
 >>  (20170628191405)
 >>  (20170725155053)
 >>  (20170728110351)
 >>  (20170810120452)
 >>  (20170829081048)
 >>  (20170906161951)
 >>  (20170923014659)
 >>  (20170926105027)
 >>  (20170928132035)
 >>  (20171024153459)
 >>  (20171027134920)
 >>  (20171031164327)
 >>  (20171208130606)
 >>  (20180105090000)
 >>  (20180117141613)
 >>  (20180201184933)
 >>  (20180220212444)
 >>  (20180329185634)
 >>  (20180329200949)
 >>  (20180404185715)
 >>  (20180406233027)
 >>  (20180410101632)
 >>  (20180419145934)
 >>  (20180507150753)
 >> 2021-02-24 16:42:29 (20180508202930)
 >>  (20180515082957)
 >>  (20180516201301)
 >>  (20180516211256)
 >>  (20180604000000)
 >>  (20180622152140)
 >>  (20180625222654)
 >> 2022-03-01 14:05:52 (20180702014364)
 >> 2022-03-01 14:05:52 (20180702014365)
 >>  (20180702145735)
 >>  (20180722100755)
 >>  (20180730070549)
 >>  (20180801081855)
 >> 2021-02-24 16:42:29 (20180821144204)
 >>  (20180829202029)
 >>  (20180830004341)
 >>  (20180906165938)
 >> 2021-02-24 16:42:30 (20180921144421)
 >>  (20180924120832)
 >>  (20180924120833)
 >>  (20180924120834)
 >>  (20181004211855)
 >>  (20181008234543)
 >>  (20181011150000)
 >>  (20181017154600)
 >> 2020-06-30 12:42:43 (20181111095447)
 >>  (20181128122944)
 >>  (20181129105419)
 >>  (20181204000000)
 >>  (20190704154940)
 >>  (20190715065013)
 >>  (20190724110039)
 >> 2020-12-02 23:01:11 (20191017140848)
 >> 2020-06-30 12:42:43 (20191126093923)
 >> 2020-12-02 23:01:11 (20191206113956)
 >> 2020-06-30 12:42:45 (20191219155630)
 >> 2020-06-30 12:42:46 (20200211095409)
 >> 2020-06-30 12:42:47 (20200212141530)
 >> 2020-06-30 12:42:48 (20200220172041)
 >> 2020-06-30 12:42:49 (20200227110431)
 >> 2020-06-30 12:42:50 (20200302164801)
 >> 2021-02-24 16:42:30 (20200331160919)
 >> 2021-11-30 21:16:38 (20200409102100)
 >> 2020-06-30 12:42:51 (20200422144300)
 >> 2021-11-30 21:16:38 (20200507122854)
 >> 2022-01-26 22:06:17 (20200729170800)
 >> 2020-08-24 20:13:41 (20200805185714)
 >> 2021-09-04 13:17:59 (20200810153131)
 >> 2022-03-01 14:05:52 (20200812180900)
 >> 2020-08-24 20:13:41 (20200815153711)
 >> 2021-02-24 16:42:30 (20200924080139)
 >> 2020-12-25 16:10:56 (20201015084627)
 >> 2021-03-23 19:53:10 (20201102120710)
 >> 2021-03-23 19:53:10 (20201102133546)
 >> 2021-02-24 16:42:30 (20201105120328)
 >> 2021-11-30 21:16:38 (20201120122846)
 >> 2022-03-01 14:05:53 (20201123070813)
 >> 2022-03-01 14:05:53 (20201125155904)
 >> 2021-01-25 09:42:48 (20201130201631)
 >> 2021-09-04 13:17:59 (20201207114926)
 >> 2021-01-25 09:42:49 (20201207140911)
 >> 2021-09-04 13:17:59 (20201228041109)
 >> 2021-02-24 16:42:31 (20210104171005)
 >> 2022-03-01 14:05:53 (20210203143600)
 >> 2021-02-24 16:42:31 (20210223174702)
 >> 2021-09-04 13:17:59 (20210502162314)
 >> 2022-03-01 14:05:53 (20210520100503)
 >> 2021-09-04 13:17:59 (20210609191822)
 >> 2021-09-30 20:26:04 (20210614151138)
 >> 2021-11-16 09:04:26 (20210623071326)
 >> 2022-03-01 14:05:54 (20220111202917)
 >> 2023-06-15 21:22:39 (20230519081315)
 >> 2023-06-15 21:22:40 (20230522115137)

 Are you sure you wish to continue? (yes/no) [yes]:
 > yes

[notice] Migrating up to Mautic\Migrations\Versionzz20230929183000
[notice] Migration Mautic\Migrations\Version20221128145933 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"
[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table `mautic_base`.`mau_point_group_contact_score` (errno: 150 "Foreign key constraint is incorrectly formed")"

In ExceptionConverter.php line 117:
                                                                                                                                                                    
  An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table `mautic_base`.`mau_point_group_contact_score` (errno: 150  
   "Foreign key constraint is incorrectly formed")                                                                                                                  
                                                                                                                                                                    

In Exception.php line 28:
                                                                                                                                                                    
  SQLSTATE[HY000]: General error: 1005 Can't create table `mautic_base`.`mau_point_group_contact_score` (errno: 150 "Foreign key constraint is incorrectly formed"  
  )                                                                                                                                                                 
                                                                                                                                                                    

In Connection.php line 71:
                                                                                                                                                                    
  SQLSTATE[HY000]: General error: 1005 Can't create table `mautic_base`.`mau_point_group_contact_score` (errno: 150 "Foreign key constraint is incorrectly formed"  
  )                                                                                                                                                                 
                                                                                                                                                                    

doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] [<version>]

@saschafoerster
Copy link

I also tried asking ChatGPT (sorry! not sorry)

Your error indicates that the migration script is attempting to create a table mau_point_group_contact_score with a foreign key that is not being created correctly. There are a few possible reasons for this:

The referenced column in the foreign table does not exist.
The referenced column in the foreign table is not indexed.
There's a conflict with an existing foreign key.
From your migration script, it seems you have these two lines establishing the foreign keys in the table mau_point_group_contact_score:

$this->addSql("ALTER TABLE `{$this->contactScoreTableName}` ADD CONSTRAINT `{$this->contactScoreContactFk}` FOREIGN KEY (`contact_id`) REFERENCES `{$this->contactTableName}` (`id`) ON DELETE CASCADE");
$this->addSql("ALTER TABLE `{$this->contactScoreTableName}` ADD CONSTRAINT `{$this->contactScoreGroupFk}` FOREIGN KEY (`group_id`) REFERENCES `{$this->groupTableName}` (`id`) ON DELETE CASCADE");

This error might be happening because either the {$this->contactTableName} or {$this->groupTableName} does not have the primary key (id), or because the table wasn't created when the script was trying to create a foreign key.

To debug this, here's what to do:

Ensure the 'id' column of referenced tables exists: Check the tables that this migration will reference to ensure that their 'id' column exists and it's indexed (as it's normally for a primary key).
Check the order of table creation: Ensure that the tables ({$this->contactTableName} and {$this->groupTableName}) are being created before the creation of the 'contactScore' table.
Check the foreign key column type: Make sure that they are the correct type and match the referenced 'id' type. The referenced columns should be indexed, and the tables should be using the same storage engine. Both the referencing and referenced columns need to be the same exact type.
Without seeing the rest of your database schema, and particularly the 'leads' table schema and the Group::TABLE_NAME schema (presumably 'mau_point_group') schema, it's hard to give a more specific answer. But the error is very specifically an issue with how that foreign key (contact_id, group_id) is being created.

Just trying!

@saschafoerster
Copy link

And maybe this could be the error? The connected fields are not from the same data type and have different lengths:
Bildschirmfoto 2024-01-24 um 00 04 59
Bildschirmfoto 2024-01-24 um 00 04 37

@uhlhosting
Copy link
Author

@escopecz any idea as to what could keep the dbs from upgrading and passing the DB changes from the new upgrade?

@technik-kvz
Copy link

Table leads:
1 id Primary Key int(11) AUTO_INCREMENT

Table point_group_contact_score:
1 contact_id Primary Key bigint(20) UNSIGNED
2 group_id Primary Key int(10) UNSIGNED

Table point_groups:
1 id Primary Key int(10) UNSIGNED AUTO_INCREMENT

Shouldn't leads->id and contact->id be of same type?

@christopheg
Copy link
Contributor

Table leads: 1 id Primary Key int(11) AUTO_INCREMENT

Table point_group_contact_score: 1 contact_id Primary Key bigint(20) UNSIGNED 2 group_id Primary Key int(10) UNSIGNED

Table point_groups: 1 id Primary Key int(10) UNSIGNED AUTO_INCREMENT

Shouldn't leads->id and contact->id be of same type?

I can confirm this. I had the same issue. I commented out this line:
https://github.com/mautic/mautic/blob/5.x/app/migrations/Version20230621074925.php#L110
then executed the migration.
The migration should now run correctly. Afterwards, the 'contact_id' column in point_group_contact_score should be manually modified to 'int'. Then you can create the foreign key manually.

@saschafoerster
Copy link

I changed the data type in the column "contact_id" (table: mau_point_group_contact_score) from BIGINT(20) UNSIGNED to INT(11) and saved it. Then I created the foreign key in contact_id and was able to link to the column "id" in the table "leads". So, my migration has now manually finished, thanks @christopheg!

@technik-kvz
Copy link

When I delete the table point_group_contact_score (it is empty for me), the migration scripts recreate it, but still the type of contact_id is wrong.

I think a "manual change auf column type" is not the right solution. Will there be a fix in the database schema?

@christopheg
Copy link
Contributor

When I delete the table point_group_contact_score (it is empty for me), the migration scripts recreate it, but still the type of contact_id is wrong.

I think a "manual change auf column type" is not the right solution. Will there be a fix in the database schema?

I'm not stating that my solution is good. It is a fix that could help people with a broken upgrade. A proper fix in the migration needs to be created by one of the developers.
I think this line:
https://github.com/mautic/mautic/blob/5.x/app/migrations/Version20230621074925.php#L97C27-L97C43
should be replaced from
contact_id BIGINT UNSIGNED NOT NULL,
to
contact_id INT NOT NULL,

@escopecz
Copy link
Sponsor Member

@patrykgruszka could you please take another look? The thing is that Mautic instances created before Mautic 3 were using INT signed for contact IDs and after M3 it was changed to BIGING unsigned as it should be. We are dealing with it in our migrations like this:

        $leadsTableName  = $this->getPrefixedTableName('leads');
        $contactTable    = $schema->getTable($leadsTableName);
        $contactIdColumn = $contactTable->getColumn('id');
        $contactIdType   = $contactIdColumn->getType() instanceof BigIntType ? 'BIGINT UNSIGNED' : 'INT';

And then in the CREATE TABLE statement we use the right type for the database: contact_id {$contactIdType} DEFAULT NULL,

@christopheg
Copy link
Contributor

@escopecz : As far as I can see, this was not taken into account in this migration. See here:

https://github.com/mautic/mautic/blob/5.x/app/migrations/Version20230621074925.php#L95-L104

If I understand your code correctly, you look at the type of the 'id' column in 'leads' to see what type it is and then use the same type to make any new table.
Wouldn't it make more sense to grab every opportunity to make sure the column is in the type you want it to be? If the migration would be fixed like this, you not only end up with a leads-table that has an undesirable Id field, but now also the point_group_contact_score table has taken over this same field type for its foreign key...
So before the migration you had 1 thing that should have been modified, after this migration you'll have 2...

@escopecz
Copy link
Sponsor Member

@christopheg it's not that simple. If you change the type in the leads table then you'll have to change it in ~20 other tables that use the lead.id column as foreign key. That's why there was no migration to fix this when this was introduced in M3. We'd have to remove all foreign keys in all tables, update the types and then add them back. But this is very risky if the Mautic instance is still accepting data modifications and it could take hours or days to finish for big databases.

With M6 the installation will probably be just through Composer so users will have to switch to the new schema along the migration to Composer so that should fix that.

@uhlhosting
Copy link
Author

@escopecz any ideas how I can push my mautic to fix the upgrade of DBs and pass the above explained error?

@escopecz
Copy link
Sponsor Member

If you mean this error: #12993 (comment)

then it's not an error. It's just an information. Don't worry about it.

If you need to learn more, then Mautic installs database schema from the Doctrine entities directly. But a migration is created for the users that are upgrading from previous versions. So there are some migrations that your Mautic installation does not need because the change was already present when you installed Mautic.

So the "error" you are referring to is just an information that some migrations will not execute because the changes are already there.

If you think this is way too confusing then please sponsor a developer to hide them somehow. This doesn't get priority from me as there are millions of more pressing issues that need attention.

If you still have another problem then please create a new issue for this. I'm confused with the comments above. I believe the original error has been fixed and released so I'm closing this issue.

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If this issue is continuing with the lastest stable version of Mautic, please open a new issue that references this one.

@technik-kvz
Copy link

technik-kvz commented Jan 29, 2024

But we still have an issue here, since the db field types don't match, this could lead to future problems.

Fixing a foreign key of unsigned pointing to signed int is not just an optional migrition, I think. This not only happens on migration, but also when you delete the (for me) empty tables and let mautic recreate it.

@escopecz
Copy link
Sponsor Member

This issue was reporting this error: Table 'point_groups' already exists. This error is solved, isn't it? As I suggested, if there are more problems, please create a dedicated GitHub issue for it. Let's not solve all Mautic's problems in 1 issue.

@technik-kvz
Copy link

OK

@uhlhosting
Copy link
Author

uhlhosting commented Jan 30, 2024

@escopecz what you refused to see again is that if it is all alright, tell me why my Mautic shows the version prior to upgrade in the UI, not the newer one that according to you I should ignore the ERROR message, yet to me something is fishy since I cannot see the new release I supposedly just upgraded to. Isn't that a bit of an issue?

See composer results bellow from upgrade/update:

Loading composer repositories with package information
Updating dependencies                                 
Lock file operations: 0 installs, 61 updates, 0 removals
  - Upgrading aws/aws-sdk-php (3.296.1 => 3.297.4)
  - Upgrading doctrine/dbal (3.7.2 => 3.8.0)
  - Upgrading doctrine/deprecations (1.1.2 => 1.1.3)
  - Upgrading doctrine/inflector (2.0.8 => 2.0.9)
  - Upgrading doctrine/orm (2.17.2 => 2.17.4)
  - Upgrading friendsofphp/php-cs-fixer (v3.46.0 => v3.48.0)
  - Upgrading giggsey/libphonenumber-for-php (8.13.27 => 8.13.29)
  - Upgrading league/flysystem (3.23.0 => 3.23.1)
  - Upgrading league/flysystem-local (3.23.0 => 3.23.1)
  - Upgrading league/mime-type-detection (1.14.0 => 1.15.0)
  - Upgrading liip/test-fixtures-bundle (2.7.0 => 2.7.2)
  - Upgrading phpstan/phpstan (1.10.55 => 1.10.57)
  - Upgrading phpstan/phpstan-doctrine (1.3.54 => 1.3.59)
  - Upgrading phpunit/phpunit (9.6.15 => 9.6.16)
  - Upgrading symfony/amqp-messenger (v5.4.31 => v5.4.35)
  - Upgrading symfony/asset (v5.4.31 => v5.4.35)
  - Upgrading symfony/browser-kit (v5.4.31 => v5.4.35)
  - Upgrading symfony/cache (v5.4.34 => v5.4.35)
  - Upgrading symfony/config (v5.4.31 => v5.4.35)
  - Upgrading symfony/console (v5.4.34 => v5.4.35)
  - Upgrading symfony/css-selector (v5.4.26 => v5.4.35)
  - Upgrading symfony/dependency-injection (v5.4.34 => v5.4.35)
  - Upgrading symfony/doctrine-bridge (v5.4.34 => v5.4.35)
  - Upgrading symfony/doctrine-messenger (v5.4.34 => v5.4.35)
  - Upgrading symfony/dom-crawler (v5.4.32 => v5.4.35)
  - Upgrading symfony/dotenv (v5.4.34 => v5.4.35)
  - Upgrading symfony/error-handler (v5.4.29 => v5.4.35)
  - Upgrading symfony/event-dispatcher (v5.4.34 => v5.4.35)
  - Upgrading symfony/expression-language (v5.4.21 => v5.4.35)
  - Upgrading symfony/filesystem (v5.4.25 => v5.4.35)
  - Upgrading symfony/finder (v5.4.27 => v5.4.35)
  - Upgrading symfony/form (v5.4.33 => v5.4.35)
  - Upgrading symfony/framework-bundle (v5.4.34 => v5.4.35)
  - Upgrading symfony/http-client (v5.4.34 => v5.4.35)
  - Upgrading symfony/http-foundation (v5.4.34 => v5.4.35)
  - Upgrading symfony/http-kernel (v5.4.34 => v5.4.35)
  - Upgrading symfony/intl (v5.4.30 => v5.4.35)
  - Upgrading symfony/lock (v5.4.34 => v5.4.35)
  - Upgrading symfony/mailer (v5.4.34 => v5.4.35)
  - Upgrading symfony/messenger (v5.4.31 => v5.4.35)
  - Upgrading symfony/mime (v5.4.26 => v5.4.35)
  - Upgrading symfony/monolog-bridge (v5.4.31 => v5.4.35)
  - Upgrading symfony/phpunit-bridge (v5.4.34 => v5.4.35)
  - Upgrading symfony/process (v5.4.34 => v5.4.35)
  - Upgrading symfony/property-access (v5.4.26 => v5.4.35)
  - Upgrading symfony/redis-messenger (v5.4.34 => v5.4.35)
  - Upgrading symfony/routing (v5.4.34 => v5.4.35)
  - Upgrading symfony/security-bundle (v5.4.34 => v5.4.35)
  - Upgrading symfony/security-core (v5.4.30 => v5.4.35)
  - Upgrading symfony/security-csrf (v5.4.27 => v5.4.35)
  - Upgrading symfony/security-guard (v5.4.27 => v5.4.35)
  - Upgrading symfony/security-http (v5.4.31 => v5.4.35)
  - Upgrading symfony/stopwatch (v5.4.21 => v5.4.35)
  - Upgrading symfony/templating (v5.4.21 => v5.4.35)
  - Upgrading symfony/translation (v5.4.31 => v5.4.35)
  - Upgrading symfony/twig-bridge (v5.4.34 => v5.4.35)
  - Upgrading symfony/twig-bundle (v5.4.31 => v5.4.35)
  - Upgrading symfony/validator (v5.4.34 => v5.4.35)
  - Upgrading symfony/var-dumper (v5.4.29 => v5.4.35)
  - Upgrading symfony/web-profiler-bundle (v5.4.34 => v5.4.35)
  - Upgrading symfony/yaml (v5.4.31 => v5.4.35)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 61 updates, 0 removals
  - Downloading symfony/finder (v5.4.35)
  - Downloading symfony/stopwatch (v5.4.35)
  - Downloading symfony/console (v5.4.35)
  - Downloading symfony/filesystem (v5.4.35)
  - Downloading doctrine/deprecations (1.1.3)
  - Downloading doctrine/dbal (3.8.0)
  - Downloading symfony/process (v5.4.35)
  - Downloading symfony/event-dispatcher (v5.4.35)
  - Downloading friendsofphp/php-cs-fixer (v3.48.0)
  - Downloading symfony/http-foundation (v5.4.35)
  - Downloading league/mime-type-detection (1.15.0)
  - Downloading league/flysystem-local (3.23.1)
  - Downloading league/flysystem (3.23.1)
  - Downloading symfony/yaml (v5.4.35)
  - Downloading symfony/routing (v5.4.35)
  - Downloading symfony/var-dumper (v5.4.35)
  - Downloading symfony/error-handler (v5.4.35)
  - Downloading symfony/http-kernel (v5.4.35)
  - Downloading symfony/dependency-injection (v5.4.35)
  - Downloading symfony/config (v5.4.35)
  - Downloading symfony/cache (v5.4.35)
  - Downloading symfony/framework-bundle (v5.4.35)
  - Downloading symfony/dom-crawler (v5.4.35)
  - Downloading symfony/browser-kit (v5.4.35)
  - Downloading phpunit/phpunit (9.6.16)
  - Downloading liip/test-fixtures-bundle (2.7.2)
  - Downloading symfony/expression-language (v5.4.35)
  - Downloading symfony/validator (v5.4.35)
  - Downloading symfony/twig-bridge (v5.4.35)
  - Downloading symfony/twig-bundle (v5.4.35)
  - Downloading symfony/translation (v5.4.35)
  - Downloading symfony/templating (v5.4.35)
  - Downloading symfony/security-core (v5.4.35)
  - Downloading symfony/security-csrf (v5.4.35)
  - Downloading symfony/property-access (v5.4.35)
  - Downloading symfony/security-http (v5.4.35)
  - Downloading symfony/security-guard (v5.4.35)
  - Downloading symfony/security-bundle (v5.4.35)
  - Downloading symfony/monolog-bridge (v5.4.35)
  - Downloading symfony/mime (v5.4.35)
  - Downloading symfony/messenger (v5.4.35)
  - Downloading symfony/redis-messenger (v5.4.35)
  - Downloading symfony/doctrine-messenger (v5.4.35)
  - Downloading symfony/amqp-messenger (v5.4.35)
  - Downloading symfony/mailer (v5.4.35)
  - Downloading symfony/lock (v5.4.35)
  - Downloading symfony/intl (v5.4.35)
  - Downloading symfony/http-client (v5.4.35)
  - Downloading symfony/form (v5.4.35)
  - Downloading symfony/dotenv (v5.4.35)
  - Downloading symfony/doctrine-bridge (v5.4.35)
  - Downloading symfony/css-selector (v5.4.35)
  - Downloading symfony/asset (v5.4.35)
  - Downloading giggsey/libphonenumber-for-php (8.13.29)
  - Downloading aws/aws-sdk-php (3.297.4)
  - Downloading doctrine/inflector (2.0.9)
  - Downloading doctrine/orm (2.17.4)
  - Downloading phpstan/phpstan (1.10.57)
  - Downloading phpstan/phpstan-doctrine (1.3.59)
  - Downloading symfony/phpunit-bridge (v5.4.35)
  - Downloading symfony/web-profiler-bundle (v5.4.35)
  - Upgrading symfony/finder (v5.4.27 => v5.4.35): Extracting archive
  - Upgrading symfony/stopwatch (v5.4.21 => v5.4.35): Extracting archive
  - Upgrading symfony/console (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/filesystem (v5.4.25 => v5.4.35): Extracting archive
  - Upgrading doctrine/deprecations (1.1.2 => 1.1.3): Extracting archive
  - Upgrading doctrine/dbal (3.7.2 => 3.8.0): Extracting archive
  - Upgrading symfony/process (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/event-dispatcher (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading friendsofphp/php-cs-fixer (v3.46.0 => v3.48.0): Extracting archive
  - Upgrading symfony/http-foundation (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading league/mime-type-detection (1.14.0 => 1.15.0): Extracting archive
  - Upgrading league/flysystem-local (3.23.0 => 3.23.1): Extracting archive
  - Upgrading league/flysystem (3.23.0 => 3.23.1): Extracting archive
  - Upgrading symfony/yaml (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/routing (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/var-dumper (v5.4.29 => v5.4.35): Extracting archive
  - Upgrading symfony/error-handler (v5.4.29 => v5.4.35): Extracting archive
  - Upgrading symfony/http-kernel (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/dependency-injection (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/config (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/cache (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/framework-bundle (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/dom-crawler (v5.4.32 => v5.4.35): Extracting archive
  - Upgrading symfony/browser-kit (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading phpunit/phpunit (9.6.15 => 9.6.16): Extracting archive
  - Upgrading liip/test-fixtures-bundle (2.7.0 => 2.7.2): Extracting archive
  - Upgrading symfony/expression-language (v5.4.21 => v5.4.35): Extracting archive
  - Upgrading symfony/validator (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/twig-bridge (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/twig-bundle (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/translation (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/templating (v5.4.21 => v5.4.35): Extracting archive
  - Upgrading symfony/security-core (v5.4.30 => v5.4.35): Extracting archive
  - Upgrading symfony/security-csrf (v5.4.27 => v5.4.35): Extracting archive
  - Upgrading symfony/property-access (v5.4.26 => v5.4.35): Extracting archive
  - Upgrading symfony/security-http (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/security-guard (v5.4.27 => v5.4.35): Extracting archive
  - Upgrading symfony/security-bundle (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/monolog-bridge (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/mime (v5.4.26 => v5.4.35): Extracting archive
  - Upgrading symfony/messenger (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/redis-messenger (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/doctrine-messenger (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/amqp-messenger (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading symfony/mailer (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/lock (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/intl (v5.4.30 => v5.4.35): Extracting archive
  - Upgrading symfony/http-client (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/form (v5.4.33 => v5.4.35): Extracting archive
  - Upgrading symfony/dotenv (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/doctrine-bridge (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/css-selector (v5.4.26 => v5.4.35): Extracting archive
  - Upgrading symfony/asset (v5.4.31 => v5.4.35): Extracting archive
  - Upgrading giggsey/libphonenumber-for-php (8.13.27 => 8.13.29): Extracting archive
  - Upgrading aws/aws-sdk-php (3.296.1 => 3.297.4): Extracting archive
  - Upgrading doctrine/inflector (2.0.8 => 2.0.9): Extracting archive
  - Upgrading doctrine/orm (2.17.2 => 2.17.4): Extracting archive
  - Upgrading phpstan/phpstan (1.10.55 => 1.10.57): Extracting archive
  - Upgrading phpstan/phpstan-doctrine (1.3.54 => 1.3.59): Extracting archive
  - Upgrading symfony/phpunit-bridge (v5.4.34 => v5.4.35): Extracting archive
  - Upgrading symfony/web-profiler-bundle (v5.4.34 => v5.4.35): Extracting archive
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package phpstan/phpstan-php-parser is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
Warning: Ambiguous class resolution, "lessc" was found in both "/var/www/html/mautic/vendor/wikimedia/less.php/lessc.inc.php" and "/var/www/html/mautic/vendor/marcusschwarz/lesserphp/lessc.inc.php", the first will be used.
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
148 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
> composer/composer: installed
> phpstan/phpstan-deprecation-rules: installed
> phpstan/phpstan-doctrine: installed
> phpstan/phpstan-php-parser: installed
> phpstan/phpstan-phpunit: installed
> phpstan/phpstan-symfony: installed
> php -r "if(file_exists('./.git')&&file_exists('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''))){copy('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''),'./.git/hooks/pre-commit');} if(file_exists('./.git')&&file_exists('./build/hooks/post-checkout')){copy('./build/hooks/post-checkout','./.git/hooks/post-checkout');}"
> php -r "if(file_exists('./.git/hooks/pre-commit')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/pre-commit',0755);} if(file_exists('./.git/hooks/post-checkout')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/post-checkout',0755);}"
> find . -mindepth 2 -type d -name .git | xargs rm -rf
> npm ci

> mautic@0.0.0 postinstall
> node_modules/modernizr/bin/modernizr -c modernizr-config.json -d node_modules/modernizr/modernizr-mautic-dist.js

Modernizr build saved to node_modules/modernizr/modernizr-mautic-dist.js

added 241 packages, and audited 242 packages in 5s

21 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
npm notice 
npm notice New minor version of npm available! 10.3.0 -> 10.4.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.4.0
npm notice Run npm install -g npm@10.4.0 to update!
npm notice 
> npx patch-package
patch-package 7.0.0
Applying patches...
at.js@1.5.4 ✔
chosen-js@1.8.7 ✔
> bin/console mautic:assets:generate
Production assets have been regenerated.
No security vulnerability advisories found.
root@ma:/var/www/html/mautic# composer update
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Loading composer repositories with package information
Updating dependencies                                 
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package phpstan/phpstan-php-parser is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
Warning: Ambiguous class resolution, "lessc" was found in both "/var/www/html/mautic/vendor/wikimedia/less.php/lessc.inc.php" and "/var/www/html/mautic/vendor/marcusschwarz/lesserphp/lessc.inc.php", the first will be used.
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
148 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
> php -r "if(file_exists('./.git')&&file_exists('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''))){copy('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''),'./.git/hooks/pre-commit');} if(file_exists('./.git')&&file_exists('./build/hooks/post-checkout')){copy('./build/hooks/post-checkout','./.git/hooks/post-checkout');}"
> php -r "if(file_exists('./.git/hooks/pre-commit')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/pre-commit',0755);} if(file_exists('./.git/hooks/post-checkout')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/post-checkout',0755);}"
> find . -mindepth 2 -type d -name .git | xargs rm -rf
> npm ci

> mautic@0.0.0 postinstall
> node_modules/modernizr/bin/modernizr -c modernizr-config.json -d node_modules/modernizr/modernizr-mautic-dist.js

Modernizr build saved to node_modules/modernizr/modernizr-mautic-dist.js

added 241 packages, and audited 242 packages in 5s

21 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
> npx patch-package
patch-package 7.0.0
Applying patches...
at.js@1.5.4 ✔
chosen-js@1.8.7 ✔
> bin/console mautic:assets:generate
Production assets have been regenerated.
No security vulnerability advisories found.
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\Version20230615101328                                |
|                      | Current              | Mautic\Migrations\Version20230621074925                                |
|                      | Next                 | Mautic\Migrations\Version20220722074516                                |
|                      | Latest               | Mautic\Migrations\Version20230627140512                                |
|----------------------------------------------------------------------------------------------------------------------|
| Migrations           | Executed             | 10                                                                     |
|                      | Executed Unavailable | 0                                                                      |
|                      | Available            | 19                                                                     |
|                      | New                  | 9                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | Mautic\Migrations    | /var/www/html/mautic/app/migrations                                    |
+----------------------+----------------------+------------------------------------------------------------------------+
root@ma:/var/www/html/mautic# 

It says clearly 9 new migrations are not made.

While the website shows:

image

Again, I am even more confused how you can affirm with such ease that the errors can be ignored when the website and all the results shown shows the opposite!

@uhlhosting
Copy link
Author

This issue was reporting this error: Table 'point_groups' already exists. This error is solved, isn't it? As I suggested, if there are more problems, please create a dedicated GitHub issue for it. Let's not solve all Mautic's problems in 1 issue.

Since you fixed the issue I first reported yes, I accept, yet the fact that my mautic is stuck between versions is also due to very same issue.

@uhlhosting
Copy link
Author

And not to mentioned I already posted the order of the migrations is scarry what does 2022 as Next?

| Versions             | Previous             | Mautic\Migrations\Version20230615101328                                |
|                      | Current              | Mautic\Migrations\Version20230621074925                                |
|                      | Next                 | Mautic\Migrations\Version20220722074516                                |
|                      | Latest               | Mautic\Migrations\Version20230627140512 

@escopecz
Copy link
Sponsor Member

@uhlhosting I repeat, please, open a new GH issue for your problem. The original problem is solved. This is very hard to navigate.

The Mautic version is not stored in the database but in a file, so the database migration info messages you call "errors" cannot be to blame.

Create a new GH issue, please where you describe how have you installed Mautic and what steps you did to update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs db-migrations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants