Skip to content

Commit

Permalink
Merge pull request #10241 from DFE-Digital/545-part-2-remove-feature-…
Browse files Browse the repository at this point in the history
…flag-from-database

[545] part 2 remove feature flag from database
  • Loading branch information
elceebee authored Jan 14, 2025
2 parents 0b8e77e + 6476f05 commit 78d4c09
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module DataMigrations
class RemoveNewWithdrawalReasonsFeatureFlag
TIMESTAMP = 20250109170301
MANUAL_RUN = false

def change
Feature.where(name: :new_candidate_withdrawal_reasons).delete_all
end
end
end
1 change: 1 addition & 0 deletions lib/tasks/data.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DATA_MIGRATION_SERVICES = [
# do not delete or edit this line - services added below by generator
'DataMigrations::RemoveNewWithdrawalReasonsFeatureFlag',
'DataMigrations::RemoveUnusedFeatureFlags',
'DataMigrations::RemoveTdaFlag',
'DataMigrations::DeleteAllOldAudits',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'rails_helper'

RSpec.describe DataMigrations::RemoveNewWithdrawalReasonsFeatureFlag do
context 'when the feature flag exist' do
it 'removes the relevant feature flags' do
create(:feature, name: 'new_candidate_withdrawal_reasons')
create(:feature, name: 'some_other_feature_flag')

expect { described_class.new.change }.to change { Feature.count }.by(-1)
expect(Feature.where(name: 'new_candidate_withdrawal_reasons')).to be_none
expect(Feature.where(name: 'some_other_feature_flag')).to be_any
end
end

context 'when the feature flags have already been dropped' do
it 'does nothing' do
expect { described_class.new.change }.not_to(change { Feature.count })
end
end
end

0 comments on commit 78d4c09

Please sign in to comment.