/** * Returns list of indexes that should be dropped. * * @param old_table original table * @param new_table new table * * @return list of indexes that should be dropped * * @todo Indexes that are depending on a removed field should not be added * to drop because they are already removed. */ public static function get_drop_indexes($old_schema, $old_table, $new_schema, $new_table) { $list = array(); if ($new_table != null && $old_table != null) { foreach (format_index::get_table_indexes($old_schema, $old_table) as $old_index) { $new_index = dbx::get_table_index($new_schema, $new_table, $old_index['name']); if (!format_table::contains_index($new_schema, $new_table, $old_index['name'])) { $list[] = $old_index; } else { if (!format_index::equals($new_index, $old_index)) { $list[] = $old_index; } } } } return $list; }