kaspiana / mage

A command-line tool for cataloguing images (particularly digital art), styled after Git.
0 stars 0 forks source link

Make document deletion safer #30

Closed kaspiana closed 3 months ago

kaspiana commented 3 months ago

Deleting a document will currently (at least, attempt to) purge all metadata concerning it, with no user confirmation needed. The file is preserved in the ./mage/out directory, but the metadata is unrecoverable. This is dangerous.

Idea 1

Present a confirmation dialog, e.g. 'Are you sure you wish to delete document {id}? Y/N'

Idea 2

The mage delete doc command should merely set a 'deleted' status on the document, which will cause it to be excluded from searches. Commands like mage bin clear and mage bin recover [doc] can then be used to manage documents marked for deletion.

kaspiana commented 3 months ago

Handling the 'deleted' flag in all potential queries may be tedious. Is there a better way? Perhaps an SQL view like 'extant_documents', for the sake of brevity, though it nevertheless seems clumsy, and I suspect we would need duplicate many queries for documents.