Upgrading from 4.1.0 to 4.2.1 Mautic Died


I have a pretty big install for a client on 4.1.0.

I ran the Mautic:update:apply and all worked well.
then I ran Mautic:update:apply --finish and get the following error:
An error occurred while updating the database. Check log for more details.

I have looked for this error log and cannot find any logs in root directory and nothing in any other logs.

When I try and go to the instance from the browser I get the following:

Oops! An Error Occurred

The server returned a β€œ500 Internal Server Error”.

Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

Any ideas how to go about debugging this and getting it to work ?

I tried to run php7.4 console doctrine:schema:update --force

and got the following error:

An exception occurred while executing 'ALTER TABLE leads ADD generated_email_domain VARCHAR(255) AS (SUBSTRING(email, LOCATE("@", email) + 1)) COMMENT '(DC2Type:generated)', DROP fax, DROP twitter, DROP mwb_last_pay_method, DROP m  
  wb_current_orders, DROP mwb_last_product, DROP mwb_last_products, DROP mwb_products, DROP mwb_product_types, DROP mwb_last_num_of_prod, DROP mwb_total_products_num, DROP mwb_prod_1_img_url, DROP mwb_prod_1_name, DROP mwb_prod_1_ur  
  l, DROP mwb_prod_2_img_url, DROP mwb_prod_2_name, DROP mwb_prod_2_price, DROP mwb_prod_2_url, DROP mwb_prod_3_img_url, DROP mwb_prod_3_name, DROP mwb_prod_3_price, DROP mwb_prod_3_url, DROP mwb_total_val_of_orders, DROP mwb_avg_or  
  der_value, DROP mwb_first_order_val, DROP mwb_last_order_val, DROP mwb_order_frequency, DROP mwb_abncart_prod_html, CHANGE mwb_abdn_coupon mwb_abdn_coupon VARCHAR(255) DEFAULT NULL':                                                  
  SQLSTATE[42S22]: Column not found: 1054 Unknown column '@' in 'generated column function'                                                                                                                                               

In Exception.php line 18:
  SQLSTATE[42S22]: Column not found: 1054 Unknown column '@' in 'generated column function'  

In PDOConnection.php line 132:
  SQLSTATE[42S22]: Column not found: 1054 Unknown column '@' in 'generated column function' 

I finally got the instance up and running, however I am still not able to update the schema correctly and as such certain things are not working, for example I cannot load segments.

The main problem from what I can see is

SQLSTATE[42S22]: Column not found: 1054 Unknown column '@' in 'generated column function' 

Where the query that is running is

ALTER TABLE leads ADD generated_email_domain TEXT(255) AS (SUBSTRING(email, LOCATE("@", email) + 1)

It seems that from what I can understand it is looking at the leads table and the column emails, and trying to split this column based on a delimiter of @ which is proving problematic.

Once again hoping to get some help from someone that understands database stuff.


ok so it looks like mysql did not like the double parenthesis so I change some code in the file:app/bundles/LeadBundle/EventListener/GeneratedColumnSubscriber.php
on line 41 through to 44 I replaced the ’ with " and the other way around:

40         $emailDomain = new GeneratedColumn(
 41             "leads",
 42             "generated_email_domain",
 43             "TEXT(255)",
 44             "SUBSTRING(email, LOCATE('@', email) + 1)"
 45         );

Now I am onto the next problem and just going to continue documenting here as maybe it will help others debug if they run into this problem.

Next problem I am running into is the following error:

An exception occurred while executing 'CREATE INDEX mwb_abncart_prods_count_search ON leads (mwb_abncart_prods_count)':  
  SQLSTATE[42000]: Syntax error or access violation: 1069 Too many keys specified; max 64 keys allowed 

here it seems to be a plugin comming from MakeWebBetter that is creating many columns that need to be indexed.

When I try and drop these columns, they seem to re-appear each time I run the doctrine:update.

Hello Mikew … any further news to report on your upgrade?

I’m still on 4.1.2 and am always hesitant to commit to upgrades when everything is running.

Just make a backup of everything (source, database). Then try to upgrade according to offical docs. If something goes wrong just revert it.

As for situation with @mikew I would restore working version back, then start the process of upgrading (download and place the files). Then tgry running the migrations using doctrine:migrations:migrate command and see where it stops (at which migration). Next step is to investigate the problematic migration file and fix the issue manually.

The problem here was the number of characters and indexing inside mysql. Basically I had to delete most of the fields that MWB created, this plugin seems to be causing major DB issues and then got everything working.

1 Like