debian-mirror-gitlab/db/post_migrate/20200623142159_remove_gitlab_issue_tracker_service_records.rb
2020-08-09 17:44:08 +05:30

29 lines
538 B
Ruby

# frozen_string_literal: true
class RemoveGitlabIssueTrackerServiceRecords < ActiveRecord::Migration[6.0]
DOWNTIME = false
BATCH_SIZE = 5000
disable_ddl_transaction!
class Service < ActiveRecord::Base
include EachBatch
self.table_name = 'services'
def self.gitlab_issue_tracker_service
where(type: 'GitlabIssueTrackerService')
end
end
def up
Service.each_batch(of: BATCH_SIZE) do |services|
services.gitlab_issue_tracker_service.delete_all
end
end
def down
# no-op
end
end