Search code examples
pythondjangoautofield

How to get Django AutoFields to start at a higher number


For our Django App, we'd like to get an AutoField to start at a number other than 1. There doesn't seem to be an obvious way to do this. Any ideas?


Solution

  • Like the others have said, this would be much easier to do on the database side than the Django side.

    For Postgres, it'd be like so: ALTER SEQUENCE sequence_name RESTART WITH 12345; Look at your own DB engine's docs for how you'd do it there.