5.59 upgrade brings down entire site if multilingual is enabled
To replicate, have a Civi 5.58 site, enable multilingual, and upgrade to 5.59.
You'll start seeing WSODs with DB Error: -32
. My further research found ERROR 1054 (42S22): Unknown column 'nasco_dev_civi.civicrm_custom_field.mask' in 'field list'
.
Because the custom field table is multilingual-enabled, and the multilingual views seem to not be rebuilt (or rebuilt after the mask
column is dropped), the views reference a non-existent field and everything stops working.
For folks who already upgraded and are in this situation, you have some options:
If you can run API commands from the command line, you can run System.rebuildmultilingualschema
, e.g.:
cv api System.rebuildmultilingualschema
drush cvapi System.rebuildmultilingualschema
wp civicrm api System.rebuildmultilingualschema
NOTE: The above approach worked temporarily for me, but then stopped working. However, I'm not sure if my further testing affected this.
This second approach is less well-tested, but you made a backup before you upgraded...right? If not, back up now:
- Identify the views associated with
civicrm_custom_field
- e.g.civicrm_custom_field_en_US
,civicrm_custom_field_es_MX
, etc. - Run the following commands once per language you have installed. In this command, I'm fixing
_en_US
. Run this once per language, doing a search/replace on the text below to change outen_US
for your languages. E.g. I haveen_US
andes_MX
, so I ran this once unmodified, then did a search/replace foren_US
toes_MX
.
DROP VIEW civicrm_custom_field_en_US;
CREATE VIEW `civicrm_custom_field_en_US` AS select `civicrm_custom_field`.`id` AS `id`,`civicrm_custom_field`.`custom_group_id` AS `custom_group_id`,`civicrm_custom_field`.`name` AS `name`,`civicrm_custom_field`.`data_type` AS `data_type`,`civicrm_custom_field`.`html_type` AS `html_type`,`civicrm_custom_field`.`default_value` AS `default_value`,`civicrm_custom_field`.`is_required` AS `is_required`,`civicrm_custom_field`.`is_searchable` AS `is_searchable`,`civicrm_custom_field`.`is_search_range` AS `is_search_range`,`civicrm_custom_field`.`weight` AS `weight`,`civicrm_custom_field`.`attributes` AS `attributes`,`civicrm_custom_field`.`javascript` AS `javascript`,`civicrm_custom_field`.`is_active` AS `is_active`,`civicrm_custom_field`.`is_view` AS `is_view`,`civicrm_custom_field`.`options_per_line` AS `options_per_line`,`civicrm_custom_field`.`text_length` AS `text_length`,`civicrm_custom_field`.`start_date_years` AS `start_date_years`,`civicrm_custom_field`.`end_date_years` AS `end_date_years`,`civicrm_custom_field`.`date_format` AS `date_format`,`civicrm_custom_field`.`time_format` AS `time_format`,`civicrm_custom_field`.`note_columns` AS `note_columns`,`civicrm_custom_field`.`note_rows` AS `note_rows`,`civicrm_custom_field`.`column_name` AS `column_name`,`civicrm_custom_field`.`option_group_id` AS `option_group_id`,`civicrm_custom_field`.`filter` AS `filter`,`civicrm_custom_field`.`in_selector` AS `in_selector`,`civicrm_custom_field`.`serialize` AS `serialize`,`civicrm_custom_field`.`label_en_US` AS `label`,`civicrm_custom_field`.`help_pre_en_US` AS `help_pre`,`civicrm_custom_field`.`help_post_en_US` AS `help_post` from `civicrm_custom_field`