Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove mysql leftover #10694

Open
wants to merge 7 commits into
base: bugfix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions dojo/components/sql_group_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ def __init__(
**extra,
)

def as_mysql(self, compiler, connection):
return super().as_sql(
compiler,
connection,
template="%(function)s(%(distinct)s%(expressions)s%(ordering)s%(separator)s)",
separator=f" SEPARATOR '{self.separator}'",
)

def as_sql(self, compiler, connection, **extra):
return super().as_sql(
compiler,
Expand Down
15 changes: 1 addition & 14 deletions dojo/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

from dateutil.relativedelta import relativedelta
from django.contrib import messages
from django.db import connection
from django.db.models import Case, Count, F, IntegerField, Q, Sum, Value, When
from django.db.models.expressions import RawSQL
from django.db.models.functions import Coalesce, ExtractDay, Now, TruncMonth, TruncWeek
from django.db.models.query import QuerySet
from django.http import HttpRequest
Expand Down Expand Up @@ -539,18 +537,7 @@ def get_in_period_details(
).order_by("product_name")

# Approach to age determination is db-engine dependent
if "postgresql" in connection.settings_dict["ENGINE"]:
age_detail = findings.annotate(age=ExtractDay(Coalesce("mitigated", Now()) - F("date")))
elif "mysql" in connection.settings_dict["ENGINE"]:
# MySQL doesn't support durations natively and using an expression with subtraction yields unwanted results,
# so datediff() it is.
finding_table = Finding.objects.model._meta.db_table
age_detail = findings.annotate(
age=RawSQL(f"DATEDIFF(COALESCE({finding_table}.mitigated, CURRENT_TIMESTAMP), {finding_table}.date)", []),
)
else:
raise ValueError

age_detail = findings.annotate(age=ExtractDay(Coalesce("mitigated", Now()) - F("date")))
age_detail = age_detail.aggregate(
age_under_30=Sum(Case(When(age__lte=30, then=Value(1))), default=Value(0), output_field=IntegerField()),
age_31_60=Sum(Case(When(age__range=[31, 60], then=Value(1))), default=Value(0), output_field=IntegerField()),
Expand Down
1 change: 0 additions & 1 deletion dojo/settings/.settings.dist.py.sha256sum

This file was deleted.

4 changes: 0 additions & 4 deletions dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1680,10 +1680,6 @@ def saml2_attrib_map_format(dict):
# override filter to ensure sensitive variables are also hidden when DEBUG = True
DEFAULT_EXCEPTION_REPORTER_FILTER = "dojo.settings.exception_filter.CustomExceptionReporterFilter"

# As we require `innodb_large_prefix = ON` for MySQL, we can silence the
# warning about large varchar with unique indices.
SILENCED_SYSTEM_CHECKS = ["mysql.E001"]

# Issue on benchmark : "The number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELD S"
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240

Expand Down
2 changes: 1 addition & 1 deletion dojo/settings/template-env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DD_SECRET_KEY=#DD_SECRET_KEY#
# Key for encrypting credentials in the manager
DD_CREDENTIAL_AES_256_KEY=#DD_CREDENTIAL_AES_256_KEY#

# Database URL, options: postgres://, mysql://, sqlite://, to use unsafe characters encode with urllib.parse.encode
# Database URL, options: postgres://, to use unsafe characters encode with urllib.parse.encode
DD_DATABASE_URL=#DD_DATABASE_URL#

# Hosts/domain names that are valid for this site;
Expand Down
Loading