#27089: Add the database alias to InconsistentMigrationHistory message
-------------------------------------+-------------------------------------
     Reporter:  aholmback            |                    Owner:  timgraham
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Migrations           |                  Version:  1.10
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by aholmback:

Old description:

> In the file django/core/management/commands/makemigrations.py (line
> 97-100), an instance of MigrationLoader (loader) checks consistency on
> every database connection defined in settings.py.
>
> {{{
> for db in connection:
>     connection = connection[db]
>     if connection.settings_dict['ENGINE'] != 'django.db.backends.dummy':
>         loader.check_consistent_history(connection)
> }}}
>
> The loader will then raise an InconsistentMigrationHistory exception for
> a connection whose migrations is not applied consistently, even if it's
> not to participate in the migration process.
>
> I didn't expect `makemigrations` would check connections that isn't to be
> migrated. Also, the error message "Migration xxx is applied before its
> dependency xxx" (line 285 in db/migrations/loader.py) didn't indicate
> checked connection.
>
> A more intuitive behavior would be to check only the connection that is
> to be migrated, or, if that isn't possible, include connection name in
> the error message.

New description:

 In the file django/core/management/commands/makemigrations.py (line
 97-100), an instance of MigrationLoader (loader) checks consistency on
 every database connection defined in settings.py.

 {{{
 for db in connections:
     connection = connection[db]
     if connection.settings_dict['ENGINE'] != 'django.db.backends.dummy':
         loader.check_consistent_history(connection)
 }}}

 The loader will then raise an InconsistentMigrationHistory exception for a
 connection whose migrations is not applied consistently, even if it's not
 to participate in the migration process.

 I didn't expect `makemigrations` would check connections that isn't to be
 migrated. Also, the error message "Migration xxx is applied before its
 dependency xxx" (line 285 in db/migrations/loader.py) didn't indicate
 checked connection.

 A more intuitive behavior would be to check only the connection that is to
 be migrated, or, if that isn't possible, include connection name in the
 error message.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27089#comment:2>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.7fbc97b8f744152ae7bb61219566893a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to