Skip to content

Commit

Permalink
DEV: Deprecate array custom fields (discourse#24492)
Browse files Browse the repository at this point in the history
Array custom fields use separate rows for each value, but whenever we
update an array, we have always destroy the existing rows and create new
ones. Therefore, there's no benefit over using the json type.
  • Loading branch information
danielwaterworth authored Nov 21, 2023
1 parent b3c67a7 commit ced21fa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/concerns/has_custom_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def append_custom_field(target, key, value)
end

def register_custom_field_type(name, type)
if Array === type
Discourse.deprecate(
"Array types for custom fields are deprecated, use type :json instead",
drop_from: "3.3.0",
)
end

@custom_field_types ||= {}
@custom_field_types[name] = type
end
Expand Down

0 comments on commit ced21fa

Please sign in to comment.