Restore file with history and link

Dear everyone,

a user just deleted a file from our Nextcloud instance and reuploaded it. Of course this broke the versioning and the link. Is there a known way to go about this?
I have a full server backup from last night, but I don’t want to restore everything as too much data would get lost.

Here’s what I would do, albeit pretty hacky and potentially dangerous. I’d be happy about better ideas.

  • Stop apache and mariadb
  • Change fileid field in oc_filecache to the old one
  • move data/<user>/files_trashbin/versions/<filename>* to data/<user>/files_versions/<its old place>
  • Start apache and mariadb

Would that make everything the way it was before?

Thanks a lot!

Nextcloud version (eg, 12.0.2): 14.0.4
Operating system and version (eg, Ubuntu 17.04): Debian Stretch
Apache or nginx version (eg, Apache 2.4.25): 2.4.25
PHP version (eg, 7.1): 7.0

I feel kinda stupid… the solution was obviously to use the “Deleted files” menu and just restore it from there… duh. One of those days on which you think wayyy more complicated than would be necessary.