mirror of
https://github.com/penpot/penpot.git
synced 2025-06-10 04:11:41 +02:00
♻️ Add minor refactor to file migrations
Relevant changes: - Add the ability to create migration in both directions, defaulting to identity if not provided - Move the version attribute to file table column for to make it more accessible (previously it was on data blob) - Reduce db update operations on file-update rpc method
This commit is contained in:
parent
7ac4b89a0e
commit
b718a282e0
16 changed files with 240 additions and 151 deletions
|
@ -1496,6 +1496,13 @@
|
|||
fdata (migrate-graphics fdata)]
|
||||
(update fdata :options assoc :components-v2 true)))))
|
||||
|
||||
(defn- fix-version
|
||||
[file]
|
||||
(let [file (fmg/fix-version file)]
|
||||
(if (> (:version file) 22)
|
||||
(assoc file :version 22)
|
||||
file)))
|
||||
|
||||
(defn- get-file
|
||||
[system id]
|
||||
(binding [pmap/*load-fn* (partial fdata/load-pointer system id)]
|
||||
|
@ -1506,10 +1513,7 @@
|
|||
(update :data assoc :id id)
|
||||
(update :data fdata/process-pointers deref)
|
||||
(update :data fdata/process-objects (partial into {}))
|
||||
(update :data (fn [data]
|
||||
(if (> (:version data) 22)
|
||||
(assoc data :version 22)
|
||||
data)))
|
||||
(fix-version)
|
||||
(fmg/migrate-file))))
|
||||
|
||||
(defn get-team
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue