We have a lot of such fields in our database and never seen such an error.
What I can think that may happen is that some row already assigned the id 
of 0, and changing the column type or adding a id column (which probably 
overrides the automatic one django generates for each model), and now it 
can convert the column.

Try to make a data migrations which adds +1 to all rows ids or reinserting 
that specific row (hopefully it won't be too hard), and see if it resolves 
your issue

hope it helps

On Thursday, January 5, 2023 at 12:09:35 PM UTC+2 prashan...@gmail.com 
wrote:

> I'm using MySQL database in django when I am creating
>
> Id=models.AutoField(primary_key=True)
>
> It's showing below error.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d250fd44-3dfc-4644-8d14-f1ad85f31abdn%40googlegroups.com.

Reply via email to