#31286: Database specific fields checks should be databases aware.
-------------------------------------+-------------------------------------
Reporter: Hongtao Ma | Owner: Hongtao
| Ma
Type: Bug | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Tim Graham):
I'm not following the analysis in the ticket description. My understanding
is that before this change, the database-specific field checks always ran
for all databases (`for db in connections`). Now that it uses `databases`
as specified by the `check` command, these checks are skipped unless
`check --database=...` is specified. While `migrate`'s check does
[https://github.com/django/django/blob/a0fb35eb726f1a04eaa1b47b8de191fafe55a0ab/django/core/management/commands/migrate.py#L94
specify a database], this change postpones these errors/warnings from the
`makemigrations` stage to the `migrate` stage, at which point the user
needs to take an extra corrective step of recreating the migration file.
(In my case, I wrote [https://github.com/mongodb/django-mongodb-
backend/pull/185/files a check to prohibit AutoField] for the MongoDB
backend.)
Although it's documented that "Database checks are not run by default
because they do more than static code analysis as regular checks do," the
[https://github.com/django/django/blob/a0fb35eb726f1a04eaa1b47b8de191fafe55a0ab/django/db/backends/mysql/validation.py#L38-L77
database-specific field checks] are only static analysis (as opposed to
something like
[https://github.com/django/django/blob/a0fb35eb726f1a04eaa1b47b8de191fafe55a0ab/django/db/backends/mysql/validation.py#L12-L36
the MySQL check for strict mode] which does query the database), so I see
no reason they shouldn't be included as part of the normal checks. I think
this patch should be reverted, but let me know if I've missed something.
--
Ticket URL: <https://code.djangoproject.com/ticket/31286#comment:7>
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 visit
https://groups.google.com/d/msgid/django-updates/01070195f1c6a191-03fce6dc-36e0-4e56-8b7a-d9d8610ac7e9-000000%40eu-central-1.amazonses.com.