Skip to content
代码片段 群组 项目
未验证 提交 ef227f76 编辑于 作者: Adam Hegyi's avatar Adam Hegyi 提交者: GitLab
浏览文件

Merge branch 'vij-sync-remove-ps-wiki-size' into 'master'

Remove wiki_size index on project statistics

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158623



Merged-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
Approved-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
Reviewed-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Co-authored-by: default avatarVijay Hawoldar <vhawoldar@gitlab.com>
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
class RemoveIdxProjectStatisticsWikiSizeAndProjectIdSync < Gitlab::Database::Migration[2.2]
milestone '17.3'
disable_ddl_transaction!
INDEX_NAME = 'index_project_statistics_on_wiki_size_and_project_id'
COLUMNS = %i[wiki_size project_id]
def up
return unless should_run?
remove_concurrent_index_by_name :project_statistics, name: INDEX_NAME
end
def down
return unless should_run?
add_concurrent_index :project_statistics, COLUMNS, name: INDEX_NAME
end
def should_run?
Gitlab.com_except_jh?
end
end
4b1b5505a9becd13c4001b16f07a2fa2f0e331b97fed81a93b098ba82fc95715
\ No newline at end of file
......@@ -4,7 +4,9 @@
require_migration!
RSpec.describe RemoveProjectStatisticsWikiSizeAndProjectIdIndex, feature_category: :consumables_cost_management do
RSpec.describe RemoveProjectStatisticsWikiSizeAndProjectIdIndex,
feature_category: :consumables_cost_management,
schema: 20240611122408 do
let(:migration) { described_class.new }
let(:postgres_async_indexes) { table(:postgres_async_indexes) }
......
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe RemoveIdxProjectStatisticsWikiSizeAndProjectIdSync,
feature_category: :consumables_cost_management,
schema: 20240708130252 do
let(:migration) { described_class.new }
describe '#up' do
it 'does nothing when not on gitlab.com' do
expect(migration).not_to receive(:remove_concurrent_index_by_name)
migration.up
end
it 'removes the index when on gitlab.com', :saas do
expect(migration).to receive(:remove_concurrent_index_by_name)
migration.up
end
end
describe '#down' do
it 'does nothing when not on gitlab.com' do
expect(migration).not_to receive(:add_concurrent_index)
migration.down
end
it 're-adds the index when on gitlab.com', :saas do
expect(migration).to receive(:add_concurrent_index)
migration.down
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册