django - NOT NULL constraint failed when running `migrate` -
i changed models.py file , when running migrate
error. property onetoonefield(). have tried adding null=true
doesn't seem fix it. weird when comment out property , run makemigrations
followed migrate
, still exact same error. there way fix this? model looks this:
class estimator(employee): avg_estimate = models.integerfield() class job(models.model): created = models.datetimefield(auto_now_add=true) estimator = models.onetoonefield(estimator, null=true) address = models.charfield(max_length=100) completed = models.booleanfield(default=false)
my guess have created migration without null=true, won't migrate, created second migration null=true.
running "migrate" run both migrations in order, first 1 fail again.
assuming case, 1: delete 2 recent files in migrations folder. (open them first confirm creating migrations described before deleting them). 2: run makemigrations again, null=true in models.py
this should create equivalent of second migration file, without failing intermediate migration.
Comments
Post a Comment