Skip to content
Snippets Groups Projects
Commit cecef409 authored by Cam Saül's avatar Cam Saül
Browse files

Don't return hidden tables as autocomplete suggestions

parent 1dcd2624
Branches
Tags
No related merge requests found
......@@ -89,10 +89,12 @@
(defn- autocomplete-tables [db-id prefix]
(db/select [Table :id :db_id :schema :name]
:db_id db-id
:active true
:%lower.name [:like (str (str/lower-case prefix) "%")]
{:order-by [[:%lower.name :asc]]}))
{:where [:and [:= :db_id db-id]
[:= :active true]
[:like :%lower.name (str (str/lower-case prefix) "%")]
[:or [:= :visibility_type nil]
[:not= :visibility_type "hidden"]]]
:order-by [[:%lower.name :asc]]}))
(defn- autocomplete-fields [db-id prefix]
(db/select [Field :name :base_type :special_type :id :table_id [:table.name :table_name]]
......
......@@ -12,7 +12,8 @@
[metabase.sync-database :as sync-database]
[metabase.util.schema :as su]))
(def ^:private TableEntityType
;; TODO - I don't think this is used for anything any more
(def ^:private ^:deprecated TableEntityType
"Schema for a valid table entity type."
(apply s/enum (map name table/entity-types)))
......
......@@ -16,7 +16,8 @@
;;; ------------------------------------------------------------ Constants + Entity ------------------------------------------------------------
(def ^:const entity-types
;; TODO - I don't think this is used for anything anymore
(def ^:const ^:deprecated entity-types
"Valid values for `Table.entity_type` (field may also be `nil`)."
#{:person :event :photo :place})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment