summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/operations.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-07-27 02:26:58 +0200
committerTim Graham <timograham@gmail.com>2017-07-26 20:26:58 -0400
commit8e41373c81cbd914d84b362ca4c85d3ed4fcff43 (patch)
tree931a46b9ef2b7b5115e9d4d2553f19b3a6401549 /django/db/backends/mysql/operations.py
parentef9344b3a5b91f6b442830923dd28d779fdf8019 (diff)
downloaddjango-8e41373c81cbd914d84b362ca4c85d3ed4fcff43.tar.gz
Allowed database backends to specify data types for Cast().
A small refactor ahead of refs #28371.
Diffstat (limited to 'django/db/backends/mysql/operations.py')
-rw-r--r--django/db/backends/mysql/operations.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py
index 405aa4bd45..71592234aa 100644
--- a/django/db/backends/mysql/operations.py
+++ b/django/db/backends/mysql/operations.py
@@ -15,6 +15,15 @@ class DatabaseOperations(BaseDatabaseOperations):
PositiveSmallIntegerField=(0, 65535),
PositiveIntegerField=(0, 4294967295),
)
+ cast_data_types = {
+ 'CharField': 'char(%(max_length)s)',
+ 'IntegerField': 'signed integer',
+ 'BigIntegerField': 'signed integer',
+ 'SmallIntegerField': 'signed integer',
+ 'FloatField': 'signed',
+ 'PositiveIntegerField': 'unsigned integer',
+ 'PositiveSmallIntegerField': 'unsigned integer',
+ }
def date_extract_sql(self, lookup_type, field_name):
# http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html