Просмотр исходного кода

Resolved migration discrepancies when dealing with NULL values

Jeremy Stretch 6 лет назад
Родитель
Сommit
180d3d0029

+ 5 - 0
netbox/dcim/migrations/0078_rack_type_to_slug.py

@@ -31,4 +31,9 @@ class Migration(migrations.Migration):
         migrations.RunPython(
             code=rack_type_to_slug
         ),
+        migrations.AlterField(
+            model_name='rack',
+            name='type',
+            field=models.CharField(blank=True, max_length=50),
+        ),
     ]

+ 1 - 1
netbox/dcim/migrations/0079_rack_status_to_slug.py

@@ -26,7 +26,7 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='rack',
             name='status',
-            field=models.CharField(blank=True, default='active', max_length=50),
+            field=models.CharField(default='active', max_length=50),
         ),
         migrations.RunPython(
             code=rack_status_to_slug

+ 5 - 0
netbox/dcim/migrations/0080_device_face_to_slug.py

@@ -28,4 +28,9 @@ class Migration(migrations.Migration):
         migrations.RunPython(
             code=device_face_to_slug
         ),
+        migrations.AlterField(
+            model_name='device',
+            name='face',
+            field=models.CharField(blank=True, max_length=50),
+        ),
     ]

+ 5 - 0
netbox/dcim/migrations/0081_devicetype_subdevicerole_to_slug.py

@@ -28,4 +28,9 @@ class Migration(migrations.Migration):
         migrations.RunPython(
             code=devicetype_subdevicerole_to_slug
         ),
+        migrations.AlterField(
+            model_name='devicetype',
+            name='subdevice_role',
+            field=models.CharField(blank=True, max_length=50),
+        ),
     ]

+ 1 - 0
netbox/dcim/models.py

@@ -922,6 +922,7 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
     subdevice_role = models.CharField(
         max_length=50,
         choices=SubdeviceRoleChoices,
+        blank=True,
         verbose_name='Parent/child status',
         help_text='Parent devices house child devices in device bays. Leave blank '
                   'if this device type is neither a parent nor a child.'