Perhaps there's a better way to run a query just once, but here's what I
did in django-cockroachdb:
https://github.com/cockroachdb/django-
cockroachdb/commit/27ebbefa515edf3ba68a5373dea48c4acdda60ab
We could make the check generic by adding
`DatabaseFeatures.minimum_database_version` as well as a standard method
to get the database version as suggested in #18332.
--
Ticket URL: <https://code.djangoproject.com/ticket/33379>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
Makes sense, thanks. IMO an extra query on startup is acceptable.
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:1>
Comment (by Claude Paroz):
Through a system check?
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:2>
Comment (by Jacob Walls):
Nick proposed a minimum check for MySQL in ticket:18392#comment:49.
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:3>
* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1
Comment:
I've created a [https://github.com/django/django/pull/15244 draft patch]
and implemented the check for the SQLite backend.
@Tim, please check it and let me know if the implementation and if you are
ok I can continue with the other backends.
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:4>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:5>
* needs_better_patch: 1 => 0
Comment:
[https://github.com/django/django/pull/15244 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:7>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:8>
* needs_better_patch: 0 => 1
Comment:
As noted on the PR, I tested this with CockroachDB and it doesn't work
because the system check framework runs after other initialization
queries, some of which fail on older versions of CockroachDB. Perhaps
moving the error to another method like
DatabaseWrapper.init_connection_state() as I did for CockroachDB
(implementation linked in ticket description) is more suitable.
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:9>
* needs_better_patch: 1 => 0
Comment:
I've added a new commit to the existing patch and moved the database
version check to `init_connection_state`.
Also, I've changed the tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:10>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:11>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:12>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:13>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"9ac3ef59f9538cfb520e3607af743532434d1755" 9ac3ef59]:
{{{
#!CommitTicketReference repository=""
revision="9ac3ef59f9538cfb520e3607af743532434d1755"
Fixed #33379 -- Added minimum database version checks.
Thanks Tim Graham for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:14>
Comment (by Carlton Gibson <carlton@…>):
In [changeset:"2cec020f5bc462954d902bdad1a5955852cecff6" 2cec020f]:
{{{
#!CommitTicketReference repository=""
revision="2cec020f5bc462954d902bdad1a5955852cecff6"
Refs #33379 -- Fixed minimum supported version of MariaDB.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:15>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"fad2e59808fe276864a090f1adb7ad88e61cc22c" fad2e598]:
{{{
#!CommitTicketReference repository=""
revision="fad2e59808fe276864a090f1adb7ad88e61cc22c"
[4.1.x] Refs #33379 -- Fixed minimum supported version of MariaDB.
Backport of 2cec020f5bc462954d902bdad1a5955852cecff6 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:16>