diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-01 03:09:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-01 03:09:44 +0300 |
commit | 83e25d14371953c18ac41b3a0cc27aadefd9bc69 (patch) | |
tree | 69d4b7cc955c7a7c414baf4e60d53ad6f5647732 /db | |
parent | 5376a0c41d6264e6cc820b5d12220ae4ff79f2ae (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb | 18 | ||||
-rw-r--r-- | db/schema_migrations/20230726072442 | 1 | ||||
-rw-r--r-- | db/structure.sql | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb b/db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb new file mode 100644 index 00000000000..71274f4e319 --- /dev/null +++ b/db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddNpmScopeAndProjectIndexToPackages < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'idx_packages_packages_on_npm_scope_and_project_id' + + def up + add_concurrent_index :packages_packages, + "split_part(name, '/', 1), project_id", + where: "package_type = 2 AND position('/' in name) > 0 AND status IN (0, 3) AND version IS NOT NULL", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_packages, INDEX_NAME + end +end diff --git a/db/schema_migrations/20230726072442 b/db/schema_migrations/20230726072442 new file mode 100644 index 00000000000..81d0080dfa7 --- /dev/null +++ b/db/schema_migrations/20230726072442 @@ -0,0 +1 @@ +8e3a03a08085c8cc882ce9e87846402ef49dc0a48e8f0c8980e8462337536674
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index fc86e4628a5..f1d181e0fd4 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -30130,6 +30130,8 @@ CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_helm ON CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_npm ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 2) AND (status <> 4)); +CREATE INDEX idx_packages_packages_on_npm_scope_and_project_id ON packages_packages USING btree (split_part((name)::text, '/'::text, 1), project_id) WHERE ((package_type = 2) AND ("position"((name)::text, '/'::text) > 0) AND (status = ANY (ARRAY[0, 3])) AND (version IS NOT NULL)); + CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); CREATE INDEX idx_personal_access_tokens_on_previous_personal_access_token_id ON personal_access_tokens USING btree (previous_personal_access_token_id); |