Skip to content

Commit

Permalink
fix broken migration in 0.28.2
Browse files Browse the repository at this point in the history
  • Loading branch information
salsakran committed Mar 23, 2018
1 parent 88bb785 commit c1f0b18
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION="v0.28.2"
VERSION="v0.28.3"

# dynamically pull more interesting stuff from latest git commit
HASH=$(git show-ref --head --hash=7 head) # first 7 letters of hash should be enough; that's what GitHub uses
Expand Down
20 changes: 18 additions & 2 deletions src/metabase/db/migrations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,24 @@
;; `pre-update` implementation.
;;
;; Caching these permissions will prevent 1000+ DB call API calls. See https://github.com/metabase/metabase/issues/6889
;; NOTE: This used used to be
;; (defmigration ^{:author "camsaul", :added "0.28.2"} populate-card-read-permissions
;; (run!
;; (fn [card]
;; (db/update! Card (u/get-id card) {}))
;; (db/select-reducible Card :archived false, :read_permissions nil)))
;; But due to bug https://github.com/metabase/metabase/issues/7189 was replaced
(defmigration ^{:author "camsaul", :added "0.28.2"} populate-card-read-permissions
(log/info "Not running migration `populate-card-read-permissions` as it has been replaced by a subsequent migration "))


;; Migration from 0.28.2 above had a flaw in that passing in `{}` to the update results in
;; the functions that do pre-insert permissions checking don't have the query dictionary to analyze
;; and always short-circuit due to the missing query dictionary. Passing the card itself into the
;; check mimicks how this works in-app, and appears to fix things.

(defmigration ^{:author "salsakran", :added "0.28.3"} repopulate-card-read-permissions
(run!
(fn [card]
(db/update! Card (u/get-id card) {}))
(db/select-reducible Card :archived false, :read_permissions nil)))
(db/update! Card (u/get-id card) card))
(db/select-reducible Card :archived false)))

0 comments on commit c1f0b18

Please sign in to comment.