From ee88c2f7d2aaead7f2ccfd59c3b9a55ec53b55b0 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 12 Feb 2024 11:06:44 -0800 Subject: [PATCH] 14438 optimize migration --- netbox/extras/migrations/0108_script_models.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/netbox/extras/migrations/0108_script_models.py b/netbox/extras/migrations/0108_script_models.py index 4e381a25f..385745f47 100644 --- a/netbox/extras/migrations/0108_script_models.py +++ b/netbox/extras/migrations/0108_script_models.py @@ -17,13 +17,9 @@ def update_event_rules(apps, schema_editor): obj, created = Script.objects.get_or_create( module_id=rule.action_object_id, name=name, + defaults={'is_valid': False} ) - if created: - # script in action_parameters was deleted? - obj.is_valid = False - obj.save() - rule.action_object_type = ct rule.action_object_id = obj.id rule.save()