DEV: Improve code comment about when ignored columns can be removed (#26894)
Ignored columns can only be dropped when its associated post-deploy migration has been promoted to a regular migration. This is so because Discourse doesn't rely on a schema file system to setup a brand new database and thus the column information will be loaded by the application first before the post-deploy migration runs.
This commit is contained in:
parent
2347ff7074
commit
0b947b6aab
|
@ -4,9 +4,9 @@ class Category < ActiveRecord::Base
|
||||||
RESERVED_SLUGS = ["none"]
|
RESERVED_SLUGS = ["none"]
|
||||||
|
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
:suppress_from_latest, # TODO(2020-11-18): remove
|
:suppress_from_latest, # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
:required_tag_group_id, # TODO(2023-04-01): remove
|
:required_tag_group_id, # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
:min_tags_from_required_group, # TODO(2023-04-01): remove
|
:min_tags_from_required_group, # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
]
|
]
|
||||||
|
|
||||||
include Searchable
|
include Searchable
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DirectoryColumn < ActiveRecord::Base
|
class DirectoryColumn < ActiveRecord::Base
|
||||||
# TODO(2021-06-18): Remove automatic column
|
self.ignored_columns = ["automatic"] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = ["automatic"]
|
|
||||||
self.inheritance_column = nil
|
self.inheritance_column = nil
|
||||||
|
|
||||||
enum type: { automatic: 0, user_field: 1, plugin: 2 }, _scopes: false
|
enum type: { automatic: 0, user_field: 1, plugin: 2 }, _scopes: false
|
||||||
|
|
|
@ -40,8 +40,7 @@ class EmailToken < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO(2022-01-01): Remove
|
self.ignored_columns = %w[token] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = %w[token]
|
|
||||||
|
|
||||||
def self.scopes
|
def self.scopes
|
||||||
@scopes ||= Enum.new(signup: 1, password_reset: 2, email_login: 3, email_update: 4)
|
@scopes ||= Enum.new(signup: 1, password_reset: 2, email_login: 3, email_update: 4)
|
||||||
|
|
|
@ -10,8 +10,7 @@ class EmbeddableHost < ActiveRecord::Base
|
||||||
self.host.sub!(%r{/.*\z}, "")
|
self.host.sub!(%r{/.*\z}, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO(2021-07-23): Remove
|
self.ignored_columns = ["path_whitelist"] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = ["path_whitelist"]
|
|
||||||
|
|
||||||
def self.record_for_url(uri)
|
def self.record_for_url(uri)
|
||||||
if uri.is_a?(String)
|
if uri.is_a?(String)
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
require "net/imap"
|
require "net/imap"
|
||||||
|
|
||||||
class Group < ActiveRecord::Base
|
class Group < ActiveRecord::Base
|
||||||
# TODO(2021-05-26): remove
|
self.ignored_columns = %w[flair_url] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = %w[flair_url]
|
|
||||||
|
|
||||||
include HasCustomFields
|
include HasCustomFields
|
||||||
include AnonCacheInvalidator
|
include AnonCacheInvalidator
|
||||||
|
|
|
@ -13,8 +13,7 @@ class Invite < ActiveRecord::Base
|
||||||
include RateLimiter::OnCreateRecord
|
include RateLimiter::OnCreateRecord
|
||||||
include Trashable
|
include Trashable
|
||||||
|
|
||||||
# TODO(2021-05-22): remove
|
self.ignored_columns = %w[user_id redeemed_at] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = %w[user_id redeemed_at]
|
|
||||||
|
|
||||||
BULK_INVITE_EMAIL_LIMIT = 200
|
BULK_INVITE_EMAIL_LIMIT = 200
|
||||||
DOMAIN_REGEX =
|
DOMAIN_REGEX =
|
||||||
|
|
|
@ -11,8 +11,8 @@ class Post < ActiveRecord::Base
|
||||||
include LimitedEdit
|
include LimitedEdit
|
||||||
|
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
"avg_time", # TODO(2021-01-04): remove
|
"avg_time", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
"image_url", # TODO(2021-06-01): remove
|
"image_url", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
]
|
]
|
||||||
|
|
||||||
cattr_accessor :plugin_permitted_create_params, :plugin_permitted_update_params
|
cattr_accessor :plugin_permitted_create_params, :plugin_permitted_update_params
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Tag < ActiveRecord::Base
|
||||||
include HasSanitizableFields
|
include HasSanitizableFields
|
||||||
|
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
"topic_count", # TODO(tgxworld): Remove on 1 July 2023
|
"topic_count", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
]
|
]
|
||||||
|
|
||||||
RESERVED_TAGS = [
|
RESERVED_TAGS = [
|
||||||
|
|
|
@ -16,8 +16,8 @@ class Topic < ActiveRecord::Base
|
||||||
EXTERNAL_ID_MAX_LENGTH = 50
|
EXTERNAL_ID_MAX_LENGTH = 50
|
||||||
|
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
"avg_time", # TODO(2021-01-04): remove
|
"avg_time", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
"image_url", # TODO(2021-06-01): remove
|
"image_url", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
]
|
]
|
||||||
|
|
||||||
def_delegator :featured_users, :user_ids, :featured_user_ids
|
def_delegator :featured_users, :user_ids, :featured_user_ids
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class TopicUser < ActiveRecord::Base
|
class TopicUser < ActiveRecord::Base
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
:highest_seen_post_number, # Remove after 01 Jan 2022
|
:highest_seen_post_number, # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
]
|
]
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class UserApiKey < ActiveRecord::Base
|
class UserApiKey < ActiveRecord::Base
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
"scopes", # TODO(2020-12-18): remove
|
"scopes", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
]
|
]
|
||||||
|
|
||||||
REVOKE_MATCHER = RouteMatcher.new(actions: "user_api_keys#revoke", methods: :post, params: [:id])
|
REVOKE_MATCHER = RouteMatcher.new(actions: "user_api_keys#revoke", methods: :post, params: [:id])
|
||||||
|
|
|
@ -14,8 +14,7 @@ class UserOption < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
|
|
||||||
self.ignored_columns = [
|
self.ignored_columns = [
|
||||||
"disable_jump_reply", # Remove once 20210706091905 is promoted from post_deploy to regular migration
|
"sidebar_list_destination", # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
"sidebar_list_destination", # TODO(osama): Remove in January 2024
|
|
||||||
]
|
]
|
||||||
|
|
||||||
self.primary_key = :user_id
|
self.primary_key = :user_id
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserProfile < ActiveRecord::Base
|
class UserProfile < ActiveRecord::Base
|
||||||
# TODO Remove `badge_granted_title` after 2023-09-01
|
self.ignored_columns = ["badge_granted_title"] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = ["badge_granted_title"]
|
|
||||||
|
|
||||||
BAKED_VERSION = 1
|
BAKED_VERSION = 1
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ class UserStat < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
after_save :trigger_badges
|
after_save :trigger_badges
|
||||||
|
|
||||||
# TODO(2021-05-13): Remove
|
self.ignored_columns = ["topic_reply_count"] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||||
self.ignored_columns = ["topic_reply_count"]
|
|
||||||
|
|
||||||
def self.ensure_consistency!(last_seen = 1.hour.ago)
|
def self.ensure_consistency!(last_seen = 1.hour.ago)
|
||||||
reset_bounce_scores
|
reset_bounce_scores
|
||||||
|
|
|
@ -141,7 +141,7 @@ class Migration::SafeMigrate
|
||||||
or rename columns.
|
or rename columns.
|
||||||
|
|
||||||
Note, to minimize disruption use self.ignored_columns = ["column name"] on your
|
Note, to minimize disruption use self.ignored_columns = ["column name"] on your
|
||||||
ActiveRecord model, this can be removed 6 months or so later.
|
ActiveRecord model, this can be removed after the post deployment migration has been promoted to a regular migration.
|
||||||
|
|
||||||
This protection is in place to protect us against dropping columns that are currently
|
This protection is in place to protect us against dropping columns that are currently
|
||||||
in use by live applications.
|
in use by live applications.
|
||||||
|
|
Loading…
Reference in New Issue