# Error updating Mautic 2.16.4 to 3.2

**URL:** <https://forum.mautic.org/t/error-updating-mautic-2-16-4-to-3-2/17368>\
**Category:** Mautic 3 - Install/Upgrade Support\
**Created:** [December 11, 2020, 5:53am UTC](https://forum.mautic.org/t/error-updating-mautic-2-16-4-to-3-2/17368 "2020-12-11T05:53:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sj136](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sj136/32/1309_2.png) [@sj136](https://forum.mautic.org/u/sj136)\
**Post date:** [December 11, 2020, 5:53am UTC](https://forum.mautic.org/t/error-updating-mautic-2-16-4-to-3-2/17368/1 "2020-12-11T05:53:50Z")

</div>

I successfully updated from Mautic 2.14.2 to Mautic 2.16.4 using the Web gui update.

I have updated my PHP to 7.3.25

My MySQL/MariaDB version is: 10.3.24-MariaDB-Cll-lve

I am having Updating Errors when trying to update from 2.16.4 to 3.x during the database migration part of the upgrade.

I have attempted to upgrade using the Web and when it failed I restored to my backup of 2.16.4 and then attempted to upgrade using Command Line and the “php upgrade\_v3.php” command. It failed on the 2nd time running the command.

I seem to be getting the same type of error each time with the database migration step.

Also, before attempting to update with the command line I also ran the recommended commands from Step 2 Verify the Health of Your Current Version from [https://mauteam.org/mautic/mautic-admins/mautic-update-how-to-dont-click-that-button/](https://mauteam.org/mautic/mautic-admins/mautic-update-how-to-dont-click-that-button/) but this did not eliminate the errors.

As prompted in the error output I ran the following command:

php bin/console doctrine:migrations:migrate --no-interaction --env=prod --no-debug

Here is the error output:

[2020-12-10 18:37:46] ++ adding generated column generated\_sent\_date  
[2020-12-10 18:37:46] -\> ALTER TABLE maugc\_email\_stats ADD generated\_sent\_date DATE AS (CONCAT(YEAR(date\_sent), “-”, LPAD(MONTH(date\_sent), 2, “0”), “-”, LPAD(DAY(date\_sent), 2, “0”))) COMMENT ‘(DC2Type:generated)’;  
ALTER TABLE maugc\_email\_stats ADD INDEX `maugc_generated_sent_date_email_id`(generated\_sent\_date, email\_id)

In AbstractMySQLDriver.php line 79:

An exception occurred while executing ‘ALTER TABLE maugc\_email\_stats ADD ge  
nerated\_sent\_date DATE AS (CONCAT(YEAR(date\_sent), “-”, LPAD(MONTH(date\_sen  
t), 2, “0”), “-”, LPAD(DAY(date\_sent), 2, “0”))) COMMENT ‘(DC2Type:generate  
d)’;  
ALTER TABLE maugc\_email\_stats ADD INDEX `maugc_generated_sent_d ate_email_id`(generated\_sent\_date, email\_id)’:

You have an error in your SQL syntax; check the manual that corresponds to  
your MariaDB server version for the right syntax to use near ‘ALTER TABLE m  
augc\_email\_stats ADD INDEX `maugc_generated_sent_date_email_id`(…’ at lin  
e 2

In MysqliStatement.php line 86:

You have an error in your SQL syntax; check the manual that corresponds to  
your MariaDB server version for the right syntax to use near ‘ALTER TABLE m  
augc\_email\_stats ADD INDEX `maugc_generated_sent_date_email_id`(…’ at lin  
e 2

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] [–] []

From searching on the internet I found 2 articles on github that discuss similar errors, but I do not understand how to correct the problem.

> <https://github.com/mautic/mautic/issues/9180>
>
> php bin/console doctrine:migration:migrate
> ++ adding generated column generated\_sent\_date
> \-\> ALTER TABLE ema\_email\_stats ADD generated\_sent\_date DATE AS (CONCAT(YEAR(date\_sent), "-", LPAD(MONTH(date\_sent), 2, "0"), "-", LPAD(DAY(date\_sent),...

  

> <https://github.com/mautic/mautic/issues/9129>
>
> Bug Description
> I've had a few different SQL migration errors since updating to 3.1.0 from 2.16.3. Most I've been able to figure...

Can someone please explain more plainly the steps I need to take to correct the SQL problem so I can do the upgrade?

Or in the alternative, is there a way for me to be able to bring in my contact data, customization, email templates, etc. from my 2.16.4 into a fresh install of Mautic (I can do a fresh install of 3.2.1 on my hosting company cpanel using softaculous)
