diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-15 18:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-15 18:08:59 +0300 |
commit | 51858218a3961c6d872703eabde0635bc0a1368f (patch) | |
tree | 4b62ba865821631fcc2e68025a5fade1b1e7b069 /db | |
parent | 6986c1adc235859111e45593bb0bd61e70892d3c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
13 files changed, 137 insertions, 2 deletions
diff --git a/db/migrate/20201221225303_add_service_desk_reply_to_is_not_null_index_on_issues.rb b/db/migrate/20201221225303_add_service_desk_reply_to_is_not_null_index_on_issues.rb new file mode 100644 index 00000000000..fb5429af458 --- /dev/null +++ b/db/migrate/20201221225303_add_service_desk_reply_to_is_not_null_index_on_issues.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddServiceDeskReplyToIsNotNullIndexOnIssues < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'idx_on_issues_where_service_desk_reply_to_is_not_null' + + disable_ddl_transaction! + + def up + add_concurrent_index(:issues, [:id], name: INDEX_NAME, where: 'service_desk_reply_to IS NOT NULL') + end + + def down + remove_concurrent_index_by_name(:issues, INDEX_NAME) + end +end diff --git a/db/migrate/20210121100038_add_devops_adoption_group_segment.rb b/db/migrate/20210121100038_add_devops_adoption_group_segment.rb new file mode 100644 index 00000000000..619657e7f56 --- /dev/null +++ b/db/migrate/20210121100038_add_devops_adoption_group_segment.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddDevopsAdoptionGroupSegment < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column :analytics_devops_adoption_segments, :namespace_id, :integer, if_not_exists: true + add_concurrent_index :analytics_devops_adoption_segments, :namespace_id, unique: true + end + + def down + remove_column :analytics_devops_adoption_segments, :namespace_id + end +end diff --git a/db/migrate/20210121121102_optional_devops_adoption_segment_name.rb b/db/migrate/20210121121102_optional_devops_adoption_segment_name.rb new file mode 100644 index 00000000000..d7fda093cfc --- /dev/null +++ b/db/migrate/20210121121102_optional_devops_adoption_segment_name.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class OptionalDevopsAdoptionSegmentName < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_analytics_devops_adoption_segments_on_name' + + def up + change_column_null :analytics_devops_adoption_segments, :name, true + remove_concurrent_index_by_name :analytics_devops_adoption_segments, INDEX_NAME + end + + def down + transaction do + execute "DELETE FROM analytics_devops_adoption_segments WHERE name IS NULL" + change_column_null :analytics_devops_adoption_segments, :name, false + end + add_concurrent_index :analytics_devops_adoption_segments, :name, unique: true, name: INDEX_NAME + end +end diff --git a/db/migrate/20210125105410_add_devops_adoption_segment_namespace_fk.rb b/db/migrate/20210125105410_add_devops_adoption_segment_namespace_fk.rb new file mode 100644 index 00000000000..c7c18ae69d0 --- /dev/null +++ b/db/migrate/20210125105410_add_devops_adoption_segment_namespace_fk.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddDevopsAdoptionSegmentNamespaceFk < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :analytics_devops_adoption_segments, :namespaces, column: :namespace_id + end + + def down + remove_foreign_key_if_exists :analytics_devops_adoption_segments, :namespaces, column: :namespace_id + end +end diff --git a/db/post_migrate/20201128210234_schedule_populate_issue_email_participants.rb b/db/post_migrate/20201128210234_schedule_populate_issue_email_participants.rb new file mode 100644 index 00000000000..6fea683944c --- /dev/null +++ b/db/post_migrate/20201128210234_schedule_populate_issue_email_participants.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class SchedulePopulateIssueEmailParticipants < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 1_000 + DELAY_INTERVAL = 2.minutes + MIGRATION = 'PopulateIssueEmailParticipants' + + disable_ddl_transaction! + + class Issue < ActiveRecord::Base + include EachBatch + + self.table_name = 'issues' + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + Issue.where.not(service_desk_reply_to: nil), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210203143131_migrate_existing_devops_segments_to_groups.rb b/db/post_migrate/20210203143131_migrate_existing_devops_segments_to_groups.rb new file mode 100644 index 00000000000..5267e0fd658 --- /dev/null +++ b/db/post_migrate/20210203143131_migrate_existing_devops_segments_to_groups.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# Data migration to migrate multi-selection segments into separate segments. +# Both tables involved are pretty-low traffic and the number +# of records in DB cannot exceed 400 +class MigrateExistingDevopsSegmentsToGroups < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + Gitlab::BackgroundMigration::MigrateDevopsSegmentsToGroups.new.perform + end + + def down + end +end diff --git a/db/schema_migrations/20201128210234 b/db/schema_migrations/20201128210234 new file mode 100644 index 00000000000..6c85130bf58 --- /dev/null +++ b/db/schema_migrations/20201128210234 @@ -0,0 +1 @@ +7c2f83a5821765f3657a6dd6f69bc8711a3b9388aec7335293748b883f7ab872
\ No newline at end of file diff --git a/db/schema_migrations/20201221225303 b/db/schema_migrations/20201221225303 new file mode 100644 index 00000000000..d1824217b99 --- /dev/null +++ b/db/schema_migrations/20201221225303 @@ -0,0 +1 @@ +06dcd1a1f4bc0598357d48d9a0e838d9af1cf078234f2aabaa53ff9df01d2c17
\ No newline at end of file diff --git a/db/schema_migrations/20210121100038 b/db/schema_migrations/20210121100038 new file mode 100644 index 00000000000..0f9379ff019 --- /dev/null +++ b/db/schema_migrations/20210121100038 @@ -0,0 +1 @@ +12a5eba74f0bb5b63cddd32d32009ad073e638a9defb40eeee5c16f559ebe951
\ No newline at end of file diff --git a/db/schema_migrations/20210121121102 b/db/schema_migrations/20210121121102 new file mode 100644 index 00000000000..6bce3892276 --- /dev/null +++ b/db/schema_migrations/20210121121102 @@ -0,0 +1 @@ +359231b3f18a2c1e56ffba4872a51d01fd4ca834ef722e1133a5a9f01e4271e9
\ No newline at end of file diff --git a/db/schema_migrations/20210125105410 b/db/schema_migrations/20210125105410 new file mode 100644 index 00000000000..d685894bd8a --- /dev/null +++ b/db/schema_migrations/20210125105410 @@ -0,0 +1 @@ +0c80fa1c88f67ef34bbfab52b1b75eadc4a6f07557986f0fbe4ffd83e20df52a
\ No newline at end of file diff --git a/db/schema_migrations/20210203143131 b/db/schema_migrations/20210203143131 new file mode 100644 index 00000000000..6b318f8c219 --- /dev/null +++ b/db/schema_migrations/20210203143131 @@ -0,0 +1 @@ +1f05176d9f6a88e9d740000084b7c9f5c72c61a59dbe1f68f43b3b5606ecd9d8
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index b00e2b47113..91efc451e20 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -8990,10 +8990,11 @@ ALTER SEQUENCE analytics_devops_adoption_segment_selections_id_seq OWNED BY anal CREATE TABLE analytics_devops_adoption_segments ( id bigint NOT NULL, - name text NOT NULL, + name text, last_recorded_at timestamp with time zone, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, + namespace_id integer, CONSTRAINT check_4be7a006fd CHECK ((char_length(name) <= 255)) ); @@ -21257,6 +21258,8 @@ CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_c CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name); +CREATE INDEX idx_on_issues_where_service_desk_reply_to_is_not_null ON issues USING btree (id) WHERE (service_desk_reply_to IS NOT NULL); + CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id); @@ -21363,7 +21366,7 @@ CREATE INDEX index_analytics_ca_project_stages_on_start_event_label_id ON analyt CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true); -CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_name ON analytics_devops_adoption_segments USING btree (name); +CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id); CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON application_settings USING btree (custom_project_templates_group_id); @@ -24702,6 +24705,9 @@ ALTER TABLE ONLY ci_pipeline_variables ALTER TABLE ONLY design_management_designs_versions ADD CONSTRAINT fk_f4d25ba00c FOREIGN KEY (version_id) REFERENCES design_management_versions(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_segments + ADD CONSTRAINT fk_f5aa768998 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY protected_tag_create_access_levels ADD CONSTRAINT fk_f7dfda8c51 FOREIGN KEY (protected_tag_id) REFERENCES protected_tags(id) ON DELETE CASCADE; |