from django.db import models
from django.db.models import Model
class Word(Model):
word = models.CharField(unique=True, db_index=True, max_length=30)
num = models.IntegerField(default=0, editable=False)
(actually it was much much more complicated, but i reduced it to this
and the problem still applies)
according to:
http://docs.djangoproject.com/en/dev/ref/models/fields/#db-index
when later running
python manage.py sqlindexes blog
it should output the create index statements for the relevant fields
but it doesn't work... with this bare models.py, it won't obviously
output anything else, but i also tried with the previous and bigger
models.py (with another model with a slugfield and a many-many
relationship with another model) and in that case it makes 2 create
index statement for these fields (but nothing for my Word.word field)
I also tried both with unique=True and without, since it seems that
that may be the cause of this problem:
http://stackoverflow.com/questions/2234423/django-db-index-issue
i also found some other people with apparently the same problem:
http://www.itarchive.org/7437/349
but i've found no related bug on the bug tracker (except for a not-
very-related and also old and fixed one: http://code.djangoproject.com/ticket/1828
)
my db is sqlite...
since i was fearing this may be related to the problem, i tried also
with mysql (but i never had to use mysql directly before)... upon
changing the relevant settings, though the sqlindexes command doesn't
change its ouput...
I also tried to look into the mysql db, with "show indexes from
blog_word" but i can't see to find anything different from the other
tables (also blog_tag for example, another model from the richer
models.py that shouldn't have any index at all, under index_type
lists: "BTREE"), then again i'm not used with mysql terminology
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment