debian-mirror-gitlab/db/post_migrate/20211220123956_update_invalid_member_states.rb

22 lines
442 B
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# frozen_string_literal: true
class UpdateInvalidMemberStates < Gitlab::Database::Migration[1.0]
class Member < ActiveRecord::Base
include EachBatch
self.table_name = 'members'
scope :in_invalid_state, -> { where(state: 2) }
end
def up
Member.in_invalid_state.each_batch do |relation|
relation.update_all(state: 0)
end
end
def down
# no-op as we don't need to revert any changed records
end
end