diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-23 09:07:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-23 09:07:38 +0300 |
commit | adb8dbff4284689e6902ff455ef74cf84fb79404 (patch) | |
tree | d2b9a189a6a0b364c873b36c6a81c651095f087a /db | |
parent | 571bbefbd4e15c5462a35a1f041a6caa8d236c08 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20230516080816_replace_vsd_index_with_nulls_first_order.rb | 25 | ||||
-rw-r--r-- | db/schema_migrations/20230516080816 | 1 | ||||
-rw-r--r-- | db/structure.sql | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/db/migrate/20230516080816_replace_vsd_index_with_nulls_first_order.rb b/db/migrate/20230516080816_replace_vsd_index_with_nulls_first_order.rb new file mode 100644 index 00000000000..dcc8bd5972e --- /dev/null +++ b/db/migrate/20230516080816_replace_vsd_index_with_nulls_first_order.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class ReplaceVsdIndexWithNullsFirstOrder < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + OLD_INDEX = 'index_on_value_stream_dashboard_aggregations_last_run_at_id' + NEW_INDEX = 'index_on_value_stream_dashboard_aggregations_last_run_at_and_id' + + def up + add_concurrent_index :value_stream_dashboard_aggregations, + [:last_run_at, :namespace_id], + where: 'enabled IS TRUE', + name: NEW_INDEX, + order: { last_run_at: 'ASC NULLS FIRST' } + remove_concurrent_index_by_name :value_stream_dashboard_aggregations, OLD_INDEX + end + + def down + add_concurrent_index :value_stream_dashboard_aggregations, + [:last_run_at, :namespace_id], + where: 'enabled IS TRUE', + name: OLD_INDEX + remove_concurrent_index_by_name :value_stream_dashboard_aggregations, NEW_INDEX + end +end diff --git a/db/schema_migrations/20230516080816 b/db/schema_migrations/20230516080816 new file mode 100644 index 00000000000..720e9275ea2 --- /dev/null +++ b/db/schema_migrations/20230516080816 @@ -0,0 +1 @@ +d45ccbc7191760bf61396cf3b50110352149958dfe3696d5e4a172f9e96e204a
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 5767bebb6c6..c117d095de4 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -31679,7 +31679,7 @@ CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username CREATE INDEX index_on_users_name_lower ON users USING btree (lower((name)::text)); -CREATE INDEX index_on_value_stream_dashboard_aggregations_last_run_at_id ON value_stream_dashboard_aggregations USING btree (last_run_at, namespace_id) WHERE (enabled IS TRUE); +CREATE INDEX index_on_value_stream_dashboard_aggregations_last_run_at_and_id ON value_stream_dashboard_aggregations USING btree (last_run_at NULLS FIRST, namespace_id) WHERE (enabled IS TRUE); CREATE INDEX index_onboarding_progresses_for_create_track ON onboarding_progresses USING btree (created_at) WHERE (git_write_at IS NULL); |