﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30867	Old indexes should be dropped after new ones are created.	Simon Charette	nobody	"When adding `unique=True` to a field previously `index=True` field or vice-versa the old index is dropped before the new one is added.

This is not a big issue on backends that support transactional DDL but it is on ones that don't because in between the execution of the two statements the column is not indexed.

For example given the following model

{{{#!python
class Author(models.Model):
    name = models.CharField(max_length=50, db_index=True)
}}}

Altering `name` to `models.CharField(max_length=50, unique=True)` will generate the following SQL on MySQL

{{{#!sql
DROP INDEX `author_name_idx` ON `author`;
-- Until the following statement completes the name field is not indexed at all.
-- This can take a while on large tables.
ALTER TABLE `author` ADD CONSTRAINT `author_name_uniq` UNIQUE (`name`);
}}}"	Cleanup/optimization	closed	Migrations	dev	Normal	wontfix			Accepted	0	0	0	0	0	0
