diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-17 06:16:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-17 06:16:49 +0300 |
commit | f4e1a3641efa287c3e3414b450d698fc80226592 (patch) | |
tree | 05d6aa3f9495520d14c0a28af702abda1d847f33 /db | |
parent | eaec088dc5e9a164d2d163c63312ad1d6668e1d0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20220128081329_add_target_access_levels_to_broadcast_messages.rb | 7 | ||||
-rw-r--r-- | db/post_migrate/20220213104531_create_indexes_on_integration_type_new.rb | 60 | ||||
-rw-r--r-- | db/schema_migrations/20220128081329 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20220213104531 | 1 | ||||
-rw-r--r-- | db/structure.sql | 17 |
5 files changed, 85 insertions, 1 deletions
diff --git a/db/migrate/20220128081329_add_target_access_levels_to_broadcast_messages.rb b/db/migrate/20220128081329_add_target_access_levels_to_broadcast_messages.rb new file mode 100644 index 00000000000..5958895ede8 --- /dev/null +++ b/db/migrate/20220128081329_add_target_access_levels_to_broadcast_messages.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddTargetAccessLevelsToBroadcastMessages < Gitlab::Database::Migration[1.0] + def change + add_column :broadcast_messages, :target_access_levels, :integer, array: true, null: false, default: [] + end +end diff --git a/db/post_migrate/20220213104531_create_indexes_on_integration_type_new.rb b/db/post_migrate/20220213104531_create_indexes_on_integration_type_new.rb new file mode 100644 index 00000000000..3a9f48dec44 --- /dev/null +++ b/db/post_migrate/20220213104531_create_indexes_on_integration_type_new.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Reproduce the indices on integrations.type on integrations.type_new +class CreateIndexesOnIntegrationTypeNew < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + TABLE_NAME = :integrations + COLUMN = :type_new + + def indices + [ + { + name: "index_integrations_on_project_and_#{COLUMN}_where_inherit_null", + columns: [:project_id, COLUMN], + where: 'inherit_from_id IS NULL' + }, + { + name: "index_integrations_on_project_id_and_#{COLUMN}_unique", + columns: [:project_id, COLUMN], + unique: true + }, + { + name: "index_integrations_on_#{COLUMN}", + columns: [COLUMN] + }, + { + name: "index_integrations_on_#{COLUMN}_and_instance_partial", + columns: [COLUMN, :instance], + where: 'instance = true' + }, + { + name: "index_integrations_on_#{COLUMN}_and_template_partial", + columns: [COLUMN, :template], + where: 'template = true' + }, + { + # column names are limited to 63 characters, so this one is re-worded for clarity + name: "index_integrations_on_#{COLUMN}_id_when_active_and_has_project", + columns: [COLUMN, :id], + where: '((active = true) AND (project_id IS NOT NULL))' + }, + { + name: "index_integrations_on_unique_group_id_and_#{COLUMN}", + columns: [:group_id, COLUMN] + } + ] + end + + def up + indices.each do |index| + add_concurrent_index TABLE_NAME, index[:columns], index.except(:columns) + end + end + + def down + indices.each do |index| + remove_concurrent_index_by_name TABLE_NAME, index[:name] + end + end +end diff --git a/db/schema_migrations/20220128081329 b/db/schema_migrations/20220128081329 new file mode 100644 index 00000000000..765b4c3a519 --- /dev/null +++ b/db/schema_migrations/20220128081329 @@ -0,0 +1 @@ +6e273d5b92595ae6054b0665b4ff446fb2bed24ff1aab122537833dc8f4d9ab8
\ No newline at end of file diff --git a/db/schema_migrations/20220213104531 b/db/schema_migrations/20220213104531 new file mode 100644 index 00000000000..72656d85fb0 --- /dev/null +++ b/db/schema_migrations/20220213104531 @@ -0,0 +1 @@ +9ce8aa469b9469d25fbba52147e24c95f6242c2ab1e114df8baaf5a45268d2fd
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 407ff9bc389..04cd900b364 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11364,7 +11364,8 @@ CREATE TABLE broadcast_messages ( cached_markdown_version integer, target_path character varying(255), broadcast_type smallint DEFAULT 1 NOT NULL, - dismissable boolean + dismissable boolean, + target_access_levels integer[] DEFAULT '{}'::integer[] NOT NULL ); CREATE SEQUENCE broadcast_messages_id_seq @@ -26665,8 +26666,12 @@ CREATE INDEX index_insights_on_project_id ON insights USING btree (project_id); CREATE INDEX index_integrations_on_inherit_from_id ON integrations USING btree (inherit_from_id); +CREATE INDEX index_integrations_on_project_and_type_new_where_inherit_null ON integrations USING btree (project_id, type_new) WHERE (inherit_from_id IS NULL); + CREATE INDEX index_integrations_on_project_and_type_where_inherit_null ON integrations USING btree (project_id, type) WHERE (inherit_from_id IS NULL); +CREATE UNIQUE INDEX index_integrations_on_project_id_and_type_new_unique ON integrations USING btree (project_id, type_new); + CREATE UNIQUE INDEX index_integrations_on_project_id_and_type_unique ON integrations USING btree (project_id, type); CREATE INDEX index_integrations_on_template ON integrations USING btree (template); @@ -26679,8 +26684,18 @@ CREATE UNIQUE INDEX index_integrations_on_type_and_template_partial ON integrati CREATE INDEX index_integrations_on_type_id_when_active_and_project_id_not_nu ON integrations USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL)); +CREATE INDEX index_integrations_on_type_new ON integrations USING btree (type_new); + +CREATE INDEX index_integrations_on_type_new_and_instance_partial ON integrations USING btree (type_new, instance) WHERE (instance = true); + +CREATE INDEX index_integrations_on_type_new_and_template_partial ON integrations USING btree (type_new, template) WHERE (template = true); + +CREATE INDEX index_integrations_on_type_new_id_when_active_and_has_project ON integrations USING btree (type_new, id) WHERE ((active = true) AND (project_id IS NOT NULL)); + CREATE UNIQUE INDEX index_integrations_on_unique_group_id_and_type ON integrations USING btree (group_id, type); +CREATE INDEX index_integrations_on_unique_group_id_and_type_new ON integrations USING btree (group_id, type_new); + CREATE INDEX index_internal_ids_on_namespace_id ON internal_ids USING btree (namespace_id); CREATE INDEX index_internal_ids_on_project_id ON internal_ids USING btree (project_id); |