Improve page data migrations.

This commit is contained in:
Andrey Antukh 2020-06-10 13:14:33 +02:00 committed by Andrés Moya
parent ef42ffee65
commit 3e00d67504
4 changed files with 45 additions and 26 deletions

View file

@ -13,7 +13,7 @@
[uxbox.common.data :as d]
[uxbox.common.exceptions :as ex]
[uxbox.common.pages :as cp]
[uxbox.common.migrations :as mg]
[uxbox.common.pages-migrations :as pmg]
[uxbox.common.spec :as us]
[uxbox.common.uuid :as uuid]
[uxbox.config :as cfg]
@ -182,7 +182,7 @@
page (-> page
(update :data blob/decode)
(update :data mg/migrate-data)
(update :data pmg/migrate-data)
(update :data cp/process-changes changes)
(update :data blob/encode)
(update :revn inc)

View file

@ -13,7 +13,7 @@
[promesa.core :as p]
[uxbox.common.spec :as us]
[uxbox.common.exceptions :as ex]
[uxbox.common.migrations :as mg]
[uxbox.common.pages-migrations :as pmg]
[uxbox.db :as db]
[uxbox.services.queries :as sq]
[uxbox.services.queries.files :as files]
@ -40,7 +40,7 @@
(db/with-atomic [conn db/pool]
(files/check-edition-permissions! conn profile-id file-id)
(->> (retrieve-pages conn params)
(mapv #(update % :data mg/migrate-data)))))
(mapv #(update % :data pmg/migrate-data)))))
(def ^:private sql:pages
"select p.*
@ -67,7 +67,7 @@
(let [page (retrieve-page conn id)]
(files/check-edition-permissions! conn profile-id (:file-id page))
(-> page
(update :data mg/migrate-data)))))
(update :data pmg/migrate-data)))))
(def ^:private sql:page
"select p.* from page as p where id=?")