Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-13360

rename_too_long_indexes migration never deleted the old unique index

XMLWordPrintable

      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()

            nickvergessen Joas Schilling
            nickvergessen Joas Schilling
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: