Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-13360

rename_too_long_indexes migration never deleted the old unique index

    Details

      Description

      The migration tries to delete the old key:

      			'drop_keys' => array(
      				$this->table_prefix . 'search_wordmatch' => array(
      					'unq_mtch',
      				),
      			),

      tools:

      		// Remove keys?
      		if (!empty($schema_changes['drop_keys']))
      		{
      			foreach ($schema_changes['drop_keys'] as $table => $indexes)
      			{
      				foreach ($indexes as $index_name)
      				{
      					if (!$this->sql_index_exists($table, $index_name))
      					{
      						continue;
      					}
      
      					$result = $this->sql_index_drop($table, $index_name);
      ...
      				}
      			}
      		}

      However, sql_index_exists() ignores UNIQUE keys as per doc block:

      Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.

      Since the key we are trying to delete is a unique key, the function returns false and we skip the drop query (which wouldn't even work on some DB backends?)

      So we actually need to implement sql_unique_index_drop()

        Attachments

          Activity

            People

            • Assignee:
              nickvergessen Joas Schilling [X] (Inactive)
              Reporter:
              nickvergessen Joas Schilling [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: