Fix `Rails/ReversibleMigration` cop for `change_column` (#30835)
parent
7a84b76bb1
commit
528a7f57fa
|
@ -1,7 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MakeUrisNullableInStatuses < ActiveRecord::Migration[4.2]
|
class MakeUrisNullableInStatuses < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def up
|
||||||
change_column :statuses, :uri, :string, null: true, default: nil
|
change_column :statuses, :uri, :string, null: true, default: nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ChangePrimaryKeyToBigintOnStatuses < ActiveRecord::Migration[5.0]
|
class ChangePrimaryKeyToBigintOnStatuses < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def up
|
||||||
change_table(:statuses, bulk: true) do |t|
|
change_table(:statuses, bulk: true) do |t|
|
||||||
t.change :id, :bigint
|
t.change :id, :bigint
|
||||||
t.change :reblog_of_id, :bigint
|
t.change :reblog_of_id, :bigint
|
||||||
|
@ -16,4 +16,8 @@ class ChangePrimaryKeyToBigintOnStatuses < ActiveRecord::Migration[5.0]
|
||||||
change_column :statuses_tags, :status_id, :bigint
|
change_column :statuses_tags, :status_id, :bigint
|
||||||
change_column :stream_entries, :activity_id, :bigint
|
change_column :stream_entries, :activity_id, :bigint
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RemoveDefaultLanguageFromStatuses < ActiveRecord::Migration[5.1]
|
class RemoveDefaultLanguageFromStatuses < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def up
|
||||||
change_column :statuses, :language, :string, default: nil, null: true
|
change_column :statuses, :language, :string, default: nil, null: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue