[OJS 3.1.2.0 to 3.2] Upgrade Error - Duplicate column name ‘email_id’

Hi all,

Some folks have reported this issue in OJS 3.2.0-3 as well, and I’ve tracked down a data problem that can cause it. If you have custom-written email templates that have entries in the email_templates_data table, but don’t have corresponding entries in email_templates, then you can encounter the message during upgrade:

[data: dbscripts/xml/upgrade/3.2.0_update.xml]
ERROR: Upgrade failed: DB: Column 'email_id' cannot be null

To create the missing entries in your email_templates table, restore from backup, and before executing the upgrade script run the following SQL statement:

INSERT IGNORE INTO email_templates (email_key, assoc_type, assoc_id, enabled) SELECT etd.email_key, etd.assoc_type, etd.assoc_id, 1 FROM email_templates_data etd;

Regards,
Alec Smecher
Public Knowledge Project Team