diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-08 00:10:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-08 00:10:15 +0300 |
commit | 4cf8d931aa8511aa93b8504e940d2f5ddfee7b4c (patch) | |
tree | 1c2cd88c4d895757f08b73708bf49b182cc0a715 /db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb | |
parent | fbe6bd7c6aae0beb81fa47d5834393ed92662885 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb')
-rw-r--r-- | db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb b/db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb new file mode 100644 index 00000000000..6350ad935ca --- /dev/null +++ b/db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexPackagesNpmMetadataCachesOnIdAndProjectIdAndStatus < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'idx_pkgs_npm_metadata_caches_on_id_and_project_id_and_status' + NPM_METADATA_CACHES_STATUS_DEFAULT = 0 + + def up + where = "project_id IS NULL AND status = #{NPM_METADATA_CACHES_STATUS_DEFAULT}" + + add_concurrent_index :packages_npm_metadata_caches, :id, name: INDEX_NAME, where: where + end + + def down + remove_concurrent_index_by_name :packages_npm_metadata_caches, name: INDEX_NAME + end +end |