mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 18:45:41 +01:00
Enable Rails/ReversibleMigration
cop (#33264)
This commit is contained in:
parent
315c170910
commit
43702b95a2
4 changed files with 16 additions and 7 deletions
|
@ -3,12 +3,17 @@ inherit_from: ../../.rubocop.yml
|
||||||
Naming/VariableNumber:
|
Naming/VariableNumber:
|
||||||
CheckSymbols: false
|
CheckSymbols: false
|
||||||
|
|
||||||
# Enabled here as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
# Below are all enabled as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
||||||
|
# TODO: Delete this file and move above config to base naming config
|
||||||
|
|
||||||
Rails/CreateTableWithTimestamps:
|
Rails/CreateTableWithTimestamps:
|
||||||
Include:
|
Include:
|
||||||
- '*.rb'
|
- '*.rb'
|
||||||
|
|
||||||
# Enabled here as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
|
||||||
Rails/ThreeStateBooleanColumn:
|
Rails/ThreeStateBooleanColumn:
|
||||||
Include:
|
Include:
|
||||||
- '*.rb'
|
- '*.rb'
|
||||||
|
|
||||||
|
Rails/ReversibleMigration:
|
||||||
|
Include:
|
||||||
|
- '*.rb'
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RemoveDevices < ActiveRecord::Migration[5.0]
|
class RemoveDevices < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def up
|
||||||
drop_table :devices if table_exists?(:devices)
|
drop_table :devices if table_exists?(:devices)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
class FixNullBooleans < ActiveRecord::Migration[5.1]
|
class FixNullBooleans < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
safety_assured do
|
safety_assured do
|
||||||
change_column_default :domain_blocks, :reject_media, false
|
change_column_default :domain_blocks, :reject_media, false # rubocop:disable Rails/ReversibleMigration
|
||||||
change_column_null :domain_blocks, :reject_media, false, false
|
change_column_null :domain_blocks, :reject_media, false, false
|
||||||
|
|
||||||
change_column_default :imports, :approved, false
|
change_column_default :imports, :approved, false # rubocop:disable Rails/ReversibleMigration
|
||||||
change_column_null :imports, :approved, false, false
|
change_column_null :imports, :approved, false, false
|
||||||
|
|
||||||
change_column_null :statuses, :sensitive, false, false
|
change_column_null :statuses, :sensitive, false, false
|
||||||
|
@ -14,7 +14,7 @@ class FixNullBooleans < ActiveRecord::Migration[5.1]
|
||||||
|
|
||||||
change_column_null :users, :admin, false, false
|
change_column_null :users, :admin, false, false
|
||||||
|
|
||||||
change_column_default :users, :otp_required_for_login, false
|
change_column_default :users, :otp_required_for_login, false # rubocop:disable Rails/ReversibleMigration
|
||||||
change_column_null :users, :otp_required_for_login, false, false
|
change_column_null :users, :otp_required_for_login, false, false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
class ChangeCanonicalEmailBlocksNullable < ActiveRecord::Migration[6.1]
|
class ChangeCanonicalEmailBlocksNullable < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
safety_assured { change_column :canonical_email_blocks, :reference_account_id, :bigint, null: true, default: nil }
|
safety_assured { change_column :canonical_email_blocks, :reference_account_id, :bigint, null: true, default: nil } # rubocop:disable Rails/ReversibleMigration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue