1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#4721: Tweak migrations to ensure Interface.device cannot be null

This commit is contained in:
Jeremy Stretch
2020-07-02 13:12:37 -04:00
parent 1f9cdc71d4
commit 6abb7e8f4d
2 changed files with 11 additions and 5 deletions

View File

@@ -51,8 +51,8 @@ def replicate_interfaces(apps, schema_editor):
# Verify that all interfaces have been replicated
assert replicated_count == original_interfaces.count(), "Replicated interfaces count does not match original count!"
# Delete original VM interfaces
original_interfaces.delete()
# Delete all interfaces not assigned to a Device
Interface.objects.filter(device__isnull=True).delete()
class Migration(migrations.Migration):