fix: file and file_meta migrations (#112611)
* fix file and file_meta migrations to check the database state to decide which migration to run
(cherry picked from commit 545b7bf8ff)
Co-authored-by: Will Assis <35489495+gassiss@users.noreply.github.com>