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