]> git.parisson.com Git - teleforma.git/commitdiff
fix django.db.utils.IntegrityError: (1048, 'Column 'period_id' cannot be null') when...
authorYoan Le Clanche <yoan@ellington.pilotsystems.net>
Wed, 25 Apr 2018 15:25:39 +0000 (17:25 +0200)
committerYoan Le Clanche <yoan@ellington.pilotsystems.net>
Wed, 25 Apr 2018 15:25:39 +0000 (17:25 +0200)
teleforma/migrations/0090_auto.py

index 146c7bb1d639b64d83d4781755a83093664aeca6..d8418e6fca1340f4102bd5ac0c1e413d0eacad4a 100644 (file)
@@ -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()