Skip to content
This repository was archived by the owner on Jul 3, 2026. It is now read-only.
This repository was archived by the owner on Jul 3, 2026. It is now read-only.

drive.api.files.auto_delete_from_trash #617

Description

@buff0k

Describe the bug

The scheduled job drive.api.files.auto_delete_from_trash fails because it filters Drive File records using a non-existent column named last_modified.

The failing query is generated from apps/drive/drive/api/files.py

def auto_delete_from_trash(): days_before = (date.today() - timedelta(days=30)).isoformat() result = frappe.db.get_all( "Drive File", filters={"is_active": 0, "last_modified": ["<", days_before]}, fields=["name"], ) delete_entities(result)

However, the tabDrive File table does not contain a last_modified column. It contains the standard Frappe modified column and a custom _modified column instead.

This causes the scheduled job to fail with:

MySQLdb.OperationalError: (1054, "Unknown column 'last_modified' in 'WHERE'")

To Reproduce

Allow the scheduled job drive.api.files.auto_delete_from_trash to run, or execute it manually
The scheduled job fails.

Expected behavior

The scheduled job runs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions