I am working in Django 1.7 and trying to migrate a database field with a name is_dispensingfrom an existing one BooleanFieldin NullBooleanField.
My migration file:
from __future__ import unicode_literals
from 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,
),
]
The launch manage.py migratefails with the error:
django.db.utils.IntegrityError: column "is_dispensing" contains null values
Field in my models file:
is_dispensing = models.NullBooleanField(blank=True)
It used to be:
is_dispensing = models.BooleanField(null=True, blank=True)
and when I added it, I was asked to provide the default value that I set to None.
I find this message confusing - I'm trying to transfer the column type to NullBooleanField, so why can't it contain null values? That the whole point of this type of column is, isn't it? :)
UPDATE: , : Postgres , , is_dispensing.