Repository: netbox-community/netbox

Issue:
`migrate` command raises a warning about uncaptured model changes
### NetBox version

v3.6.0

### Python version

3.8

### Steps to Reproduce

1. Run `manage.py migrate` (which is called by the upgrade script)
2. Inspect the command output

### Expected Behavior

The command should apply any outstanding migrations or return the message "No migrations to apply." without any warnings.

### Observed Behavior

The command completes successfully but raises a warning about unreflected model changes:

```
$ ./manage.py migrate
Operations to perform:
  Apply all migrations: account, admin, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, wireless
Running migrations:
  No migrations to apply.
  Your models in app(s): 'circuits', 'core', 'dcim', 'extras', 'ipam', 'tenancy', 'users', 'virtualization', 'wireless' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
```


Discussion:

Resolving patch:
diff --git a/netbox/core/apps.py b/netbox/core/apps.py
--- a/netbox/core/apps.py
+++ b/netbox/core/apps.py
@@ -1,4 +1,15 @@
 from django.apps import AppConfig
+from django.db import models
+from django.db.migrations.operations import AlterModelOptions
+
+from utilities.migration import custom_deconstruct
+
+# Ignore verbose_name & verbose_name_plural Meta options when calculating model migrations
+AlterModelOptions.ALTER_OPTION_KEYS.remove('verbose_name')
+AlterModelOptions.ALTER_OPTION_KEYS.remove('verbose_name_plural')
+
+# Use our custom destructor to ignore certain attributes when calculating field migrations
+models.Field.deconstruct = custom_deconstruct
 
 
 class CoreConfig(AppConfig):
diff --git a/netbox/core/management/commands/makemigrations.py b/netbox/core/management/commands/makemigrations.py
--- a/netbox/core/management/commands/makemigrations.py
+++ b/netbox/core/management/commands/makemigrations.py
@@ -1,18 +1,6 @@
-# noinspection PyUnresolvedReferences
 from django.conf import settings
 from django.core.management.base import CommandError
 from django.core.management.commands.makemigrations import Command as _Command
-from django.db import models
-from django.db.migrations.operations import AlterModelOptions
-
-from utilities.migration import custom_deconstruct
-
-# Monkey patch AlterModelOptions to ignore verbose name attributes
-AlterModelOptions.ALTER_OPTION_KEYS.remove('verbose_name')
-AlterModelOptions.ALTER_OPTION_KEYS.remove('verbose_name_plural')
-
-# Set our custom deconstructor for fields
-models.Field.deconstruct = custom_deconstruct
 
 
 class Command(_Command):
diff --git a/netbox/core/management/commands/migrate.py b/netbox/core/management/commands/migrate.py
deleted file mode 100644
--- a/netbox/core/management/commands/migrate.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# noinspection PyUnresolvedReferences
-from django.core.management.commands.migrate import Command
-from django.db import models
-
-from utilities.migration import custom_deconstruct
-
-models.Field.deconstruct = custom_deconstruct


Test patch: