DEV: Remove version-number-based logic (#25482)

The `deprecate_column` helper would change its behavior based on the current `Discourse::VERSION`. This means that 'finalizing' a stable release introduces a previously untested behavior change.

Much better to keep it as a deprecation until manual action is taken to introduce the breaking change.
This commit is contained in:
David Taylor 2024-01-30 17:34:10 +00:00 committed by GitHub
parent 9b50de4569
commit 88305e3d96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 12 deletions

View File

@ -5,20 +5,16 @@ module HasDeprecatedColumns
class_methods do class_methods do
def deprecate_column(column_name, drop_from:, raise_error: false, message: nil) def deprecate_column(column_name, drop_from:, raise_error: false, message: nil)
if Gem::Version.new(Discourse::VERSION::STRING) >= Gem::Version.new(drop_from) message = message.presence || "column `#{column_name}` is deprecated."
self.ignored_columns = self.ignored_columns.dup << column_name.to_s
else
message = message.presence || "column `#{column_name}` is deprecated"
define_method(column_name) do define_method(column_name) do
Discourse.deprecate(message, drop_from: drop_from, raise_error: raise_error) Discourse.deprecate(message, drop_from: drop_from, raise_error: raise_error)
super() super()
end end
define_method("#{column_name}=") do |value| define_method("#{column_name}=") do |value|
Discourse.deprecate(message, drop_from: drop_from, raise_error: raise_error) Discourse.deprecate(message, drop_from: drop_from, raise_error: raise_error)
super(value) super(value)
end
end end
end end
end end