#34974: makemigrations --check does not show diff as documented
-------------------------------+--------------------------------------
Reporter: Oliver Ford | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 4.2
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by David Sanders):
> Is there already a feature request for a --dry-run --diff or something
do you know?
I don't believe there is sorry 🤷♂️
If you want to write something yourself you can update makemigrations to
simply write to `sys.stdout`:
{{{
@@ -360,9 +360,8 @@ class Command(BaseCommand):
# We just do this once per app
directory_created[app_label] = True
migration_string = writer.as_string()
- with open(writer.path, "w", encoding="utf-8") as fh:
- fh.write(migration_string)
- self.written_files.append(writer.path)
+ sys.stdout.write(migration_string)
+ self.written_files.append(writer.path)
if update_previous_migration_paths:
prev_path =
update_previous_migration_paths[app_label]
rel_prev_path = self.get_relative_path(prev_path)
}}}
That will print both the log message that shows the written file + the
contents. You can disable the logging easily with `-v 0` 👍
--
Ticket URL: <https://code.djangoproject.com/ticket/34974#comment:4>
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/0107018bdda8783d-e23abb07-97a9-44a0-8fda-2d649bb9a723-000000%40eu-central-1.amazonses.com.