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