mirror of
https://github.com/django/django.git
synced 2025-10-08 17:51:05 +00:00
[3.0.x] Fixed #30786 -- Used CONVERT_TZ to check if the time zone definitions are installed on MySQL.
Replaced a timezone check in the MySQL backend with one that doesn't
require access to the mysql.time_zone database.
Backport of 3346b78a8a
from master
This commit is contained in:
parent
e4dc1b8cac
commit
def1857d9b
1 changed files with 4 additions and 3 deletions
|
@ -69,10 +69,11 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|||
|
||||
@cached_property
|
||||
def has_zoneinfo_database(self):
|
||||
# Test if the time zone definitions are installed.
|
||||
# Test if the time zone definitions are installed. CONVERT_TZ returns
|
||||
# NULL if 'UTC' timezone isn't loaded into the mysql.time_zone.
|
||||
with self.connection.cursor() as cursor:
|
||||
cursor.execute("SELECT 1 FROM mysql.time_zone LIMIT 1")
|
||||
return cursor.fetchone() is not None
|
||||
cursor.execute("SELECT CONVERT_TZ('2001-01-01 01:00:00', 'UTC', 'UTC')")
|
||||
return cursor.fetchone()[0] is not None
|
||||
|
||||
@cached_property
|
||||
def is_sql_auto_is_null_enabled(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue