2020-11-08 08:28:39 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class FillAccountSuspensionOrigin < ActiveRecord::Migration[5.2]
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
2023-08-09 18:26:42 +09:00
|
|
|
class MigrationAccount < ApplicationRecord
|
|
|
|
self.table_name = :accounts
|
|
|
|
scope :suspended, -> { where.not(suspended_at: nil) }
|
|
|
|
enum suspension_origin: { local: 0, remote: 1 }, _prefix: true
|
|
|
|
end
|
|
|
|
|
2020-11-08 08:28:39 +09:00
|
|
|
def up
|
2023-08-09 18:26:42 +09:00
|
|
|
MigrationAccount.reset_column_information
|
|
|
|
MigrationAccount.suspended.where(suspension_origin: nil).in_batches.update_all(suspension_origin: :local)
|
2020-11-08 08:28:39 +09:00
|
|
|
end
|
|
|
|
|
|
|
|
def down; end
|
|
|
|
end
|