Ignore extraneous field attributes when generating database migrations #1941

Closed
opened 2025-12-29 17:20:45 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Aug 15, 2018).

Proposed Changes

Exclude certain field attributes from analysis when making migrations:

  • verbose_name
  • help_text
  • choices
  • Possibly others

This should be doable by overriding the makemigrations management command.

Justification

Django has an annoying habit of generating migrations when model fields are altered, even if those changes don't result in any modifications to the database schema. For example, modifying the help_text on a model field will trigger a migration, even though it obviously has no effect on the database. This is especially annoying when updating choice fields, such as Interface.form_factor: Each modification to the list of choices triggers a migration, yet the list of choices is not actually conveyed as a constraint on the table.

Originally created by @jeremystretch on GitHub (Aug 15, 2018). ### Proposed Changes Exclude certain field attributes from analysis when making migrations: * `verbose_name` * `help_text` * `choices` * Possibly others This should be doable by overriding the `makemigrations` [management command](https://github.com/django/django/blob/master/django/core/management/commands/makemigrations.py). ### Justification Django has an annoying habit of generating migrations when model fields are altered, even if those changes don't result in any modifications to the database schema. For example, modifying the `help_text` on a model field will trigger a migration, even though it obviously has no effect on the database. This is especially annoying when updating choice fields, such as `Interface.form_factor`: Each modification to the list of choices triggers a migration, yet the list of choices is not actually conveyed as a constraint on the table.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 17:20:45 +01:00
adam closed this issue 2025-12-29 17:20:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1941