#34052: migrate --check still emits signals if database is up to date
-----------------------------+--------------------------------------
     Reporter:  Jacob Walls  |                    Owner:  JunKi Yoon
         Type:  Bug          |                   Status:  assigned
    Component:  Migrations   |                  Version:  dev
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Accepted
    Has patch:  1            |      Needs documentation:  0
  Needs tests:  1            |  Patch needs improvement:  1
Easy pickings:  1            |                    UI/UX:  0
-----------------------------+--------------------------------------
Description changed by Jacob Walls:

Old 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.
> }}}
>
> 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)
> }}}

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>
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/010701837ec95ae9-27015a18-abb0-4818-b050-f58040d74650-000000%40eu-central-1.amazonses.com.

Reply via email to