Fix `Rails/ReversibleMigrationMethodDefinition` cop (#30794)
This commit is contained in:
parent
2cab1c7b09
commit
4651c0cb39
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2]
|
class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2]
|
||||||
def self.up
|
def up
|
||||||
change_table :accounts do |t|
|
change_table :accounts do |t|
|
||||||
# The following corresponds to `t.attachment :avatar` in an older version of Paperclip
|
# The following corresponds to `t.attachment :avatar` in an older version of Paperclip
|
||||||
t.string :avatar_file_name
|
t.string :avatar_file_name
|
||||||
|
@ -11,7 +11,7 @@ class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def down
|
||||||
remove_attachment :accounts, :avatar
|
remove_attachment :accounts, :avatar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddDeviseToUsers < ActiveRecord::Migration[4.2]
|
class AddDeviseToUsers < ActiveRecord::Migration[4.2]
|
||||||
def self.up
|
def up
|
||||||
change_table(:users, bulk: true) do |t|
|
change_table(:users, bulk: true) do |t|
|
||||||
## Database authenticatable
|
## Database authenticatable
|
||||||
t.string :encrypted_password, null: false, default: ''
|
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
|
add_index :users, :reset_password_token, unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def down
|
||||||
remove_index :users, :reset_password_token
|
remove_index :users, :reset_password_token
|
||||||
|
|
||||||
remove_column :users, :encrypted_password
|
remove_column :users, :encrypted_password
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2]
|
class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2]
|
||||||
def self.up
|
def up
|
||||||
change_table :accounts do |t|
|
change_table :accounts do |t|
|
||||||
# The following corresponds to `t.attachment :header` in an older version of Paperclip
|
# The following corresponds to `t.attachment :header` in an older version of Paperclip
|
||||||
t.string :header_file_name
|
t.string :header_file_name
|
||||||
|
@ -11,7 +11,7 @@ class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def down
|
||||||
remove_attachment :accounts, :header
|
remove_attachment :accounts, :header
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RailsSettingsMigration < ActiveRecord::Migration[5.0]
|
class RailsSettingsMigration < ActiveRecord::Migration[5.0]
|
||||||
def self.up
|
def up
|
||||||
create_table :settings do |t|
|
create_table :settings do |t|
|
||||||
t.string :var, null: false
|
t.string :var, null: false
|
||||||
t.text :value
|
t.text :value
|
||||||
|
@ -11,7 +11,7 @@ class RailsSettingsMigration < ActiveRecord::Migration[5.0]
|
||||||
add_index :settings, [:target_type, :target_id, :var], unique: true
|
add_index :settings, [:target_type, :target_id, :var], unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def down
|
||||||
drop_table :settings
|
drop_table :settings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddAttachmentDataToImports < ActiveRecord::Migration[4.2]
|
class AddAttachmentDataToImports < ActiveRecord::Migration[4.2]
|
||||||
def self.up
|
def up
|
||||||
change_table :imports do |t|
|
change_table :imports do |t|
|
||||||
# The following corresponds to `t.attachment :data` in an older version of Paperclip
|
# The following corresponds to `t.attachment :data` in an older version of Paperclip
|
||||||
t.string :data_file_name
|
t.string :data_file_name
|
||||||
|
@ -11,7 +11,7 @@ class AddAttachmentDataToImports < ActiveRecord::Migration[4.2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def down
|
||||||
remove_attachment :imports, :data
|
remove_attachment :imports, :data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue