radiocosmology / alpenhorn

Alpenhorn is a service for managing an archive of scientific data.
MIT License
2 stars 1 forks source link

fix: Update ArchiveFileCopy.last_update as needed #169

Closed ketiltrout closed 11 months ago

ketiltrout commented 11 months ago

I think these were overlooked because of my initial idea of making ArchiveFileCopy.last_update an automatically-updating value, which didn't pan out.

ketiltrout commented 11 months ago

My original plan was to use the ON UPDATE CURRENT_TIMESTAMP clause, which is great, but only works in MySQL, which was one problem.

More importantly, though, was that the peewee data model doesn't really support automatically updating fields. I tried for a while to write an extension to peewee.Model which would handle it, but it turned out to be unnecessarily complex for what I wanted to do.

I briefly mentioned removed my auto-update attempt in https://github.com/radiocosmology/alpenhorn/pull/152

I think the primary downside to not having it auto-update is other processes that modify ArchiveFileCopy won't necessarily update it, but it's mostly a field to record when alpenhorn last checked the record, so it's probably fine.