django - Revert migration on deleted not null field -
i've got model non-null field deleted:
class spam(models.model): slug = models.slugfield(allow_unicode=true) # deleted after made migrations , applied them, wanted revert them. obviously, results in
django.db.utils.integrityerror: not null constraint failed: eggs_spam.slug how can revert migration?
that's tricky. solution can think of following:
1: first, create migration allows slug field nullable
2: then, create migration populate field every row
3: lastly, create migration makes field non-nullable.
hope helps
Comments
Post a Comment