Set initial Value and auto increment

Hi,
How to set initial value and then it should auto increment in model DB

Thanks

Welcome @Nifrash !

See AutoField and BigAutoField.

Setting the initial value depends upon the database you’re using. The sqlsequencereset management command will help you identify the SQL syntax to be used. You could then use this information to create a custom migration for your app for that one field. (You most likely would not want to just copy that entire output - it would reset all sequences in the app.)

Dear Ken,
Thank for the resposne, Please see my model,

class contract(models.Model):

id = models.UUIDField(default=uuid.uuid4, unique=True, editable=False, primary_key=True)
owner = models.ForeignKey(Profile, on_delete=models.SET_NULL, null=True, blank=True)
**contact_number** = models.IntegerField(default=750000, null=True, blank=True,)
name = models.CharField(max_length=100)
contract_value = models.IntegerField()
assets = models.ForeignKey('budget', on_delete=models.CASCADE)
award = models.ForeignKey('vendor', on_delete=models.CASCADE)
scope = models.TextField(null=True, blank=True)
created = models.DateTimeField(auto_now_add=True)

the first number should start with 750000, then second contract number should 750001… with auto increment