#34052: migrate --check still emits signals if database is up to date
---------------------------------------+------------------------
               Reporter:  Jacob Walls  |          Owner:  nobody
                   Type:  Bug          |         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:  1
                  UI/UX:  0            |
---------------------------------------+------------------------
 `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.
 }}}

 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.

-- 
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/0107018373150084-d6e696db-8bc0-4136-b3a5-39b0ce5b3a1a-000000%40eu-central-1.amazonses.com.

Reply via email to