Mautic Community Forums

Error Updating from Mautic 3.0 -->3.01

Your software
My PHP version is :7.3
My MariaDB version is 10.3
Updating/Installing Errors
I am : Updating from 3.0–> 3.01
Upgrading/installing via Command Line

These errors are showing in the installer : Step 1 [->--------------------------] Migrating database schema…PHP Fatal error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigration::up(Doctrine\DBAL\Schema\Schema $schema): void in /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/app/migrations/Version20200617155347.php on line 36

In Version20200617155347.php line 36:

Compile Error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigrat
ion::up(Doctrine\DBAL\Schema\Schema $schema): void

mautic:update:apply [–force] [-p|–update-package [UPDATE-PACKAGE]] [–finish] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

These errors are showing in the Mautic log : [root@howdy ~]# [root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console mautic:update:find
Step 1 [->--------------------------] Migrating database schema…PHP Fatal error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigration::up(Doctrine\DBAL\Schema\Schema $schema): void in /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/app/migrations/Version20200617155347.php on line 36

In Version20200617155347.php line 36:

Compile Error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema-bash: [root@howdy: command not found
\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigrat
ion::up(Doctrine\DBAL\Schema\Schema $schema): void

mautic:update:apply [–force] [-p|–update-package [UPDATE-PACKAGE]] [–finish] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]
[root@howdy ~]# Version 3.0.1 of Mautic is available for download. Please visit https://github.com/mautic/mautic/releases/tag/3.0.1 for more information.
-bash: Version: command not found
[root@howdy ~]# To update, you can run ‘php bin/console mautic:update:apply’ from the command line.
-bash: To: command not found
[root@howdy ~]# [root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console mautic:update:apply
-bash: [root@howdy: command not found
[root@howdy ~]# Are you sure you wish to update Mautic to the latest version? y
-bash: Are: command not found
[root@howdy ~]# Step 5 [----->----------------------] Clearing the cache
-bash: Step: command not found
[root@howdy ~]#
[root@howdy ~]# IMPORTANT: Run the same command again with --finish. For example ‘php bin/console mautic:update:apply --finish’
-bash: syntax error near unexpected token newline' [root@howdy ~]# [root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console mautic:update:apply --finish -bash: [root@howdy: command not found [root@howdy ~]# Step 1 [->--------------------------] Migrating database schema...PHP Fatal error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigration::up(Doctrine\DBAL\Schema\Schema $schema): void in /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/app/migrations/Version20200617155347.php on line 36 -bash: syntax error near unexpected token (’
[root@howdy ~]#
[root@howdy ~]# In Version20200617155347.php line 36:
-bash: In: command not found
[root@howdy ~]#
[root@howdy ~]# Compile Error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigrat
-bash: syntax error near unexpected token (' [root@howdy ~]# ion::up(Doctrine\DBAL\Schema\Schema $schema): void -bash: syntax error near unexpected token Doctrine\DBAL\Schema\Schema’
[root@howdy ~]#
[root@howdy ~]#
[root@howdy ~]# mautic:update:apply [–force] [-p|–update-package [UPDATE-PACKAGE]] [–finish] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]
-bash: syntax error near unexpected token `newline’
[root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console doctrine:schema:update --force

Updating database schema…

In AbstractMySQLDriver.php line 106:

An exception occurred while executing ‘ALTER TABLE mauhu_oauth2_accesstokens CHANGE client_id client_id INT UNSIGNED NOT NULL, CHANGE user_id user_id INT UNSIGNED NOT NULL, CHANGE to
ken token VARCHAR(191) NOT NULL, CHANGE scope scope VARCHAR(191) DEFAULT NULL’:

SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a foreign key constraint ‘FK_5DD8E68219EB6921’

In PDOConnection.php line 80:

SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a foreign key constraint ‘FK_5DD8E68219EB6921’

In PDOConnection.php line 75:

SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a foreign key constraint ‘FK_5DD8E68219EB6921’

doctrine:schema:update [–complete] [–dump-sql] [-f|–force] [–em [EM]] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

[root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console doctrine:migrations:generate
PHP Fatal error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigration::up(Doctrine\DBAL\Schema\Schema $schema): void in /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/app/migrations/Version20200617155347.php on line 36

In Version20200617155347.php line 36:

Compile Error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigrat
ion::up(Doctrine\DBAL\Schema\Schema $schema): void

doctrine:migrations:generate [–editor-cmd [EDITOR-CMD]] [–configuration [CONFIGURATION]] [–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

[root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console doctrine:migrations:migrate
PHP Fatal error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigration::up(Doctrine\DBAL\Schema\Schema $schema): void in /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/app/migrations/Version20200617155347.php on line 36

In Version20200617155347.php line 36:

Compile Error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigrat
ion::up(Doctrine\DBAL\Schema\Schema $schema): void

doctrine:migrations:migrate [–write-sql [WRITE-SQL]] [–dry-run] [–query-time] [–allow-no-migration] [–all-or-nothing [ALL-OR-NOTHING]] [–configuration [CONFIGURATION]] [–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–] []

[root@howdy ~]# /opt/plesk/php/7.3/bin/php /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console doctrine:migrations:migrate
PHP Fatal error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigration::up(Doctrine\DBAL\Schema\Schema $schema): void in /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/app/migrations/Version20200617155347.php on line 36

In Version20200617155347.php line 36:

Compile Error: Declaration of Mautic\Migrations\Version20200617155347::up(Doctrine\DBAL\Schema\Schema $schema) must be compatible with Mautic\CoreBundle\Doctrine\AbstractMauticMigrat
ion::up(Doctrine\DBAL\Schema\Schema $schema): void

doctrine:migrations:migrate [–write-sql [WRITE-SQL]] [–dry-run] [–query-time] [–allow-no-migration] [–all-or-nothing [ALL-OR-NOTHING]] [–configuration [CONFIGURATION]] [–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–] []

These errors are showing in the upgrade_log.txt file (located in the root of your Mautic instance when an upgrade has been attempted - ensure you remove or redact any sensitive data such as domain names in the file path) :

Your problem
My problem is : upgrade from M3.0 to 3.01 failed- site if 500 error now

Steps I have tried to fix the problem : cleared cache- google gave me this but any fixes mentioned cause more issues https://github.com/symfony/symfony/issues/30828

1 Like

@EJL Can you tell us how you installed Mautic? The latest 3.0.1 version doesn’t include a migration with number 20200617155347. Did you create this migration yourself by any chance?

this instance was originally an upgrade from 2.16.2 —> 3.0 and then used for a few weeks and then attempted the 3.0.1 upgrade when these errors occurred.

I wouldn’t know how to create such a migration

Could you share the contents of app/migrations/Version20200617155347.php with us here? Curious to see what’s in there as I can’t find it anywhere in the Mautic repo on GitHub. If we know the contents we can decide whether it can be either deleted or what needs to be changed in order to make the migration pass :slight_smile:

Blockquote <?php

declare(strict_types=1);

/*

namespace Mautic\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;

final class Version20200617155347 extends AbstractMauticMigration
{
/**
* @throws SkipMigrationException
*/
public function preUp(Schema $schema)
{
$shouldRunMigration = false; // Please modify to your needs

    if (!$shouldRunMigration) {
        throw new SkipMigration('Schema includes this migration');
    }
}

public function up(Schema $schema)
{
    // Please modify to your needs
}

}

Blockquote

Here are the rest listed- I can post contents all if you want:

@dennisameling any other info i should share? any testing recommendations?

Hello, i have the same issue.
I updated 2.6.3 to 3.0.1 and everything went well.
tried to update to 3.0.2 and I still have 11 migrations open. they’re the same as you in my migations folder :

-rw-r–r-- 1 www-data www-data 1179 Aug 13 11:08 Version20181111095447.php
-rw-r–r-- 1 www-data www-data 2111 Aug 13 11:08 Version20190704154940.php
-rw-r–r-- 1 www-data www-data 2618 Aug 13 11:08 Version20190724110039.php
-rw-r–r-- 1 www-data www-data 1174 Aug 13 11:08 Version20191126093923.php
-rw-r–r-- 1 www-data www-data 4105 Aug 13 11:08 Version20191219155630.php
-rw-r–r-- 1 www-data www-data 967 Aug 13 11:08 Version20200211095409.php
-rw-r–r-- 1 www-data www-data 872 Aug 13 11:08 Version20200212141530.php
-rw-r–r-- 1 www-data www-data 690 Aug 13 11:08 Version20200220172041.php
-rw-r–r-- 1 www-data www-data 791 Aug 13 11:08 Version20200227110431.php
-rw-r–r-- 1 www-data www-data 1455 Aug 13 11:08 Version20200302164801.php
-rw-r–r-- 1 www-data www-data 3855 Aug 13 11:08 Version20200422144300.php

And I also tried to force the update and i had this error : SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a foreign key constraint ‘FK_3A18CA5A19EB6921’

This is a known bug in older version I guess, I helped someone solved this issue a few days back, could you paste the full error log?

Hello, here is my logs file :

[2020-08-13 09:26:41] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {“request”:"[object] (Symfony\Component\HttpFoundation\Request: GET 35.180.9.25:80 HTTP/1.0\r\nX-Php-Ob-Level: 1\r\n\r\n)",“exception”:"[object] (Symfony\Component\Debug\Exception\FlattenException: {})",“logger”:"[object] (Symfony\Bridge\Monolog\Logger: {})",“class”:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,“currentContent”:"",“layout”:“Error”,“code”:404,“anonymous”:true,“baseTemplate”:“MauticCoreBundle:Default:slim.html.php”,“templatePage”:false,“template”:“MauticCoreBundle:Error:404.html.php”,“templating”:"[object] (Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine: {})",“statusText”:“Not Found”,“url”:“35.180.9.25:80”,“urlParts”:{“host”:“35.180.9.25”,“port”:80}}
[2020-08-13 09:26:41] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {“request”:"[object] (Symfony\Component\HttpFoundation\Request: GET 35.180.9.25:80 HTTP/1.0\r\nX-Php-Ob-Level: 1\r\n\r\n)",“exception”:"[object] (Symfony\Component\Debug\Exception\FlattenException: {})",“logger”:"[object] (Symfony\Bridge\Monolog\Logger: {})",“class”:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,“currentContent”:"",“layout”:“Error”,“code”:404,“anonymous”:true,“baseTemplate”:“MauticCoreBundle:Default:slim.html.php”,“templatePage”:false,“template”:“MauticCoreBundle:Error:404.html.php”,“templating”:"[object] (Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine: {})",“statusText”:“Not Found”,“url”:“35.180.9.25:80”,“urlParts”:{“host”:“35.180.9.25”,“port”:80}}
[2020-08-13 09:26:42] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {“request”:"[object] (Symfony\Component\HttpFoundation\Request: GET 35.180.9.25:80 HTTP/1.0\r\nX-Php-Ob-Level: 1\r\n\r\n)",“exception”:"[object] (Symfony\Component\Debug\Exception\FlattenException: {})",“logger”:"[object] (Symfony\Bridge\Monolog\Logger: {})",“class”:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,“currentContent”:"",“layout”:“Error”,“code”:404,“anonymous”:true,“baseTemplate”:“MauticCoreBundle:Default:slim.html.php”,“templatePage”:false,“template”:“MauticCoreBundle:Error:404.html.php”,“templating”:"[object] (Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine: {})",“statusText”:“Not Found”,“url”:“35.180.9.25:80”,“urlParts”:{“host”:“35.180.9.25”,“port”:80}}
[2020-08-13 09:26:42] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {“request”:"[object] (Symfony\Component\HttpFoundation\Request: GET 35.180.9.25:80 HTTP/1.0\r\nX-Php-Ob-Level: 1\r\n\r\n)",“exception”:"[object] (Symfony\Component\Debug\Exception\FlattenException: {})",“logger”:"[object] (Symfony\Bridge\Monolog\Logger: {})",“class”:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,“currentContent”:"",“layout”:“Error”,“code”:404,“anonymous”:true,“baseTemplate”:“MauticCoreBundle:Default:slim.html.php”,“templatePage”:false,“template”:“MauticCoreBundle:Error:404.html.php”,“templating”:"[object] (Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine: {})",“statusText”:“Not Found”,“url”:“35.180.9.25:80”,“urlParts”:{“host”:“35.180.9.25”,“port”:80}}
[2020-08-13 09:26:43] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {“request”:"[object] (Symfony\Component\HttpFoundation\Request: GET 35.180.9.25:80 HTTP/1.0\r\nX-Php-Ob-Level: 1\r\n\r\n)",“exception”:"[object] (Symfony\Component\Debug\Exception\FlattenException: {})",“logger”:"[object] (Symfony\Bridge\Monolog\Logger: {})",“class”:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,“currentContent”:"",“layout”:“Error”,“code”:404,“anonymous”:true,“baseTemplate”:“MauticCoreBundle:Default:slim.html.php”,“templatePage”:false,“template”:“MauticCoreBundle:Error:404.html.php”,“templating”:"[object] (Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine: {})",“statusText”:“Not Found”,“url”:“35.180.9.25:80”,“urlParts”:{“host”:“35.180.9.25”,“port”:80}}
[2020-08-13 09:52:15] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {“request”:"[object] (Symfony\Component\HttpFoundation\Request: GET ip.ws.126.net:443 HTTP/1.1\r\nHost: ip.ws.126.net:443\r\nUser-Agent: Go-http-client/1.1\r\nX-Php-Ob-Level: 1\r\n\r\n)",“exception”:"[object] (Symfony\Component\Debug\Exception\FlattenException: {})",“logger”:"[object] (Symfony\Bridge\Monolog\Logger: {})",“class”:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,“currentContent”:"",“layout”:“Error”,“code”:404,“anonymous”:true,“baseTemplate”:“MauticCoreBundle:Default:slim.html.php”,“templatePage”:false,“template”:“MauticCoreBundle:Error:404.html.php”,“templating”:"[object] (Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine: {})",“statusText”:“Not Found”,“url”:“ip.ws.126.net:443”,“urlParts”:{“host”:“ip.ws.126.net”,“port”:443}}
[2020-08-13 09:52:45] mautic.NOTICE: Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘ALTER TABLE oauth2_accesstokens CHANGE client_id client_id INT UNSIGNED NOT NULL, CHANGE user_id user_id INT UNSIGNED NOT NULL, CHANGE token token VARCHAR(191) NOT NULL, CHANGE scope scope VARCHAR(191) DEFAULT NULL’: SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a foreign key constraint ‘FK_3A18CA5A19EB6921’ (uncaught exception) at /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 106 while running console command doctrine:schema:update

Could you find the table of this foreign key: FK_3A18CA5A19EB6921? You can visit your PHPMyAdmin or whatever MySQL admin you use, then try dropping that foreign key constraint, chances are you’ll find another foreign key in that specific table, so you just change that to the one reported in your log and you then retry.