DEV: Remove logical OR assignment of constants (#29201)

Constants should always be only assigned once. The logical OR assignment
of a constant is a relic of the past before we used zeitwerk for
autoloading and had bugs where a file could be loaded twice resulting in
constant redefinition warnings.
This commit is contained in:
Alan Guo Xiang Tan
2024-10-16 10:09:07 +08:00
committed by GitHub
parent f3f37c9019
commit 322a3be2db
112 changed files with 267 additions and 267 deletions

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class DropBadgeImageColumn < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS ||= { badges: %i[image] }
DROPPED_COLUMNS = { badges: %i[image] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class DropDeprecatedColumns < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS ||= {
DROPPED_COLUMNS = {
categories: %i[suppress_from_latest required_tag_group_id min_tags_from_required_group],
directory_columns: %i[automatic],
email_tokens: %i[token],

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class SwapFieldTypeWithFieldTypeEnumOnUserFields < ActiveRecord::Migration[7.0]
# DROPPED_COLUMNS ||= { user_fields: %i[field_type] }
# DROPPED_COLUMNS = { user_fields: %i[field_type] }
# def up
# # WARNING: Swapping in a column of a different type in a post-migration will break the AR

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class DropCompiledJsFromTranslationOverrides < ActiveRecord::Migration[7.1]
DROPPED_COLUMNS ||= { translation_overrides: %i[compiled_js] }
DROPPED_COLUMNS = { translation_overrides: %i[compiled_js] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class DropCustomTypeFromFlags < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS ||= { flags: %i[custom_type] }
DROPPED_COLUMNS = { flags: %i[custom_type] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class DropGroupsSmtpSsl < ActiveRecord::Migration[7.1]
DROPPED_COLUMNS ||= { groups: %i[smtp_ssl] }
DROPPED_COLUMNS = { groups: %i[smtp_ssl] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }