(ns metabase.models.application-permissions-revision (:require [metabase.models.interface :as mi] [metabase.util.i18n :refer [tru]] [methodical.core :as methodical] [toucan2.core :as t2])) | |
Used to be the toucan1 model name defined using [[toucan.models/defmodel]], now it's a reference to the toucan2 model name. We'll keep this till we replace all the symbols in our codebase. | (def ApplicationPermissionsRevision :model/ApplicationPermissionsRevision) |
(methodical/defmethod t2/table-name :model/ApplicationPermissionsRevision [_model] :application_permissions_revision) | |
(doto :model/ApplicationPermissionsRevision (derive :metabase/model) (derive :hook/created-at-timestamped?)) | |
(t2/deftransforms :model/ApplicationPermissionsRevision {:before mi/transform-json :after mi/transform-json}) | |
(t2/define-before-update :model/ApplicationPermissionsRevision [_] (throw (Exception. (tru "You cannot update a PermissionsRevision!")))) | |
Return the ID of the newest | (defn latest-id [] (or (t2/select-one-pk ApplicationPermissionsRevision {:order-by [[:id :desc]]}) 0)) |