From 4651c0cb39c1a1e4feb6d8fc2b53de622eeb7373 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 21 Jun 2024 10:43:12 -0400 Subject: [PATCH] Fix `Rails/ReversibleMigrationMethodDefinition` cop (#30794) --- .../20160227230233_add_attachment_avatar_to_accounts.rb | 4 ++-- db/migrate/20160305115639_add_devise_to_users.rb | 4 ++-- .../20160312193225_add_attachment_header_to_accounts.rb | 4 ++-- db/migrate/20161006213403_rails_settings_migration.rb | 4 ++-- db/migrate/20170330164118_add_attachment_data_to_imports.rb | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb b/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb index 534df25ee..cfe4c23de 100644 --- a/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb +++ b/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2] - def self.up + def up change_table :accounts do |t| # The following corresponds to `t.attachment :avatar` in an older version of Paperclip t.string :avatar_file_name @@ -11,7 +11,7 @@ class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2] end end - def self.down + def down remove_attachment :accounts, :avatar end end diff --git a/db/migrate/20160305115639_add_devise_to_users.rb b/db/migrate/20160305115639_add_devise_to_users.rb index 64ad78dbc..22697b238 100644 --- a/db/migrate/20160305115639_add_devise_to_users.rb +++ b/db/migrate/20160305115639_add_devise_to_users.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AddDeviseToUsers < ActiveRecord::Migration[4.2] - def self.up + def up change_table(:users, bulk: true) do |t| ## Database authenticatable t.string :encrypted_password, null: false, default: '' @@ -24,7 +24,7 @@ class AddDeviseToUsers < ActiveRecord::Migration[4.2] add_index :users, :reset_password_token, unique: true end - def self.down + def down remove_index :users, :reset_password_token remove_column :users, :encrypted_password diff --git a/db/migrate/20160312193225_add_attachment_header_to_accounts.rb b/db/migrate/20160312193225_add_attachment_header_to_accounts.rb index b481fc529..45dc65236 100644 --- a/db/migrate/20160312193225_add_attachment_header_to_accounts.rb +++ b/db/migrate/20160312193225_add_attachment_header_to_accounts.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2] - def self.up + def up change_table :accounts do |t| # The following corresponds to `t.attachment :header` in an older version of Paperclip t.string :header_file_name @@ -11,7 +11,7 @@ class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2] end end - def self.down + def down remove_attachment :accounts, :header end end diff --git a/db/migrate/20161006213403_rails_settings_migration.rb b/db/migrate/20161006213403_rails_settings_migration.rb index 9764196fa..d08ad2efd 100644 --- a/db/migrate/20161006213403_rails_settings_migration.rb +++ b/db/migrate/20161006213403_rails_settings_migration.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class RailsSettingsMigration < ActiveRecord::Migration[5.0] - def self.up + def up create_table :settings do |t| t.string :var, null: false t.text :value @@ -11,7 +11,7 @@ class RailsSettingsMigration < ActiveRecord::Migration[5.0] add_index :settings, [:target_type, :target_id, :var], unique: true end - def self.down + def down drop_table :settings end end diff --git a/db/migrate/20170330164118_add_attachment_data_to_imports.rb b/db/migrate/20170330164118_add_attachment_data_to_imports.rb index 0daaa9d02..afacfa86d 100644 --- a/db/migrate/20170330164118_add_attachment_data_to_imports.rb +++ b/db/migrate/20170330164118_add_attachment_data_to_imports.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AddAttachmentDataToImports < ActiveRecord::Migration[4.2] - def self.up + def up change_table :imports do |t| # The following corresponds to `t.attachment :data` in an older version of Paperclip t.string :data_file_name @@ -11,7 +11,7 @@ class AddAttachmentDataToImports < ActiveRecord::Migration[4.2] end end - def self.down + def down remove_attachment :imports, :data end end