Opened 5 years ago

Last modified 11 months ago

#31700 closed New feature

Highlight destructive operations in makemigrations output — at Version 1

Reported by: Tom Forbes Owned by: nobody
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: David Wobrock Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tom Forbes)

Makemigrations should highlight destructive and potentially destructive operations in the console output. We advise that makemigrations is only a code generator people sometimes apply them without looking. Highlighting dangerous operations in the output will make them stand out, and might help them notice issues before they blindly apply.

For example:

$ ./manage.py makemigrations ...
Migrations for 'some_app':
  some_app/migrations/0002_delete.py
    - Delete model SomeModel
    + Add model AnotherModel
    ~ Alter field X on Y

We can use - as a prefix for known destructive operations, + for "safe" operations and ~ for possibly-destructive operations, colour coded as red, green and yellow respectively.

Mailing list discussion: https://groups.google.com/d/msg/django-developers/A0m8YkPKpZo/Yx8l2P8EAQAJ

Change History (1)

comment:1 by Tom Forbes, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top