From c56611bc820ad0ace17eedd11d0a8536856c4026 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Wed, 9 Oct 2024 09:58:47 +0200 Subject: [PATCH] Note that MySQL supports DELETE w/ LIMIT too --- events/retention.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/events/retention.py b/events/retention.py index 73549a1..522b6da 100644 --- a/events/retention.py +++ b/events/retention.py @@ -272,8 +272,8 @@ def evict_for_irrelevance( def delete_with_limit(qs, limit): - # Django does not support this out of the box (i.e. it does not support LIMIT in DELETE queries). Sqlite does in - # fact support it (whereas many other DBs do not), so we reach down into Django's internals to get this done. + # Django does not support this out of the box (i.e. it does not support LIMIT in DELETE queries). Both Sqlite and + # MySQL do in fact support it (whereas many other DBs do not), so we just reach down into Django's internals. sql, params = SQLDeleteCompiler(qs.query, connection, 'default').as_sql() limited_sql = sql + " LIMIT %s" limited_params = params + (limit,)