A related side effect is that the logs also look like a like a real run,
as it says "Operations to perform:" and "Running migrations:". The last
sentence clarifies that nothing has been applied, but there is still the
potential for a half-second of "what have I just done?".
{{{
% python manage.py migrate --check
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, social_django
Running migrations:
No migrations to apply.
}}}
I think the patch is as simple as:
{{{
diff --git a/django/core/management/commands/migrate.py
b/django/core/management/commands/migrate.py
index d98072c66e..f1b8a21c11 100644
--- a/django/core/management/commands/migrate.py
+++ b/django/core/management/commands/migrate.py
@@ -237,7 +237,7 @@ class Command(BaseCommand):
self.stdout.write(" No migrations to prune.")
plan = executor.migration_plan(targets)
- exit_dry = plan and options["check_unapplied"]
+ exit_dry = options["check_unapplied"]
if options["plan"]:
self.stdout.write("Planned operations:",
self.style.MIGRATE_LABEL)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34052>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:1>
Comment (by JunKi Yoon):
Replying to [ticket:34052 Jacob Walls]:
Can I try this ticket?
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:2>
* owner: nobody => JunKi Yoon
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:3>
* has_patch: 0 => 1
Comment:
I added patch :)
[https://github.com/django/django/pull/16120 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:4>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:5>
Old description:
New description:
`pre_migrate` and `post_migrate` signals are emitted for `migrate
--check`, but only if the database is up-to-date.
A related side effect is that the logs also look like a like a real run,
as it says "Operations to perform:" and "Running migrations:". The last
sentence clarifies that nothing has been applied, but there is still the
potential for a half-second of "what have I just done?".
{{{
% python manage.py migrate --check
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, social_django
Running migrations:
No migrations to apply.
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:6>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"1a7b6909ac030d2c4dae2664b08ee0bce9c4c915" 1a7b690]:
{{{
#!CommitTicketReference repository=""
revision="1a7b6909ac030d2c4dae2664b08ee0bce9c4c915"
Fixed #34052 -- Made migrate --check don't emit signals and output when up
to date.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34052#comment:8>