Last modified 3 years ago
db.create_index
South 0.4 and up
db.create_index(table_name, column_names, unique=False, db_tablespace='')
Creates an index on the columns column_names on the table table_name.
By default, the index is simply for speed; if you would like a unique index, then specify unique=True.
db_tablespace is an Oracle-specific option, and it's likely you won't need to use it.
This is the command you need to run if, for example, you add something to a model's unique_together.
Examples
Creating an index on the 'name' column:
db.create_index('core_profile', ['name'])
Creating a unique index on the combination of 'name' and 'age' columns:
db.create_index('core_profile', ['name', 'age'], unique=True)
