On Jul 3, 2016 4:18 PM, "Gary Roach" <gary719_list1@verizon.net> wrote:
>
> Hi all
>
>
> I'm still working on the official django tutorial (https//docs.djangoproject.com/en/1.9/intro/tutorial/02/) on the section that is adding the Question table.
>
> I'm using Eclipse Neon with PyDev IDE
> Django 1.9
> Pyathon 3.5
> SqLite DBMS
> OS Debian Stretch Linux
> KDE Desktop
>
> While working with the database API I have managed to run the auto-increment field up and can't find a way to reset it. Does anyone know how to do this. There are a lot of suggestions out there but I have yet to find one that works.
>
That's a bit surprising. A quick Google search points at resetting the proper values in the sqlite_sequence table.
Other options:
You can drop the table and recreate it.
You can drop the database and recreate it.
Obviously those options can have detrimental effects on your data.
The better question is why would you?
The autoincrement fields for columns are meant to be autonomous and guaranteed unique. Toying with those values can and will lead to data inconsistencies. That's why there isn't a 'simple' way to reset that counter.
If you're only doing it to keep the numbers low while you're developing, it really isn't worth it. You'll quickly reach a point where it is not feasible to drop all of the data and start over, and you need to ensure your dev environment is as close to production as it can be.
-James
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXLFxY8Gm_Wo1%2BftkDmiW9LB65Rs67Z1Cau1wa%3DMyPhwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment