#33509: Add SQL comment to describe deliberately no-op migration operations
----------------------------------------+------------------------
Reporter: Adam Johnson | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+------------------------
Currently when a field migration is a no-op, the operation description is
output in SQL, but nothing else. This can be confusing as to which
operations are no-ops. It could be clearer if we output an extra SQL
comment when there are deliberately no statements to execute for a given
migration operation.
Take for example this output:
{{{
BEGIN;
--
-- Alter field name on Author
--
ALTER ...;
--
-- Alter field title on Book
--
COMMIT;
}}}
The `Author.name` field has an operation applied, whilst `Book.title`
needs no changes to the database. This isn't exactly clear from the output
- is the `COMMIT` part of the `Book.title` change?
It could be clearer as:
{{{
BEGIN;
--
-- Alter field name on Author
--
ALTER ...;
--
-- Alter field name on Author
--
-- (no-op)
COMMIT;
}}}
(Or perhaps more verbose wording, like "no SQL to execute")
I think this can help especially when there are consecutive operations
with no-op SQL:
{{{
BEGIN;
--
-- Alter field name on Author
--
-- (no-op)
--
-- Alter field name on Author
--
-- (no-op)
COMMIT;
}}}
(Inspired by #33470, where the OP suggested dropping such migration
operation header comments.)
--
Ticket URL: <https://code.djangoproject.com/ticket/33509>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.fafed525c827baa9868636ceb15f6efb%40djangoproject.com.