Mautic Community Forums

2.6.1 Upgrade lots of "500" erros and campaigns NOT working

Hi there,



I upgraded from 2.5.1 - (which was actually working fine with the campaigns working perfectly) to 2.6.1.



I updated via the mautic dashboard.



I am now getting LOTS of “Um I think I broke” 500 server errors at almost every screen. Campaigns are no longer working - but they were before.



Here is a copy of the error if I run using the manual PHP file to run the processes

I have run the schema update and it says it is fine.





Executing console mautic:campaigns:trigger



Triggering events for campaign 1

Triggering first level events

0 total events(s) to be processed in batches of 100

0 event(s) executed



Triggering scheduled events



[DoctrineDBALExceptionInvalidFieldNameException]

An exception occurred while executing ‘SELECT COUNT(c0_.id) AS sclr_0 FROM campaign_lead_event_log c0_ WHERE c0_.campaign_id = 1 AND c0_.is_scheduled = ? AND c0_.trigger_date <= ?’ with params [1, “2017-02-20 02:23:27”]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘c0_.id’ in ‘field list’



[DoctrineDBALDriverPDOException]

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘c0_.id’ in ‘field list’



[PDOException]

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘c0_.id’ in ‘field list’



mautic:campaigns:trigger [-i|–campaign-id [CAMPAIGN-ID]] [-l|–batch-limit [BATCH-LIMIT]] [-m|–max-events [MAX-EVENTS]] [-f|–force] [-t|–timeout TIMEOUT] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [-n|–no-interaction] [-s|–shell] [-e|–env ENV]



Here is a screen grab of the “campaign_lead_event_log” table and I can’t see a field called “cO.id”

Do I rename one of the existing ones, or is it in the PHP script?



screen grab



************************************************************************************************************************

If I run the schema update I get this error message and have no idea how to fix it.



Executing console doctrine:schema:update --dump-sql



[DoctrineDBALSchemaSchemaException]

There is no column with name ‘id’ on table ‘campaign_lead_event_log’.



doctrine:schema:update [-f|–force] ] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [-n|–no-interaction] [-s|–shell] [-e|–env ENV]



*******************************************************************************************************************************



Here is the migration status:



Executing console doctrine:migration:status

== Configuration


Name: Mautic Migrations

Database Driver: pdo_mysql

Database Name: [XXXXXX]_dmpages

Configuration Source: manually configured

Version Table Name: migrations

Version Column Name: version

Migrations Namespace: MauticMigrations

Migrations Directory: /home3/[XXXXXX]/public_html/dmpages.com/m/app/migrations

Previous Version: 2017-01-13 14:39:22 (20170113143922)

Current Version: 2017-01-27 20:59:28 (20170127205928)

Next Version: Already at latest version

Latest Version: 2017-01-27 20:59:28 (20170127205928)

Executed Migrations: 71

Executed Unavailable Migrations: 4

Available Migrations: 67

New Migrations: 0





I can see that there are database table errors, but I don’t know how to fix them.



****************************************************************************************************************

Also here is what happens after I manually ran the schema update using the " [your-mautic-url]/s/update/schema" command in the browser window



picture showing shema has been successfully updated

Hi there,

I upgraded from 2.5.1 - (which was actually working fine with the campaigns working perfectly) to 2.6.1.

I updated via the mautic dashboard.

I am now getting LOTS of “Um I think I broke” 500 server errors at almost every screen. Campaigns are no longer working - but they were before.

Here is a copy of the error if I run using the manual PHP file to run the processes
I have run the schema update and it says it is fine.

Executing console mautic:campaigns:trigger

Triggering events for campaign 1
Triggering first level events
0 total events(s) to be processed in batches of 100
0 event(s) executed

Triggering scheduled events

[DoctrineDBALExceptionInvalidFieldNameException]
An exception occurred while executing ‘SELECT COUNT(c0_.id) AS sclr_0 FROM campaign_lead_event_log c0_ WHERE c0_.campaign_id = 1 AND c0_.is_scheduled = ? AND c0_.trigger_date <= ?’ with params [1, “2017-02-20 02:23:27”]:
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘c0_.id’ in ‘field list’

[DoctrineDBALDriverPDOException]
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘c0_.id’ in ‘field list’

[PDOException]
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘c0_.id’ in ‘field list’

mautic:campaigns:trigger [-i|–campaign-id [CAMPAIGN-ID]] [–scheduled-only] [–negative-only] [-l|–batch-limit [BATCH-LIMIT]] [-m|–max-events [MAX-EVENTS]] [-f|–force] [-t|–timeout TIMEOUT] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–]

Here is a screen grab of the “campaign_lead_event_log” table and I can’t see a field called “cO.id”
Do I rename one of the existing ones, or is it in the PHP script?

screen grab


If I run the schema update I get this error message and have no idea how to fix it.

Executing console doctrine:schema:update --dump-sql

[DoctrineDBALSchemaSchemaException]
There is no column with name ‘id’ on table ‘campaign_lead_event_log’.

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] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–]


Here is the migration status:

Executing console doctrine:migration:status
== Configuration

>> Name:                                               Mautic Migrations
>> Database Driver:                            pdo_mysql
>> Database Name:                            [XXXXXX]_dmpages
>> Configuration Source:                   manually configured
>> Version Table Name:                     migrations
>> Version Column Name:                 version
>> Migrations Namespace:                MauticMigrations
>> Migrations Directory:                     /home3/[XXXXXX]/public_html/dmpages.com/m/app/migrations
>> Previous Version:                            2017-01-13 14:39:22 (20170113143922)
>> Current Version:                               2017-01-27 20:59:28 (20170127205928)
>> Next Version:                                    Already at latest version
>> Latest Version:                                  2017-01-27 20:59:28 (20170127205928)
>> Executed Migrations:                       71
>> Executed Unavailable Migrations:     4
>> Available Migrations:                               67
>> New Migrations:                                     0

I can see that there are database table errors, but I don’t know how to fix them.


Also here is what happens after I manually ran the schema update using the " [your-mautic-url]/s/update/schema" command in the browser window

picture showing shema has been successfully updated

@MxyzptlkFishStix that’s a bloody good question - One that I asked myself throughout most of today, when I figured out the campaigns had stopped!

The alert came up in the dashboard recommending to update, so I figured I should. BIG mistake.

I backed up the previous version database, but after a couple of days more records are created, people have unsubscribed, others have joined and the whole database is different.

Also I have no idea how to actually ‘roll back’ to v2.5.1.

I did install the manual cron “.php” file and ran the commands from browser, but I get this error when running the doctrine:schema updates (both of them).

[DoctrineDBALSchemaSchemaException]
There is no column with name ‘id’ on table ‘campaign_lead_event_log’.

What shold the campaign_lead_event_log table strucutre look like.

this is what my table looks like

https://www.dropbox.com/s/h8bsqldoiaau04i/Screenshot%202017-02-20%2014.20.11.jpeg?dl=0

And there is no field called “id” yet it appears the sql statement is looking for one.

So either the sql statement is incorrect or the data table is incorrect. Not sure which one is wrong or how to fix.

I do appreciate you taking the time to assist, unfortunately this time the steps have not worked. :frowning:

We had a similar problem, first try this https://johnlinhart.com/blog/uh-oh-mautic-upgrade-was-not-successful

If not help, so execute SQL commands from this souboru https://github.com/mautic/mautic/blob/staging/app/migrations/Version20170106102310.php

Hi @svet zitrka,

I tried all of the Uh-Oh stuff and none of it worked.

I can see that the SQL commands is what I need as I can see the changes to the database tables that it is trying to make and correlates wiht the error I am seeing.

Unfortunately this has not worked - perhaps I have done it incorrectly?

Steps performed. (NOTE: I only have access to file manager via a cpanel)

  1. I created a new file called “fix.php” in the root directory of my mautic installation i.e. [websiteurl/mautictoot]/fix.php
  2. I copied the full SQL PHP script from githib url above and pasted into the “fix.php” and saved the file.
  3. I then ran [websiteurl/mautictoot]/fix.php via web browser.
  4. I received the following error.

Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING) in /mautic_root_directory_path/fix.php on line 23
Could you please let me know if I have done something wrong.

This is lines 18-21 from the php file:

  1. /**
    • Auto-generated Migration: Please modify to your needs!
  2. */
  3. class Version20170106102310 extends AbstractMauticMigration

I tried replacing the “20170106102310” with my old and current CLASS versions (at seperate times) and I get the same error,

>> Previous Version:                             20170113143922
>> Current Version:                                20170127205928

Or is there a specific place where the “php” file should be placed in order to run correctly?

OK.
Issue is now SOLVED.

Thanks to everyone for your ideas and support.

I ended up having to run the SQL query directly in the database using php myadmin. @escopecz showed me how to change the SQL in the php file so I cold run it directly in the database.

The query I ran was

ALTER TABLE [databaseprefix]_campaign_lead_event_log
DROP PRIMARY KEY,
ADD id INT AUTO_INCREMENT NOT NULL,
ADD PRIMARY KEY(id),
ADD rotation INTEGER NOT NULL DEFAULT 1,
ADD INDEX [databaseprefix]_campaign_log_channel (channel, channel_id, lead_id),
ADD UNIQUE INDEX [databaseprefix]_campaign_rotation (event_id, lead_id, rotation),
DROP INDEX [databaseprefix]_campaign_leads,
ADD INDEX [databaseprefix]_campaign_leads (campaign_id, lead_id, rotation),
DROP INDEX [databaseprefix]_event_upcoming_search,
ADD INDEX [databaseprefix]_campaign_event_upcoming_search (is_scheduled, lead_id);

Once I ran this update directly in the database I was then able to use the php script to then do all of the doctrine updates - this time successfully!

I’m back on track.

Thanks again to @escopecz @MxyzptlkFishStix and @Svet Zitrka for your generous assistance.