I wrote a simple script for populating the table created with Django models. I did make mistakes during the development process and have corrupted data in my table (it is accessible but has wrong images, names, urls). I want to erase this data and start the populating over, but it looks like the table stores previous primary keys (so the new objects do not start from pk=1
) if I just use Model.objects.all().delete()
.
How can I erase all the previous data without DROP TABLE
? If DROP
is the most convenient way, is this Django : Table doesn't exist solution for restoring is the only one?
The desired functionality is erasing data before every script run, automatically. Thank you in advance.