Skip to content
Snippets Groups Projects
Commit 0f0d4059 authored by Arturo Herrero's avatar Arturo Herrero
Browse files

Remove Flowdock integration records

Changelog: removed
parent 031af185
No related branches found
No related tags found
1 merge request!105363Remove Flowdock integration records
# frozen_string_literal: true
class RemoveFlowdockIntegrationRecords < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
class Integration < MigrationRecord
include EachBatch
self.table_name = 'integrations'
end
def up
Integration.each_batch(of: 100_000, column: :id) do |relation|
relation.delete_by(type_new: 'Integrations::Flowdock')
end
end
def down
# no-op
end
end
ae20537326115d37db8beb3432ffd3ace447b39a75906535d319da4db1fcb1b2
\ No newline at end of file
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db/post_migrate/20221129124240_remove_flowdock_integration_records.rb')
RSpec.describe RemoveFlowdockIntegrationRecords, feature_category: :integrations do
let(:integrations) { table(:integrations) }
before do
integrations.create!(type_new: 'Integrations::Flowdock')
integrations.create!(type_new: 'SomeOtherType')
end
it 'removes integrations records of type_new Integrations::Flowdock' do
expect(integrations.count).to eq(2)
migrate!
expect(integrations.count).to eq(1)
expect(integrations.first.type_new).to eq('SomeOtherType')
expect(integrations.where(type_new: 'Integrations::Flowdock')).to be_empty
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment