Opened 4 years ago

Last modified 10 months ago

#31700 closed New feature

Highlight destructive operations in makemigrations output — at Initial Version

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

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 green, red and yellow respectively.

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

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top