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