I am using Django v1.7 and I need to set the initial auto increment value to something like 1000000, I couldn't find any Django docs that shows there is a feature like this, and the model I have have a lot of dependencies, so it's not easy to create a dummy record with key specified and then delete it.
So the only sensible way I think is to put alter table tablename auto_increment=1000000
in the initial migration file, but I also cannot find a way in this documentation
The question is how do I do that in the new migration system?
Sweet, found this documentation
Just add this in the operations array
operations = [
migrations.CreateModel(...),
# mysql specific
migrations.RunSQL('alter table tablename auto_increment=1000000'),
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With