Skip to content
Snippets Groups Projects
Commit ff392c4c authored by Cam Saul's avatar Cam Saul
Browse files

Add has_field_values to Field

parent 88ba5a71
No related branches found
No related tags found
No related merge requests found
......@@ -4020,3 +4020,15 @@ databaseChangeLog:
remarks: 'True if a XLS of the data should be included for this pulse card'
constraints:
nullable: false
- changeSet:
id: 74
author: camsaul
comment: 'Added 0.29.0'
changes:
- addColumn:
tableName: metabase_field
columns:
- column:
name: has_field_values
type: text
remarks: 'Whether we have FieldValues ("list"), should ad-hoc search ("search"), disable entirely ("none"), or infer dynamically (null)"'
......@@ -64,14 +64,17 @@
(api/defendpoint PUT "/:id"
"Update `Field` with ID."
[id :as {{:keys [caveats description display_name fk_target_field_id points_of_interest special_type visibility_type], :as body} :body}]
[id :as {{:keys [caveats description display_name fk_target_field_id points_of_interest special_type
visibility_type has_field_values]
:as body} :body}]
{caveats (s/maybe su/NonBlankString)
description (s/maybe su/NonBlankString)
display_name (s/maybe su/NonBlankString)
fk_target_field_id (s/maybe su/IntGreaterThanZero)
points_of_interest (s/maybe su/NonBlankString)
special_type (s/maybe FieldType)
visibility_type (s/maybe FieldVisibilityType)}
visibility_type (s/maybe FieldVisibilityType)
has_field_values (s/maybe (s/enum "search" "list" "none"))}
(let [field (hydrate (api/write-check Field id) :dimensions)
new-special-type (keyword (get body :special_type (:special_type field)))
removed-fk? (removed-fk-special-type? (:special_type field) new-special-type)
......@@ -92,7 +95,8 @@
(clear-dimension-on-type-change! field (:base_type field) new-special-type)
(db/update! Field id
(u/select-keys-when (assoc body :fk_target_field_id (when-not removed-fk? fk-target-field-id))
:present #{:caveats :description :fk_target_field_id :points_of_interest :special_type :visibility_type}
:present #{:caveats :description :fk_target_field_id :points_of_interest :special_type :visibility_type
:has_field_values}
:non-nil #{:display_name})))))
;; return updated field
(hydrate (Field id) :dimensions)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment