dify/api/migrations
echooffx 34793e0d92 feat(api): add scheduled cleanup task for dataset_queries
The dataset_queries table grows without bound because every RAG retrieval
and hit-test inserts a row. This adds a configurable Celery Beat task
(clean_dataset_queries_task) that deletes rows older than a retention
period (default 60 days) in batches, gated by ENABLE_CLEAN_DATASET_QUERIES_TASK.

Retention is clamped to max(config, PLAN_SANDBOX_CLEAN_DAY_SETTING) to
avoid breaking clean_unused_datasets_task which reads DatasetQuery.created_at.

Also adds a created_at index on dataset_queries via alembic migration
to keep the delete scan performant as the table grows.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 16:04:02 +08:00
..
versions feat(api): add scheduled cleanup task for dataset_queries 2026-04-30 16:04:02 +08:00
alembic.ini chore: update SQLAlchemy configuration with custom naming convention (#6854) 2024-08-01 11:16:49 +08:00
env.py fix(api): fix the issue that workflow_runs.started_at is overwritten while resuming (#32851) 2026-03-06 15:41:30 +08:00
README chore: remove the unused config INNER_API_KEY (#14780) 2025-03-05 15:39:48 +08:00
script.py.mako add pgvecto_rs support and upgrade SQLAlchemy (#3833) 2024-04-29 11:58:17 +08:00

Single-database configuration for Flask.