diff --git a/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb b/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb new file mode 100644 index 0000000000000000000000000000000000000000..b066cb248fbfed5ed1a7c3eef3a56c5f3fc11ddd --- /dev/null +++ b/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class IndexProjectsOnNamespaceIdAndRepositorySizeLimit < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_projects_on_namespace_id_and_repository_size_limit" + + disable_ddl_transaction! + + def up + add_concurrent_index :projects, [:namespace_id, :repository_size_limit], name: INDEX_NAME + end + + def down + remove_concurrent_index :projects, [:namespace_id, :repository_size_limit], name: INDEX_NAME + end +end diff --git a/db/schema_migrations/20230724150939 b/db/schema_migrations/20230724150939 new file mode 100644 index 0000000000000000000000000000000000000000..c3190c22f278effeff17ac872b2ff1fd28a6954a --- /dev/null +++ b/db/schema_migrations/20230724150939 @@ -0,0 +1 @@ +4047c6746335957fc3d274036e20a176080fb7aa695a98667ed9170370960212 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index fc0b145ad3823f7c5d5c79d3681f531dddabb8a7..04079125d898748edefa82fdf82f3ff20430b732 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -32728,6 +32728,8 @@ CREATE INDEX index_projects_on_name_trigram ON projects USING gin (name gin_trgm CREATE INDEX index_projects_on_namespace_id_and_id ON projects USING btree (namespace_id, id); +CREATE INDEX index_projects_on_namespace_id_and_repository_size_limit ON projects USING btree (namespace_id, repository_size_limit); + CREATE INDEX index_projects_on_path_and_id ON projects USING btree (path, id); CREATE INDEX index_projects_on_path_trigram ON projects USING gin (path gin_trgm_ops);