Update engine.py

This commit is contained in:
2026-01-18 22:53:35 +01:00
parent 07de323f2b
commit 8afa30222c

View File

@@ -416,4 +416,14 @@ class SorterEngine:
# New name already exists
pass
finally:
conn.close()
conn.close()
@staticmethod
def delete_category(name):
"""Deletes a category and clears any staged tags associated with it."""
conn = sqlite3.connect(SorterEngine.DB_PATH)
cursor = conn.cursor()
cursor.execute("DELETE FROM categories WHERE name = ?", (name,))
cursor.execute("DELETE FROM staging_area WHERE target_category = ?", (name,))
conn.commit()
conn.close()