mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 21:49:10 +00:00
Merge pull request #6360 from penpot/niwinz-staging-bugfixes-2
🐛 Fix issues on file data migration handling
This commit is contained in:
commit
373248e304
@ -15,6 +15,7 @@
|
|||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.features :as cfeat]
|
[app.common.features :as cfeat]
|
||||||
|
[app.common.files.migrations :as-alias fmg]
|
||||||
[app.common.json :as json]
|
[app.common.json :as json]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
@ -745,7 +746,14 @@
|
|||||||
(assoc :name file-name)
|
(assoc :name file-name)
|
||||||
(assoc :project-id project-id)
|
(assoc :project-id project-id)
|
||||||
(dissoc :options)
|
(dissoc :options)
|
||||||
(bfc/process-file))]
|
(bfc/process-file)
|
||||||
|
|
||||||
|
;; NOTE: this is necessary because when we just
|
||||||
|
;; creating a new file from imported artifact,
|
||||||
|
;; there are no migrations registered on the
|
||||||
|
;; database, so we need to persist all of them, not
|
||||||
|
;; only the applied
|
||||||
|
(vary-meta dissoc ::fmg/migrated))]
|
||||||
|
|
||||||
|
|
||||||
(bfm/register-pending-migrations! cfg file)
|
(bfm/register-pending-migrations! cfg file)
|
||||||
|
|||||||
@ -238,7 +238,6 @@
|
|||||||
(db/update! conn :file
|
(db/update! conn :file
|
||||||
{:data (blob/encode (:data file))
|
{:data (blob/encode (:data file))
|
||||||
:version (:version file)
|
:version (:version file)
|
||||||
:modified-at (dt/now)
|
|
||||||
:features (db/create-array conn "text" (:features file))}
|
:features (db/create-array conn "text" (:features file))}
|
||||||
{:id id})
|
{:id id})
|
||||||
|
|
||||||
@ -293,7 +292,7 @@
|
|||||||
|
|
||||||
(defn get-file-etag
|
(defn get-file-etag
|
||||||
[{:keys [::rpc/profile-id]} {:keys [modified-at revn vern permissions]}]
|
[{:keys [::rpc/profile-id]} {:keys [modified-at revn vern permissions]}]
|
||||||
(str profile-id "/" revn "/" vern "/"
|
(str profile-id "/" revn "/" vern "/" (hash fmg/available-migrations) "/"
|
||||||
(dt/format-instant modified-at :iso)
|
(dt/format-instant modified-at :iso)
|
||||||
"/"
|
"/"
|
||||||
(uri/map->query-string permissions)))
|
(uri/map->query-string permissions)))
|
||||||
|
|||||||
@ -36,9 +36,7 @@
|
|||||||
|
|
||||||
#?(:cljs (l/set-level! :info))
|
#?(:cljs (l/set-level! :info))
|
||||||
|
|
||||||
(declare ^:private available-migrations)
|
(declare available-migrations)
|
||||||
(declare ^:private migration-up-index)
|
|
||||||
(declare ^:private migration-down-index)
|
|
||||||
|
|
||||||
(def version cfd/version)
|
(def version cfd/version)
|
||||||
|
|
||||||
@ -50,7 +48,10 @@
|
|||||||
[file]
|
[file]
|
||||||
(or (nil? (:version file))
|
(or (nil? (:version file))
|
||||||
(not= cfd/version (:version file))
|
(not= cfd/version (:version file))
|
||||||
(not= available-migrations (:migrations file))))
|
(boolean
|
||||||
|
(->> (:migrations file #{})
|
||||||
|
(set/difference available-migrations)
|
||||||
|
(not-empty)))))
|
||||||
|
|
||||||
(def xf:map-name
|
(def xf:map-name
|
||||||
(map :name))
|
(map :name))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user