I have a model in my Vapor app that has a timestamp that gets automatically updated to the current time whenever the model gets modified:
@Timestamp(key: "last_modification_date", on: .update, format: .unix)
var lastModificationDate: Date?
I find this feature to be incredibly useful because one can never forget to update the timestamp.
However, there is one case in the entire app where it would be really handy if I could modify the model without changing this value (or set it manually to a value other than the current time). Is this possible somehow?
So far I found nothing about this in the documentation or anywhere on the internet. Any help would be very much appreciated!
Unfortunately there's no way to workaround the timestamp logic in Fluent. If you want to modify a model without setting the update field you'll need to drop down to SQLKit or a raw query