Given the following model, I want to index the fields (sequence,stock)
class QuoteModel(models.Model):
quotedate = models.DateField()
high = models.FloatField() #(9,2) DEFAULT NULL,
low = models.FloatField() #(9,2) DEFAULT NULL,
close = models.FloatField() #(9,2) DEFAULT NULL,
closeadj = models.FloatField() #(9,2) DEFAULT NULL,
volume = models.IntegerField() #(9,2) DEFAULT NULL,
stock = models.IntegerField(db_index=True) #(9,2) DEFAULT NULL,
open = models.FloatField() #(9,2) DEFAULT NULL,
sequence = models.IntegerField() #(9,2) DEFAULT NULL,
This index should be non-unique - in mysql it should be something
like:
create index ndx_1 on model_quotemodel(sequence,stock);
The only Django workaround I know of is creating an "sql" file that
will be executed by django upon table creation. So, I created a
"stockmodel.sql" containing the following query (same as above:)
create index ndx_1 on model_quotemodel(sequence,stock);
Is there any "cleaner" way of doing it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---