# Updating from 4.1.0 from 4.2.1 blew my mautic up

**URL:** https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527
**Category:** Mautic 4 Install/Upgrade Support
**Created:** [April 3, 2022, 10:07pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527 "2022-04-03T22:07:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [April 3, 2022, 10:07pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/1 "2022-04-03T22:07:25Z")

</div>

**Your software**  
_My PHP version is_ : 7.4  
_My MySQL/MariaDB version is_ (delete as applicable): MySQL v8.0

**Updating/Installing Errors**  
_I am_ Updating  
_Upgrading/installing via_ Web at first (didn’t work, never does), now I am learning CLI.

_These errors are showing in the installer_ : I cannot get the web UI to load anymore. After running: \<php bin/console doctrine:schema:update --force\> I get this:

In AbstractMySQLDriver.php line 128:  
An exception occurred while executing ‘ALTER TABLE oauth2\_accesstokens CHANGE client\_id client\_id INT UN  
SIGNED NOT NULL, CHANGE user\_id user\_id INT UNSIGNED DEFAULT NULL, CHANGE token token VARCHAR(191) NOT N  
ULL, CHANGE scope scope VARCHAR(191) DEFAULT NULL’:

SQLSTATE[HY000]: General error: 3780 Referencing column ‘user\_id’ and referenced column ‘id’ in foreign  
key constraint ‘FK\_3A18CA5AA76ED395’ are incompatible.

In Exception.php line 18:  
SQLSTATE[HY000]: General error: 3780 Referencing column ‘user\_id’ and referenced column ‘id’ in foreign  
key constraint ‘FK\_3A18CA5AA76ED395’ are incompatible.

In PDOConnection.php line 132:  
SQLSTATE[HY000]: General error: 3780 Referencing column ‘user\_id’ and referenced column ‘id’ in foreign  
key constraint ‘FK\_3A18CA5AA76ED395’ are incompatible.

_These errors are showing in the Mautic log_ :  
I cannot access Mautic anymore.

Executed Migrations: 181  
Executed Unavailable Migrations: 134  
Available Migrations: 47  
New Migrations: 0

**Your problem**  
_My problem is_ :  
I cannot access the Mautic web UI at all.

_Steps I have tried to fix the problem_ :  
I have tried all these tips: [https://docs.mautic.org/en/troubleshooting](https://docs.mautic.org/en/troubleshooting) and these: [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/)

I have tried to revert back to DB backup and 4.1 files, but still can’t access web UI.

Thoughts?

---

<div class="post-metadata">

### Author: ![carlosmelero](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carlosmelero/32/1164_2.png) [@carlosmelero](https://forum.mautic.org/u/carlosmelero)
#### Post date: [April 8, 2022, 9:14am UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/2 "2022-04-08T09:14:05Z")

</div>

I have tried to install 4.2.1 from 4.1.2 and it broke my mautic.

I have restored a backup and, after a little research, I have discovered this:

The cron processes related to campaigns do never ends. They achieves the 100% but never ends. According to the log, there is an error adding some contacts to a campaign. I have seen that those contacts already are in those campaigns. The process tries to add them over and over, and never ends.

Looking into the contacts filters, I have seen that they are broken. For instance, there was a segment with no filters because the contacts where added and removed from campaigns actions. After the update, that segment has filters and the combos of the conditions are empty and combo boxes are empty and unselectable. Other filter had a “URL visited” condition, after update, the combo of that condition is empty and, when I open it, there is no options to select.

I guess it means that the update process has broke the database.

Maybe we could do a progressive update from 4.1.0 to 4.2.1 updating each intermediate version but I h haven’t found info about how to manually install a selected version.

Edited:  
I have found how to do an incremental upgrade using zip file, but it has a big limitation. I have to create a new mautic folder and move all files I have change (media/files; plugins; themes; translations) from current installation but… I’m not sure which files I have modified and, because I restored a backup, all files has the same time stamp ☹

---

<div class="post-metadata">

### Author: ![carlosmelero](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carlosmelero/32/1164_2.png) [@carlosmelero](https://forum.mautic.org/u/carlosmelero)
#### Post date: [April 8, 2022, 9:21am UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/3 "2022-04-08T09:21:37Z")

</div>

I also was not able to restore the backup but I found a workaround.

In my case, I restored all subdomain files and database using the hosting (Siteground) tools. This caused an strange PHP error. The solution was to restore the mautic folder to another folder, delete the broken mautic folder and copy the restored mautic folder to its original place.

I guess than something happened when I delete and replace the mautic folder and “that thing” didn’t happen when I restore the files from backup.

Everything is working again.

---

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [April 11, 2022, 7:02pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/4 "2022-04-11T19:02:21Z")

</div>

I reverted back to my old 4.1 and it finally worked. Pretty sure the DB is a hybrid of both versions now, but don’t care because it’s up and running again. I am NEVER upgrading after all the garbage/stress I had to go through to get my system back. 😡

---

<div class="post-metadata">

### Author: ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)
#### Post date: [April 11, 2022, 8:50pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/5 "2022-04-11T20:50:31Z")

</div>

Upgrading via UI is going away in Mautic 5.x so CLI upgrades are the mainstream. Run a schema update to ensure your update is complete.

---

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [April 11, 2022, 9:18pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/6 "2022-04-11T21:18:39Z")

</div>

Yeah, I read that. Thought I was safe using the v4 manual upgrade approach still, but that was clearly not the case. As I said, I am currently using files from 4.1 with a database that says I am “up to date with 4.2.1”! Yay? Not even sure how it’s working right now, frankly, but I am not going to touch anything until version 5.5 at the least…

---

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [May 2, 2022, 7:54pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/7 "2022-05-02T19:54:51Z")

</div>

Spoke too soon, apparently having deeper DB issues. Getting this error now:

```auto
SQLSTATE[HY000]: General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'FK_BLAHBLAHBLAH' are incompatible.

```

Anyone have an idea how to correct this in my database?

---

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [May 19, 2022, 8:17pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/8 "2022-05-19T20:17:58Z")

</div>

Okay, found the web UI problem: A line about PHP in my .htaccess file was preventing anything from showing up. I uncommented it, and Mautic is showing up again, but I still have the same error message noted above.

I think I can manually edit the DB table to fix this, but I want to make sure I am interpreting the failure (and solution) correctly:

In TABLE oauth2\_accesstokens, I need to CHANGE the user\_id to: “INT UNSIGNED DEFAULT NULL,” and then CHANGE the client\_id to “INT UNSIGNED NOT NULL,” and CHANGE the token to “VARCHAR(191) NOT NULL,” and CHANGE the scope to VARCHAR(191) DEFAULT NULL"

Am I reading that right? @EJL

---

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [May 28, 2022, 12:31am UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/9 "2022-05-28T00:31:49Z")

</div>

Didn’t work, changes wouldn’t stick.

---

<div class="post-metadata">

### Author: ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)
#### Post date: [June 2, 2022, 2:49pm UTC](https://forum.mautic.org/t/updating-from-4-1-0-from-4-2-1-blew-my-mautic-up/23527/10 "2022-06-02T14:49:44Z")

</div>

So many foreign key constraint issues in database that I gave up and started over. 🤬
