Revert "DEV: Remove stale ignored_columns from models."

This reverts commit 9f5c8644d0.

Have to revert because the ignored columns have not been dropped.
This commit is contained in:
Alan Guo Xiang Tan 2022-01-11 10:57:21 +08:00
parent c2afc3915b
commit 6fb89c153a
13 changed files with 51 additions and 0 deletions

View File

@ -1,6 +1,9 @@
# frozen_string_literal: true
class Badge < ActiveRecord::Base
# TODO: Drop in July 2021
self.ignored_columns = %w{image}
include GlobalPath
include HasSanitizableFields

View File

@ -5,6 +5,11 @@ class Category < ActiveRecord::Base
'none'
]
# TODO(2020-11-18): remove
self.ignored_columns = %w{
suppress_from_latest
}
include Searchable
include Positionable
include HasCustomFields

View File

@ -2,6 +2,8 @@
class DirectoryColumn < ActiveRecord::Base
# TODO(2021-06-18): Remove automatic column
self.ignored_columns = ["automatic"]
self.inheritance_column = nil
enum type: { automatic: 0, user_field: 1, plugin: 2 }, _scopes: false

View File

@ -35,6 +35,9 @@ class EmailToken < ActiveRecord::Base
end
end
# TODO(2022-01-01): Remove
self.ignored_columns = %w{token}
def self.scopes
@scopes ||= Enum.new(
signup: 1,

View File

@ -10,6 +10,9 @@ class EmbeddableHost < ActiveRecord::Base
self.host.sub!(/\/.*$/, '')
end
# TODO(2021-07-23): Remove
self.ignored_columns = ["path_whitelist"]
def self.record_for_url(uri)
if uri.is_a?(String)

View File

@ -8,6 +8,12 @@ class Invite < ActiveRecord::Base
include RateLimiter::OnCreateRecord
include Trashable
# TODO(2021-05-22): remove
self.ignored_columns = %w{
user_id
redeemed_at
}
BULK_INVITE_EMAIL_LIMIT = 200
DOMAIN_REGEX = /\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/

View File

@ -10,6 +10,11 @@ class Post < ActiveRecord::Base
include HasCustomFields
include LimitedEdit
self.ignored_columns = [
"avg_time", # TODO(2021-01-04): remove
"image_url" # TODO(2021-06-01): remove
]
cattr_accessor :plugin_permitted_create_params, :plugin_permitted_update_params
self.plugin_permitted_create_params = {}
self.plugin_permitted_update_params = {}

View File

@ -11,6 +11,11 @@ class Topic < ActiveRecord::Base
include LimitedEdit
extend Forwardable
self.ignored_columns = [
"avg_time", # TODO(2021-01-04): remove
"image_url" # TODO(2021-06-01): remove
]
def_delegator :featured_users, :user_ids, :featured_user_ids
def_delegator :featured_users, :choose, :feature_topic_users

View File

@ -3,6 +3,10 @@
class TopicTimer < ActiveRecord::Base
MAX_DURATION_MINUTES = 20.years.to_i / 60
self.ignored_columns = [
"duration" # TODO(2021-06-01): remove
]
include Trashable
belongs_to :user

View File

@ -1,6 +1,10 @@
# frozen_string_literal: true
class TopicUser < ActiveRecord::Base
self.ignored_columns = [
:highest_seen_post_number # Remove after 01 Jan 2022
]
belongs_to :user
belongs_to :topic

View File

@ -3,6 +3,10 @@
require "digest/sha1"
class Upload < ActiveRecord::Base
self.ignored_columns = [
"verified" # TODO(2020-12-10): remove
]
include ActionView::Helpers::NumberHelper
include HasUrl

View File

@ -1,6 +1,10 @@
# frozen_string_literal: true
class UserApiKey < ActiveRecord::Base
self.ignored_columns = [
"scopes" # TODO(2020-12-18): remove
]
REVOKE_MATCHER = RouteMatcher.new(actions: "user_api_keys#revoke", methods: :post, params: [:id])
belongs_to :user

View File

@ -4,6 +4,9 @@ class UserStat < ActiveRecord::Base
belongs_to :user
after_save :trigger_badges
# TODO(2021-05-13): Remove
self.ignored_columns = ["topic_reply_count"]
def self.ensure_consistency!(last_seen = 1.hour.ago)
reset_bounce_scores
update_distinct_badge_count