#24058: Sequance is dropped from AutoIncrement field on postgre when changing
verbose name
-------------------------------+--------------------------------
Reporter: hakib | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Keywords: migration, postgre
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------
After adding `verbose_name` to an id field with auto increment I started
getting errors on null PK. Further investigation reviled that after
applying migration the id column was altered in a way that caused the
sequence to be dropped. As far as i can tell this is an issue only on
postgre.
Altering the id field manually to associate the sequence solved the
problem.
On my dev machine using sqlite this issue is not happening.
{{{
class MyModel(models.Model):
id = models.AutoField(primary_key=True)
name = models.TextField(null=False,blank=False)
./manage.py makemigrations app
./manage.py migrate app
class MyModel(models.Model):
id = models.AutoField(primary_key=True, verbose_name='Identity')
name = models.TextField(null=False,blank=False)
./manage.py makemigrations app
./manage.py migrate app
manage.py shell
o = MyModel.objects.create(name='Will fail on NN constraint')
}}}
Python 2.7, Django 1.7, Postgresql 9.2
--
Ticket URL: <https://code.djangoproject.com/ticket/24058>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.6a777774abfe6809b22aa2afe7fca386%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.