Monday, 27 September 2021

AutoField is not reducing the length of column

I am trying to create auto increment field for tiny integer like int(3).

If I try AutoField, it generates length of 11. If I use max_length, migration ignores it.

SmallIntegerField gives int(6) without auto increment.

My model definition:

class tblroles(models.Model):
    role_id = SmallIntegerField(primary_key=True, verbose_name="role_id")
    name = CharField(max_length=20)
    is_active = BooleanField(default=False)


from AutoField is not reducing the length of column

No comments:

Post a Comment