Django - Is it ok to erase django generated database indexes?
AFAIK django creates indexes for you in the database (I use MySQL). As these indexes are preventing me from altering column names as part of a south migration I'm performing, I would like to remove these indexes.
Is it legitimate to manually erase django indexes?
Will django recrea开发者_JS百科te them?I guess you are altering a unique_together
constraint that is stored as an index, in mysql.
And, no django doesn't create it if you delete it, on the fly.
If you delete it manually, you need to create the relevant one, manually as well.
You can see the one that should be created, by ./manage.py sqlall appname
Update (based on your comments):
Jonathan, you are saying that you are trying to migrate.
So, I guess you have already changed the model, and the index that is existing in the db is the one generated in an earlier state of models, at which your syncdb was executed;
Also note that mysql stores unique_together constraints as indexes, and so it adds relevant indexes even without you (or django in this case) having to explicitly ask for it.
精彩评论