python - Django: migration to NullBooleanField fails with IntegrityError "contains null values" -
i'm working in django 1.7 , trying migrate database field called is_dispensing
existing booleanfield
nullbooleanfield
.
my migration file:
# -*- coding: utf-8 -*- __future__ import unicode_literals django.db import models, migrations class migration(migrations.migration): dependencies = [ ('frontend', '0007_practice_is_dispensing'), ] operations = [ migrations.alterfield( model_name='practice', name='is_dispensing', field=models.nullbooleanfield(), preserve_default=true, ), ]
running manage.py migrate
fails error:
django.db.utils.integrityerror: column "is_dispensing" contains null values
the field in models file:
is_dispensing = models.nullbooleanfield(blank=true)
previously was:
is_dispensing = models.booleanfield(null=true, blank=true)
and when added it, asked provide default value, set none.
i find message confusing - i'm trying migrate column type nullbooleanfield
, why can't contain null values? that's whole point of column type, isn't it? :)
update: thing that's confusing: if go postgres , @ table that's supposed have column, doesn't have is_dispensing
column @ all.
Comments
Post a Comment