From 2efd084ecce30c4c29e477e2c5dde6c4093e211b Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Wed, 25 Apr 2018 17:25:39 +0200 Subject: [PATCH] fix django.db.utils.IntegrityError: (1048, 'Column 'period_id' cannot be null') when running migration --- teleforma/migrations/0090_auto.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/teleforma/migrations/0090_auto.py b/teleforma/migrations/0090_auto.py index 146c7bb1..d8418e6f 100644 --- a/teleforma/migrations/0090_auto.py +++ b/teleforma/migrations/0090_auto.py @@ -20,8 +20,9 @@ class Migration(SchemaMigration): if not db.dry_run: for document in orm['teleforma.document'].objects.all(): - document.periods.add(document.period) - document.save() + if document.period: + document.periods.add(document.period) + document.save() -- 2.39.5