Commit 272464a4 authored by Luke Duncalfe's avatar Luke Duncalfe

Remove BuildsEmailService records from services

The `BuildsEmailService` records were migrated to
`PipelinesEmailService` in 12dd5ac2.

That commit also deleted the corresponding spec and added a comment that
this model could be removed in 9.1.

However, there are still 305 `BuildsEmailService` records in the
GitLab.com database.

This change:

1. Deletes records in the `services` table with type of
`"BuildsEmailService"`.
2. Deletes the model

https://gitlab.com/gitlab-org/gitlab/-/issues/331064
https://gitlab.com/gitlab-org/gitlab/-/issues/332551

Changelog: removed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63264
parent 09880fea
# frozen_string_literal: true
# This class is to be removed with 9.1
# We should also by then remove BuildsEmailService from database
# https://gitlab.com/gitlab-org/gitlab/-/issues/331064
module Integrations
class BuildsEmail < Integration
def self.to_param
'builds_email'
end
def self.supported_events
%w[]
end
end
end
# frozen_string_literal: true
class RemoveBuildsEmailServiceFromServices < ActiveRecord::Migration[6.1]
def up
execute("DELETE from services WHERE type = 'BuildsEmailService'")
end
def down
# no-op
end
end
fb02e0fee2760dad203b54d81c342dbf1461b3010503cab05da1eb14ab5d33da
\ No newline at end of file
# frozen_string_literal: true
require 'spec_helper'
require_migration!('remove_builds_email_service_from_services')
RSpec.describe RemoveBuildsEmailServiceFromServices do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:services) { table(:services) }
let(:namespace) { namespaces.create!(name: 'foo', path: 'bar') }
let(:project) { projects.create!(namespace_id: namespace.id) }
it 'correctly deletes `BuildsEmailService` services' do
services.create!(project_id: project.id, type: 'BuildsEmailService')
services.create!(project_id: project.id, type: 'OtherService')
expect(services.all.pluck(:type)).to match_array %w[BuildsEmailService OtherService]
migrate!
expect(services.all.pluck(:type)).to eq %w[OtherService]
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment