From 09237b02b51ab32cb23cde2b7eb66e47d4ef4702 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 1 Nov 2021 00:09:31 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- doc/development/adding_database_indexes.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'doc/development/adding_database_indexes.md') diff --git a/doc/development/adding_database_indexes.md b/doc/development/adding_database_indexes.md index 9ca08ab1dc2..571d2f353d4 100644 --- a/doc/development/adding_database_indexes.md +++ b/doc/development/adding_database_indexes.md @@ -312,3 +312,16 @@ def down remove_concurrent_index_by_name :ci_builds, INDEX_NAME end ``` + +## Test database index changes locally + +You must test the database index changes locally before creating a merge request. + +### Verify indexes created asynchronously + +Use the asynchronous index helpers on your local environment to test changes for creating an index: + +1. Enable the feature flags by running `Feature.enable(:database_async_index_creation)` and `Feature.enable(:database_reindexing)` in the Rails console. +1. Run `bundle exec rails db:migrate` so that it creates an entry in the `postgres_async_indexes` table. +1. Run `bundle exec rails gitlab:db:reindex` so that the index is created asynchronously. +1. To verify the index, open the PostgreSQL console using the [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md) command `gdk psql` and run the command `\d ` to check that your newly created index exists. -- cgit v1.2.1