From: Yoan Le Clanche Date: Wed, 25 Apr 2018 15:25:39 +0000 (+0200) Subject: fix django.db.utils.IntegrityError: (1048, 'Column 'period_id' cannot be null') when... X-Git-Tag: 1.2~3 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2efd084ecce30c4c29e477e2c5dde6c4093e211b;p=teleforma.git fix django.db.utils.IntegrityError: (1048, 'Column 'period_id' cannot be null') when running migration --- 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()