#27142: makemigrations fails on special database connections
---------------------------------+------------------------------------
Reporter: gerricom | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by sjoerdjob):
From my perspective, `makemigrations` would not really be the place to
check database consistency. Especially when trying to build a reusable
app, you should not have to know what database connection your app will be
used in.
I just tested this (somewhat superficially), but in Django 1.9.7 I can run
`makemigrations` without even having a database connection configured. The
minimum requirement seems to be that *if* there is a database configured,
the `ENGINE` field makes sense.
Django 1.10 raises the bar significantly (the bar is being lowered again a
bit, which I think is great!)
* All databases you configured need to have a `django_migrations` table
(or the ability to create one). (#27054)
* The `django_migrations` table needs to be readable. (#27141)
* The configured database must support enough of SQL to make sense of the
checks (#27142).
* The data in that table needs to be consistent with your project/app (I
expect), even though it might be a read-only connection to a database
"owned" by another Django project where you just want to have a "sneak
peak" into a specific table. (probably the issue I would have reported if
the `django_migrations` table in #27142 *was* readable).
Sure, consulting database routers might be some form of win, but how much
of a win? Will it solve all current problems, including the ones we
haven't found yet?
(During some investigation, I also found that Django 1.9.7 already
consults the database routers for some model-checks, for instance in
`_check_long_column_names`. If I were to write a reusable app, I think it
might be better to check all possible engines, and not just the ones
routed to.)
From what I have seen so far, I would kindly request that `makemigrations`
will stop checking database consistency, and make sure that no database
queries will be made. I think that would be the most pragmatic choice. To
me the question is: will it be removed in the 1.10.x series, or in 1.11?
[[remark: please don't take the above the wrong way. I understand that
this feature has been developed based on good intentions, and I really
appreciate the effort that has gone into creating and enhancing Django. I
am trying not to hurt anyone's feelings and hope the above does not come
off as such.]]
--
Ticket URL: <https://code.djangoproject.com/ticket/27142#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 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/066.8047f96f2bda0699fc007f807af20756%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.