From ed1c707a578b66d8a7827275e62bbdaab608724e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 30 Mar 2026 10:52:48 +0000 Subject: [PATCH] :tada: Add migration 0018-rename-path-content-to-path-data Add file migration to rename :content to :path-data on path and bool shapes in existing files. Iterates over all shapes in pages-index and components, renaming the attribute for shapes of type :path or :bool. Signed-off-by: Andrey Antukh --- common/src/app/common/files/migrations.cljc | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 3655f3ece5..99a4f8ba4d 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1786,6 +1786,27 @@ (update :pages-index d/update-vals update-container) (d/update-when :components d/update-vals update-container)))) +(defmethod migrate-data "0018-rename-path-content-to-path-data" + [data _] + (let [update-object + (fn [object] + (if (or (= :path (:type object)) + (= :bool (:type object))) + (let [content (get object :content)] + (cond-> object + (some? content) + (-> (assoc :path-data content) + (dissoc :content)))) + object)) + + update-container + (fn [container] + (d/update-when container :objects d/update-vals update-object))] + + (-> data + (update :pages-index d/update-vals update-container) + (d/update-when :components d/update-vals update-container)))) + (def available-migrations (into (d/ordered-set) ["legacy-2" @@ -1860,4 +1881,5 @@ "0015-fix-text-attrs-blank-strings" "0015-clean-shadow-color" "0016-copy-fills-from-position-data-to-text-node" - "0017-fix-layout-flex-dir"])) + "0017-fix-layout-flex-dir" + "0018-rename-path-content-to-path-data"]))