From f1d8abf160103e78e69c32c03c730483ad906865 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 29 Nov 2023 16:06:10 +0100 Subject: [PATCH] :sparkles: Migrate file feature names when fdata migrations are applied --- backend/src/app/rpc/commands/files.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/app/rpc/commands/files.clj b/backend/src/app/rpc/commands/files.clj index 1bd1e78fd..8a86cdae0 100644 --- a/backend/src/app/rpc/commands/files.clj +++ b/backend/src/app/rpc/commands/files.clj @@ -283,15 +283,19 @@ ;; NOTE: when file is migrated, we break the rule of no perform ;; mutations on get operations and update the file with all ;; migrations applied + ;; + ;; NOTE: the following code will not work on read-only mode, it + ;; is a known issue; we keep is not implemented until we really + ;; need this (if (pmg/migrated? file) - (let [features (set/union (deref cfeat/*new*) (:features file))] + (let [file (update file :features cfeat/migrate-legacy-features) + features (set/union (deref cfeat/*new*) (:features file))] (db/update! conn :file {:data (blob/encode (:data file)) :features (db/create-array conn "text" features)} {:id id}) (persist-pointers! conn id) (assoc file :features features)) - file))))) (defn get-minimal-file