I received the notice that Mautic 2.2.1 update was available, and tried the web interface for the update. It was stuck on the ‘deleting cache’ step, and never finished (by the way, this same thing happened on the upgrade to 2.2.0).
After waiting for 30 minutes, I gave up and decided to browse the system. It worked partially. When I looked at the details of a contact (known or anonymous), the server gave me a ‘500 sever error’.
Looking in the logs of the Mautic system , which are located in this directory: /mautic_install_directory/app/logs, I found the following files:
total 1992
-rw-r--r-- 1 apache apache 2571 Oct 8 18:26 mautic_prod-2016-10-08.php
-rw-r--r-- 1 apache apache 1040 Oct 9 09:11 mautic_prod-2016-10-09.php
-rw-r--r-- 1 apache apache 4485 Oct 10 17:07 mautic_prod-2016-10-10.php
-rw-r--r-- 1 apache apache 11499 Oct 11 17:29 mautic_prod-2016-10-11.php
-rw-r--r-- 1 apache apache 4522 Oct 12 12:31 mautic_prod-2016-10-12.php
-rw-r--r-- 1 apache apache 4249 Oct 13 11:07 mautic_prod-2016-10-13.php
-rw-r--r-- 1 apache apache 1961089 Oct 14 07:25 prod-2016-10-14.php
-rw-r--r-- 1 apache apache 27951 Oct 14 08:40 mautic_prod-2016-10-14.php
then looking at the end of the newest file (mautic_prod-2016-10-14.php), I found this:
Picking out the error... Unknown column 'stage_id' in 'field list' , I decided that the database was never upgraded properly, either on this current migration to 2.2.1, or an earlier one.
Using the instructions on this page:
https://github.com/mautic/mautic
I found these database migration instructions:
After logging into the command line on my self hosted server:
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
Mautic Migrations
WARNING! You have 4 previously executed migrations in the database that are not registered migrations.
>> 2015-02-01 00:00:00 (20150201000000)
>> 2015-02-25 00:00:00 (20150225000000)
>> 2015-03-07 00:00:00 (20150307000000)
>> 2015-03-10 00:00:00 (20150310000000)
Are you sure you wish to continue? (y/n)y
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y
Migrating up to 20161004123446 from 20160712000001
SS skipped (Reason: Schema includes this migration)
++ migrating 20160720000000
-> DELETE FROM it_lead_utmtags WHERE utm_campaign is null and utm_content is null and utm_medium is null and utm_source is null and utm_term is null
++ migrated (1.1s)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
++ migrating 20160726000001
-> ALTER TABLE it_emails DROP FOREIGN KEY FK_160D6C949091A2FB
-> ALTER TABLE it_emails ADD CONSTRAINT FK_160D6C949091A2FB FOREIGN KEY (translation_parent_id) REFERENCES it_emails (id) ON DELETE CASCADE
-> ALTER TABLE it_emails DROP FOREIGN KEY FK_160D6C9491861123
-> ALTER TABLE it_emails ADD CONSTRAINT FK_160D6C9491861123 FOREIGN KEY (variant_parent_id) REFERENCES it_emails (id) ON DELETE CASCADE
-> ALTER TABLE it_pages DROP FOREIGN KEY FK_A92F388B9091A2FB
-> ALTER TABLE it_pages ADD CONSTRAINT FK_A92F388B9091A2FB FOREIGN KEY (translation_parent_id) REFERENCES it_pages (id) ON DELETE CASCADE
-> ALTER TABLE it_pages DROP FOREIGN KEY FK_A92F388B91861123
-> ALTER TABLE it_pages ADD CONSTRAINT FK_A92F388B91861123 FOREIGN KEY (variant_parent_id) REFERENCES it_pages (id) ON DELETE CASCADE
-> ALTER TABLE it_dynamic_content DROP FOREIGN KEY FK_DEB684479091A2FB
-> ALTER TABLE it_dynamic_content ADD CONSTRAINT FK_DEB684479091A2FB FOREIGN KEY (translation_parent_id) REFERENCES it_dynamic_content (id) ON DELETE CASCADE
-> ALTER TABLE it_dynamic_content DROP FOREIGN KEY FK_DEB6844791861123
-> ALTER TABLE it_dynamic_content ADD CONSTRAINT FK_DEB6844791861123 FOREIGN KEY (variant_parent_id) REFERENCES it_dynamic_content (id) ON DELETE CASCADE
++ migrated (10.76s)
SS skipped (Reason: Schema includes this migration)
++ migrating 20160731000000
-> update it_campaign_lead_event_log log inner join it_campaign_events events on log.event_id = events.id set log.metadata = 'a:0:{}' where events.type = 'email.send' and log.metadata = 'a:2:{s:6:"failed";i:1;s:6:"reason";s:50:"mautic.notification.campaign.failed.not_subscribed";}'
++ migrated (1.1s)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
SS skipped (Reason: Schema includes this migration)
++ migrating 20160926182807
-> insert into it_companies (companyname, is_published) (SELECT DISTINCT TRIM(company), 1 from it_leads l left join it_companies c ON l.company = c.companyname where company IS NOT NULL and company <> '' and c.companyname is null)
-> insert into it_companies_leads (company_id, lead_id, date_added, manually_added, manually_removed) SELECT c.id, l.id, '2016-10-14 13:06:49', 0, 0 from it_leads l join it_companies c on c.companyname = l.company ON DUPLICATE KEY UPDATE company_id = c.id;
++ migrated (1.24s)
++ migrating 20161004080958
-> ALTER TABLE it_asset_downloads CHANGE referer referer LONGTEXT DEFAULT NULL
-> ALTER TABLE it_form_submissions CHANGE referer referer LONGTEXT NOT NULL
-> ALTER TABLE it_lead_utmtags CHANGE referer referer LONGTEXT DEFAULT NULL
++ migrated (5.66s)
++ migrating 20161004090629
-> CREATE INDEX it_stat_email_search2 ON it_email_stats (lead_id, email_id)
++ migrated (1.61s)
++ migrating 20161004123446
-> ALTER TABLE it_lead_stages_change_log ADD stage_id INT(11) NULL DEFAULT NULL;
-> ALTER TABLE it_lead_stages_change_log ADD CONSTRAINT FK_C0EE6592298D193 FOREIGN KEY (stage_id) REFERENCES it_stages (id) ON DELETE CASCADE
-> CREATE INDEX IDX_C0EE6592298D193 ON it_lead_stages_change_log (stage_id)
++ migrated (3.9s)
++ finished in 25.37s
++ 19 migrations executed
++ 23 sql queries
Figuring that if all was fixed, it would not need to run the migration commands again, I ran the command again:
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
Mautic Migrations
WARNING! You have 4 previously executed migrations in the database that are not registered migrations.
>> 2015-02-01 00:00:00 (20150201000000)
>> 2015-02-25 00:00:00 (20150225000000)
>> 2015-03-07 00:00:00 (20150307000000)
>> 2015-03-10 00:00:00 (20150310000000)
Are you sure you wish to continue? (y/n)y
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y
No migrations to execute.
All was fixed, and the system is up and running.
Hope this helps someone with this or a similar problem.