forked from CGM_Public/pretix_original
Remove MariaDB support (#3381)
This commit is contained in:
@@ -29,7 +29,7 @@ def postgres_compile_json_path(key_transforms):
|
||||
return "{" + ','.join(key_transforms) + "}"
|
||||
|
||||
|
||||
def mysql_compile_json_path(key_transforms):
|
||||
def sqlite_compile_json_path(key_transforms):
|
||||
path = ['$']
|
||||
for key_transform in key_transforms:
|
||||
try:
|
||||
@@ -41,9 +41,6 @@ def mysql_compile_json_path(key_transforms):
|
||||
return ''.join(path)
|
||||
|
||||
|
||||
sqlite_compile_json_path = mysql_compile_json_path
|
||||
|
||||
|
||||
class JSONExtract(Expression):
|
||||
def __init__(self, expression, *path, output_field=JSONField(), **extra):
|
||||
super().__init__(output_field=output_field)
|
||||
@@ -66,14 +63,6 @@ class JSONExtract(Expression):
|
||||
params.append(json_path)
|
||||
template = '{} #> %s'.format(arg_sql)
|
||||
return template, params
|
||||
elif '.mysql' in connection.settings_dict['ENGINE']:
|
||||
params = []
|
||||
arg_sql, arg_params = compiler.compile(self.source_expression)
|
||||
params.extend(arg_params)
|
||||
json_path = mysql_compile_json_path(self.path)
|
||||
params.append(json_path)
|
||||
template = 'JSON_EXTRACT({}, %s)'.format(arg_sql)
|
||||
return template, params
|
||||
elif '.sqlite' in connection.settings_dict['ENGINE']:
|
||||
params = []
|
||||
arg_sql, arg_params = compiler.compile(self.source_expression)
|
||||
@@ -84,7 +73,7 @@ class JSONExtract(Expression):
|
||||
return template, params
|
||||
else:
|
||||
raise NotSupportedError(
|
||||
'Functions on JSONFields are only supported on SQLite, PostgreSQL, and MySQL at the moment.'
|
||||
'Functions on JSONFields are only supported on SQLite and PostgreSQL at the moment.'
|
||||
)
|
||||
|
||||
def copy(self):
|
||||
|
||||
Reference in New Issue
Block a user