From 15a896e05080f220609d14dd9ec3e648b0b40123 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 30 Jan 2025 09:17:02 +0100 Subject: [PATCH] :bug: Add migration for fix files with invalid token-data (#5712) Because of previous bug that is already fixed --- common/src/app/common/files/defaults.cljc | 2 +- common/src/app/common/files/migrations.cljc | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index e7d64788aa..cd1fbbf9b0 100644 --- a/common/src/app/common/files/defaults.cljc +++ b/common/src/app/common/files/defaults.cljc @@ -6,4 +6,4 @@ (ns app.common.files.defaults) -(def version 62) +(def version 65) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index c245302d6d..adce0aeee5 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1179,6 +1179,24 @@ (update data :components update-vals update-component))) +(defn migrate-up-65 + [data] + (let [update-object + (fn [object] + (d/update-when object :plugin-data d/without-nils)) + + update-page + (fn [page] + (-> (update-object page) + (update :objects update-vals update-object)))] + + (-> data + (update-object) + (d/update-when :pages-index update-vals update-page) + (d/update-when :colors update-vals update-object) + (d/update-when :typographies update-vals update-object) + (d/update-when :components update-vals update-object)))) + (def migrations "A vector of all applicable migrations" [{:id 2 :migrate-up migrate-up-2} @@ -1229,4 +1247,5 @@ {:id 56 :migrate-up migrate-up-56} {:id 57 :migrate-up migrate-up-57} {:id 59 :migrate-up migrate-up-59} - {:id 62 :migrate-up migrate-up-62}]) + {:id 62 :migrate-up migrate-up-62} + {:id 65 :migrate-up migrate-up-65}])