From 0569b72b41f5f3f8c72d9f964f68ef1055dafd79 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Mon, 17 Sep 2018 11:31:50 +0530 Subject: [PATCH] remove upgrade code --- CRM/Core/BAO/SchemaHandler.php | 11 -------- CRM/Upgrade/Incremental/php/FiveFive.php | 34 ------------------------ 2 files changed, 45 deletions(-) diff --git a/CRM/Core/BAO/SchemaHandler.php b/CRM/Core/BAO/SchemaHandler.php index b9befac3dd..1a926044ff 100644 --- a/CRM/Core/BAO/SchemaHandler.php +++ b/CRM/Core/BAO/SchemaHandler.php @@ -411,17 +411,6 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )"; CRM_Core_DAO::executeQuery($sql); } - /** - * @param string $tableName - * @param array $fields - * @param string $prefix - */ - public static function createUniqueIndex($tableName, $fields, $prefix = 'UI') { - $uniqueIndexName = sprintf('%s_%s', $prefix, implode('_', $fields)); - $sql = sprintf(" ALTER TABLE %s ADD UNIQUE INDEX `%s` (%s)", $tableName, $uniqueIndexName, implode(', ', $fields)); - CRM_Core_DAO::executeQuery($sql); - } - /** * Create indexes. * diff --git a/CRM/Upgrade/Incremental/php/FiveFive.php b/CRM/Upgrade/Incremental/php/FiveFive.php index e563ebe6c6..3db8c87526 100644 --- a/CRM/Upgrade/Incremental/php/FiveFive.php +++ b/CRM/Upgrade/Incremental/php/FiveFive.php @@ -46,40 +46,6 @@ class CRM_Upgrade_Incremental_php_FiveFive extends CRM_Upgrade_Incremental_Base // } } - /** - * Upgrade function. - * - * @param string $rev - */ - public function upgrade_5_5_alpha1($rev) { - $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); - $this->addTask('Entity File schema updates', 'entityFileSchemaUpdate'); - } - - /** - * dev/core#321 - Prevent duplicate entries in civicrm_entity_file - * - * @param \CRM_Queue_TaskContext $ctx - * - * @return bool - */ - public static function entityFileSchemaUpdate(CRM_Queue_TaskContext $ctx) { - if (CRM_Core_BAO_SchemaHandler::checkIfIndexExists('civicrm_entity_file', 'index_entity_file_id')) { - // Delete any stray duplicate rows and add unique index to prevent new dupes and enable INSERT/UPDATE combo query - CRM_Core_DAO::executeQuery(' - DELETE ef1 FROM civicrm_entity_file ef1, civicrm_entity_file ef2 - WHERE ef1.entity_table = ef2.entity_table AND - ef1.entity_id = ef2.entity_id AND - ef1.file_id = ef2.file_id AND - ef1.id > ef2.id - '); - CRM_Core_DAO::executeQuery('ALTER TABLE civicrm_entity_file DROP INDEX `index_entity_file_id`'); - CRM_Core_BAO_SchemaHandler::createUniqueIndex('civicrm_entity_file', ['entity_table', 'entity_id', 'file_id']); - } - - return TRUE; - } - /** * Compute any messages which should be displayed after upgrade. * -- 2.25.1