Commit d6ecc99d authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '354776-remove-database-async-index-creation-ff-from-migration-helpers' into 'master'

Remove `database_async_index_creation` feature flag check from migration helpers

See merge request gitlab-org/gitlab!82565
parents ac1c2533 f296a13d
...@@ -72,8 +72,7 @@ module Gitlab ...@@ -72,8 +72,7 @@ module Gitlab
end end
def async_index_creation_available? def async_index_creation_available?
ApplicationRecord.connection.table_exists?(:postgres_async_indexes) && connection.table_exists?(:postgres_async_indexes)
Feature.enabled?(:database_async_index_creation, type: :ops)
end end
end end
end end
......
...@@ -16,11 +16,6 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do ...@@ -16,11 +16,6 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
describe '#unprepare_async_index' do describe '#unprepare_async_index' do
let!(:async_index) { create(:postgres_async_index, name: index_name) } let!(:async_index) { create(:postgres_async_index, name: index_name) }
context 'when the flag is enabled' do
before do
stub_feature_flags(database_async_index_creation: true)
end
it 'destroys the record' do it 'destroys the record' do
expect do expect do
migration.unprepare_async_index(table_name, 'id') migration.unprepare_async_index(table_name, 'id')
...@@ -48,26 +43,10 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do ...@@ -48,26 +43,10 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
end end
end end
context 'when the feature flag is disabled' do
it 'does not destroy the record' do
stub_feature_flags(database_async_index_creation: false)
expect do
migration.unprepare_async_index(table_name, 'id')
end.not_to change { index_model.where(name: index_name).count }
end
end
end
describe '#unprepare_async_index_by_name' do describe '#unprepare_async_index_by_name' do
let(:index_name) { "index_#{table_name}_on_id" } let(:index_name) { "index_#{table_name}_on_id" }
let!(:async_index) { create(:postgres_async_index, name: index_name) } let!(:async_index) { create(:postgres_async_index, name: index_name) }
context 'when the flag is enabled' do
before do
stub_feature_flags(database_async_index_creation: true)
end
it 'destroys the record' do it 'destroys the record' do
expect do expect do
migration.unprepare_async_index_by_name(table_name, index_name) migration.unprepare_async_index_by_name(table_name, index_name)
...@@ -85,27 +64,11 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do ...@@ -85,27 +64,11 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
end end
end end
context 'when the feature flag is disabled' do
it 'does not destroy the record' do
stub_feature_flags(database_async_index_creation: false)
expect do
migration.unprepare_async_index_by_name(table_name, index_name)
end.not_to change { index_model.where(name: index_name).count }
end
end
end
describe '#prepare_async_index' do describe '#prepare_async_index' do
before do before do
connection.create_table(table_name) connection.create_table(table_name)
end end
context 'when the feature flag is enabled' do
before do
stub_feature_flags(database_async_index_creation: true)
end
it 'creates the record for the async index' do it 'creates the record for the async index' do
expect do expect do
migration.prepare_async_index(table_name, 'id') migration.prepare_async_index(table_name, 'id')
...@@ -179,15 +142,4 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do ...@@ -179,15 +142,4 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
end end
end end
end end
context 'when the feature flag is disabled' do
it 'does not create the record' do
stub_feature_flags(database_async_index_creation: false)
expect do
migration.prepare_async_index(table_name, 'id')
end.not_to change { index_model.where(name: index_name).count }
end
end
end
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