2020-11-07 15:28:39 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class FillAccountSuspensionOrigin < ActiveRecord::Migration[5.2]
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
2023-08-09 02:26:42 -07: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-07 15:28:39 -08:00
|
|
|
def up
|
2023-08-09 02:26:42 -07:00
|
|
|
MigrationAccount.reset_column_information
|
|
|
|
MigrationAccount.suspended.where(suspension_origin: nil).in_batches.update_all(suspension_origin: :local)
|
2020-11-07 15:28:39 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def down; end
|
|
|
|
end
|