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

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

Removes storage_size index on project statistics

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



Merged-by: default avatarAlper Akgun <aakgun@gitlab.com>
Approved-by: default avatarAlper Akgun <aakgun@gitlab.com>
Reviewed-by: default avatarAlper Akgun <aakgun@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 RemoveIdxProjectStatisticsStorageSizeAndProjectIdSync < Gitlab::Database::Migration[2.2]
milestone '17.2'
disable_ddl_transaction!
INDEX_NAME = 'index_project_statistics_on_storage_size_and_project_id'
COLUMNS = %i[storage_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
9a51da84b0b6bb947fd5c0d816a71a1f0feec7d72ee60e9ea13ba7b811f27dfa
\ No newline at end of file
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
require_migration! require_migration!
RSpec.describe RemoveProjectStatisticsStorageSizeAndProjectIdIndex, feature_category: :consumables_cost_management do RSpec.describe RemoveProjectStatisticsStorageSizeAndProjectIdIndex,
feature_category: :consumables_cost_management,
schema: 20240611121101 do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let(:postgres_async_indexes) { table(:postgres_async_indexes) } let(:postgres_async_indexes) { table(:postgres_async_indexes) }
......
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe RemoveIdxProjectStatisticsStorageSizeAndProjectIdSync,
feature_category: :consumables_cost_management,
schema: 20240708121037 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.
先完成此消息的编辑!
想要评论请 注册