#23273: MigrationRecorder does not obey db_router allow_migrate rules
----------------------------+------------------------------------
     Reporter:  froomzy     |                    Owner:  nobody
         Type:  Bug         |                   Status:  new
    Component:  Migrations  |                  Version:  master
     Severity:  Normal      |               Resolution:
     Keywords:              |             Triage Stage:  Accepted
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+------------------------------------
Changes (by marfire):

 * cc: k@… (added)
 * version:  1.7 => master


Comment:

 I wanted to chime in here to broaden the scope of the bug, as I was
 affected by it recently in a different context.

 The bigger issue is not just that the framework tries to create the
 migrations table where it's not needed, but that it marks as applied
 migrations that in fact were not. That puts the database in an
 inconsistent state, at least as far as migrations are concerned. It's a
 harmless inconsistency for the specific settings file used at that
 specific moment in time, but it lays the seed for big problems down the
 line. For example, if you later decide to change your routing scheme, or
 (as happened in my case) if you have multiple projects with different
 settings using the same app on the same database.

 In terms of a solution, what seems straightforward to my untrained eye is
 for the migration framework to simply not record migrations as applied
 that it didn't apply (and as a corollary, it shouldn't try to create the
 migration table on a database if it doesn't need to record any migrations
 there). The fix suggested above ("to have migrations refuse to run
 entirely and just exit if the migration model is not allowed to be created
 on the target database") doesn't address the broader issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/23273#comment:13>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.f5fcc26ea5d36ddbcfba9cb9c2cf63d1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to