mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 16:25:19 +01:00
Fix Rails/ThreeStateBooleanColumn
cop (#33269)
This commit is contained in:
parent
bcb3b627b9
commit
d6241f6751
21 changed files with 27 additions and 18 deletions
|
@ -7,3 +7,8 @@ Naming/VariableNumber:
|
||||||
Rails/CreateTableWithTimestamps:
|
Rails/CreateTableWithTimestamps:
|
||||||
Include:
|
Include:
|
||||||
- '*.rb'
|
- '*.rb'
|
||||||
|
|
||||||
|
# Enabled here as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
||||||
|
Rails/ThreeStateBooleanColumn:
|
||||||
|
Include:
|
||||||
|
- '*.rb'
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddAdminToUsers < ActiveRecord::Migration[4.2]
|
class AddAdminToUsers < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
add_column :users, :admin, :boolean, default: false
|
add_column :users, :admin, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddSensitiveToStatuses < ActiveRecord::Migration[5.0]
|
class AddSensitiveToStatuses < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :statuses, :sensitive, :boolean, default: false
|
add_column :statuses, :sensitive, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddRejectMediaToDomainBlocks < ActiveRecord::Migration[5.0]
|
class AddRejectMediaToDomainBlocks < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :domain_blocks, :reject_media, :boolean
|
add_column :domain_blocks, :reject_media, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[5.0]
|
||||||
t.column :encrypted_otp_secret_iv, :string
|
t.column :encrypted_otp_secret_iv, :string
|
||||||
t.column :encrypted_otp_secret_salt, :string
|
t.column :encrypted_otp_secret_salt, :string
|
||||||
t.column :consumed_timestep, :integer
|
t.column :consumed_timestep, :integer
|
||||||
t.column :otp_required_for_login, :boolean
|
t.column :otp_required_for_login, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
|
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
|
||||||
def up
|
def up
|
||||||
add_column :statuses, :reply, :boolean, nil: false, default: false
|
add_column :statuses, :reply, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class CreateImports < ActiveRecord::Migration[5.0]
|
||||||
create_table :imports do |t|
|
create_table :imports do |t|
|
||||||
t.integer :account_id, null: false
|
t.integer :account_id, null: false
|
||||||
t.integer :type, null: false
|
t.integer :type, null: false
|
||||||
t.boolean :approved
|
t.boolean :approved # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddLocalToStatuses < ActiveRecord::Migration[5.1]
|
class AddLocalToStatuses < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
add_column :statuses, :local, :boolean, null: true, default: nil
|
add_column :statuses, :local, :boolean, null: true, default: nil # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddDiscoverableToAccounts < ActiveRecord::Migration[5.2]
|
class AddDiscoverableToAccounts < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :accounts, :discoverable, :boolean
|
add_column :accounts, :discoverable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddByModeratorToTombstone < ActiveRecord::Migration[5.2]
|
class AddByModeratorToTombstone < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :tombstones, :by_moderator, :boolean
|
add_column :tombstones, :by_moderator, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,9 +4,11 @@ class AddCapabilitiesToTags < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
safety_assured do
|
safety_assured do
|
||||||
change_table(:tags, bulk: true) do |t|
|
change_table(:tags, bulk: true) do |t|
|
||||||
|
# rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
t.column :usable, :boolean
|
t.column :usable, :boolean
|
||||||
t.column :trendable, :boolean
|
t.column :trendable, :boolean
|
||||||
t.column :listable, :boolean
|
t.column :listable, :boolean
|
||||||
|
# rubocop:enable Rails/ThreeStateBooleanColumn
|
||||||
t.column :reviewed_at, :datetime
|
t.column :reviewed_at, :datetime
|
||||||
t.column :requested_review_at, :datetime
|
t.column :requested_review_at, :datetime
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddHideCollectionsToAccounts < ActiveRecord::Migration[5.2]
|
class AddHideCollectionsToAccounts < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :accounts, :hide_collections, :boolean
|
add_column :accounts, :hide_collections, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddForwardedToReports < ActiveRecord::Migration[5.2]
|
class AddForwardedToReports < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :reports, :forwarded, :boolean
|
add_column :reports, :forwarded, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class CreateLoginActivities < ActiveRecord::Migration[6.1]
|
||||||
t.belongs_to :user, null: false, foreign_key: { on_delete: :cascade }
|
t.belongs_to :user, null: false, foreign_key: { on_delete: :cascade }
|
||||||
t.string :authentication_method
|
t.string :authentication_method
|
||||||
t.string :provider
|
t.string :provider
|
||||||
t.boolean :success
|
t.boolean :success # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
t.string :failure_reason
|
t.string :failure_reason
|
||||||
t.inet :ip
|
t.inet :ip
|
||||||
t.string :user_agent
|
t.string :user_agent
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddSkipSignInTokenToUsers < ActiveRecord::Migration[6.1]
|
class AddSkipSignInTokenToUsers < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :users, :skip_sign_in_token, :boolean
|
add_column :users, :skip_sign_in_token, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ class CreatePreviewCardProviders < ActiveRecord::Migration[6.1]
|
||||||
create_table :preview_card_providers do |t|
|
create_table :preview_card_providers do |t|
|
||||||
t.string :domain, null: false, default: '', index: { unique: true }
|
t.string :domain, null: false, default: '', index: { unique: true }
|
||||||
t.attachment :icon
|
t.attachment :icon
|
||||||
t.boolean :trendable
|
t.boolean :trendable # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
t.datetime :reviewed_at
|
t.datetime :reviewed_at
|
||||||
t.datetime :requested_review_at
|
t.datetime :requested_review_at
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddTrendableToPreviewCards < ActiveRecord::Migration[6.1]
|
class AddTrendableToPreviewCards < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :preview_cards, :trendable, :boolean
|
add_column :preview_cards, :trendable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class AddTrendableToAccounts < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
safety_assured do
|
safety_assured do
|
||||||
change_table(:accounts, bulk: true) do |t|
|
change_table(:accounts, bulk: true) do |t|
|
||||||
t.column :trendable, :boolean
|
t.column :trendable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
t.column :reviewed_at, :datetime
|
t.column :reviewed_at, :datetime
|
||||||
t.column :requested_review_at, :datetime
|
t.column :requested_review_at, :datetime
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class AddTrendableToStatuses < ActiveRecord::Migration[6.1]
|
class AddTrendableToStatuses < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :statuses, :trendable, :boolean
|
add_column :statuses, :trendable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class AddOrderedMediaAttachmentIdsToStatusEdits < ActiveRecord::Migration[6.1]
|
||||||
t.column :ordered_media_attachment_ids, :bigint, array: true
|
t.column :ordered_media_attachment_ids, :bigint, array: true
|
||||||
t.column :media_descriptions, :text, array: true
|
t.column :media_descriptions, :text, array: true
|
||||||
t.column :poll_options, :string, array: true
|
t.column :poll_options, :string, array: true
|
||||||
t.column :sensitive, :boolean
|
t.column :sensitive, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,8 +14,10 @@ class CreateSeveredRelationships < ActiveRecord::Migration[7.0]
|
||||||
t.integer :direction, null: false
|
t.integer :direction, null: false
|
||||||
|
|
||||||
# Those attributes are carried over from the `follows` table
|
# Those attributes are carried over from the `follows` table
|
||||||
|
# rubocop:disable Rails/ThreeStateBooleanColumn
|
||||||
t.boolean :show_reblogs
|
t.boolean :show_reblogs
|
||||||
t.boolean :notify
|
t.boolean :notify
|
||||||
|
# rubocop:enable Rails/ThreeStateBooleanColumn
|
||||||
t.string :languages, array: true
|
t.string :languages, array: true
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
|
Loading…
Reference in a new issue