Skip to content

Instantly share code, notes, and snippets.

@axon-obriend
Created February 8, 2018 16:07
Show Gist options
  • Select an option

  • Save axon-obriend/c23ce11a25cae8f7a6c3b414d2bd866d to your computer and use it in GitHub Desktop.

Select an option

Save axon-obriend/c23ce11a25cae8f7a6c3b414d2bd866d to your computer and use it in GitHub Desktop.
SET foreign_key_checks='OFF';
ALTER TABLE civicrm_prevnext_cache DROP INDEX index_all;
ALTER TABLE civicrm_prevnext_cache ADD INDEX index_all (cacheKey, entity_id1, entity_id2, entity_table, is_selected);
ALTER TABLE civicrm_contact ADD INDEX index_is_deceased (is_deceased);
ALTER TABLE civicrm_entity_financial_account ADD UNIQUE INDEX index_entity_id_entity_table_account_relationship (entity_id, entity_table, account_relationship);
ALTER TABLE civicrm_option_value DROP FOREIGN KEY FK_civicrm_option_value_option_group_id;
ALTER TABLE civicrm_option_value DROP INDEX index_option_group_id_name;
ALTER TABLE civicrm_option_value ADD INDEX index_option_group_id_name (name(128), option_group_id);
ALTER TABLE civicrm_option_value ADD CONSTRAINT `FK_civicrm_option_value_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group` (`id`) ON DELETE CASCADE;
ALTER TABLE civicrm_case_contact DROP FOREIGN KEY FK_civicrm_case_contact_contact_id;
ALTER TABLE civicrm_case_contact DROP FOREIGN KEY FK_civicrm_case_contact_case_id;
ALTER TABLE civicrm_case_contact DROP INDEX UI_case_contact_id;
ALTER TABLE civicrm_case_contact ADD UNIQUE INDEX UI_case_contact_id (case_id, contact_id);
ALTER TABLE civicrm_case_contact ADD CONSTRAINT FK_civicrm_case_contact_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact (id) ON DELETE CASCADE;
ALTER TABLE civicrm_case_contact ADD CONSTRAINT FK_civicrm_case_contact_case_id FOREIGN KEY (case_id) REFERENCES civicrm_case (id) ON DELETE CASCADE;
ALTER TABLE civicrm_uf_group ADD UNIQUE INDEX UI_name (name);
ALTER TABLE civicrm_mailing_event_queue ADD INDEX index_hash (hash);
ALTER TABLE civicrm_activity ADD INDEX index_activity_date_time (activity_date_time);
ALTER TABLE civicrm_activity ADD INDEX index_status_id (status_id);
ALTER TABLE civicrm_event DROP INDEX index_parent_event_id;
ALTER TABLE civicrm_event ADD INDEX index_parent_event_id (parent_event_id);
SET foreign_key_checks='ON';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment