diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-04 15:15:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-04 15:15:02 +0300 |
commit | f00510286b6ccda154c4926503397590a8851939 (patch) | |
tree | c4cd69ef2d0d6dd5abf30e3963ac00ead7421a19 /db | |
parent | 9e5c2e7342d1393f90e74a2ae4b3f27492c22e1f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
16 files changed, 181 insertions, 12 deletions
diff --git a/db/migrate/20230323140745_add_root_directory_to_pages_deployment.rb b/db/migrate/20230323140745_add_root_directory_to_pages_deployment.rb new file mode 100644 index 00000000000..781ba3e89d4 --- /dev/null +++ b/db/migrate/20230323140745_add_root_directory_to_pages_deployment.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddRootDirectoryToPagesDeployment < Gitlab::Database::Migration[2.1] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20230323140746_add_text_limit_to_pages_deployment_root_directory + def change + add_column :pages_deployments, :root_directory, :text, default: "public" + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20230323140746_add_text_limit_to_pages_deployment_root_directory.rb b/db/migrate/20230323140746_add_text_limit_to_pages_deployment_root_directory.rb new file mode 100644 index 00000000000..12209422fbb --- /dev/null +++ b/db/migrate/20230323140746_add_text_limit_to_pages_deployment_root_directory.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToPagesDeploymentRootDirectory < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_text_limit :pages_deployments, :root_directory, 255 + end + + def down + remove_text_limit :pages_deployments, :root_directory + end +end diff --git a/db/migrate/20230403113620_add_pinned_nav_items_to_user_preference.rb b/db/migrate/20230403113620_add_pinned_nav_items_to_user_preference.rb new file mode 100644 index 00000000000..8f7509db318 --- /dev/null +++ b/db/migrate/20230403113620_add_pinned_nav_items_to_user_preference.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPinnedNavItemsToUserPreference < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :user_preferences, :pinned_nav_items, :jsonb, null: false, default: {} + end +end diff --git a/db/post_migrate/20230330080731_remove_tmp_index_vuln_occurrences_on_report_type.rb b/db/post_migrate/20230330080731_remove_tmp_index_vuln_occurrences_on_report_type.rb index ebfda8104ce..27e5b370efc 100644 --- a/db/post_migrate/20230330080731_remove_tmp_index_vuln_occurrences_on_report_type.rb +++ b/db/post_migrate/20230330080731_remove_tmp_index_vuln_occurrences_on_report_type.rb @@ -1,21 +1,13 @@ # frozen_string_literal: true class RemoveTmpIndexVulnOccurrencesOnReportType < Gitlab::Database::Migration[2.1] - INDEX_NAME = 'tmp_idx_vulnerability_occurrences_on_id_where_report_type_7_99' - REPORT_TYPES = { - cluster_image_scanning: 7, - custom: 99 - } - - disable_ddl_transaction! - def up - remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME + # no-op + # This migration was reverted as it removed a temporary index necessary for a background migration. + # The migration file is re-added to ensure that all environments have the same list of migrations. end def down - add_concurrent_index :vulnerability_occurrences, :id, - where: "report_type IN (#{REPORT_TYPES.values.join(', ')})", - name: INDEX_NAME + # no-op end end diff --git a/db/post_migrate/20230403041642_ensure_issue_user_mentions_bigint_backfill_is_finished_for_gitlab_dot_com.rb b/db/post_migrate/20230403041642_ensure_issue_user_mentions_bigint_backfill_is_finished_for_gitlab_dot_com.rb new file mode 100644 index 00000000000..b6f121994b2 --- /dev/null +++ b/db/post_migrate/20230403041642_ensure_issue_user_mentions_bigint_backfill_is_finished_for_gitlab_dot_com.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class EnsureIssueUserMentionsBigintBackfillIsFinishedForGitlabDotCom < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + return unless should_run? + + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'issue_user_mentions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end + + private + + def should_run? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230403231455_add_unique_index_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb b/db/post_migrate/20230403231455_add_unique_index_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb new file mode 100644 index 00000000000..d02a21f472e --- /dev/null +++ b/db/post_migrate/20230403231455_add_unique_index_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class AddUniqueIndexIssueUserMentionsNoteIdConvertToBigintForGitlabCom < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = :issue_user_mentions + INDEX_NAME = :index_issue_user_mentions_on_note_id_convert_to_bigint + + def up + return unless should_run? + + # This will replace the existing index_issue_user_mentions_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, unique: true, + name: INDEX_NAME, + where: 'note_id_convert_to_bigint IS NOT NULL' + end + + def down + return unless should_run? + + remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) + end + + private + + def should_run? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230403231841_add_fk_on_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb b/db/post_migrate/20230403231841_add_fk_on_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb new file mode 100644 index 00000000000..e2b5c6fcbe3 --- /dev/null +++ b/db/post_migrate/20230403231841_add_fk_on_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +class AddFkOnIssueUserMentionsNoteIdConvertToBigintForGitlabCom < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + SOURCE_TABLE_NAME = :issue_user_mentions + TARGET_TABLE_NAME = :notes + FK_NAME = :fk_issue_user_mentions_note_id_convert_to_bigint + + def up + return unless should_run? + + # This will replace the existing fk_rails_3861d9fefa + # when we swap the integer and bigint columns + add_concurrent_foreign_key SOURCE_TABLE_NAME, TARGET_TABLE_NAME, + column: :note_id_convert_to_bigint, + name: FK_NAME, + on_delete: :cascade, + reverse_lock_order: true, + validate: false + end + + def down + return unless should_run? + + with_lock_retries do + remove_foreign_key_if_exists( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + name: FK_NAME, + reverse_lock_order: true + ) + end + end + + private + + def should_run? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230403232121_async_validate_fk_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb b/db/post_migrate/20230403232121_async_validate_fk_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb new file mode 100644 index 00000000000..dd01689213c --- /dev/null +++ b/db/post_migrate/20230403232121_async_validate_fk_issue_user_mentions_note_id_convert_to_bigint_for_gitlab_com.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AsyncValidateFkIssueUserMentionsNoteIdConvertToBigintForGitlabCom < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + TABLE_NAME = :issue_user_mentions + COLUMN = :note_id_convert_to_bigint + FK_NAME = :fk_issue_user_mentions_note_id_convert_to_bigint + + def up + return unless should_run? + + prepare_async_foreign_key_validation TABLE_NAME, COLUMN, name: FK_NAME + end + + def down + return unless should_run? + + unprepare_async_foreign_key_validation TABLE_NAME, COLUMN, name: FK_NAME + end + + private + + def should_run? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/schema_migrations/20230323140745 b/db/schema_migrations/20230323140745 new file mode 100644 index 00000000000..ba80e2d22c4 --- /dev/null +++ b/db/schema_migrations/20230323140745 @@ -0,0 +1 @@ +14e93b01f5d959b995aca2b27de0bf2926eacbc5fe3ca010a038101100a99551
\ No newline at end of file diff --git a/db/schema_migrations/20230323140746 b/db/schema_migrations/20230323140746 new file mode 100644 index 00000000000..dead7210281 --- /dev/null +++ b/db/schema_migrations/20230323140746 @@ -0,0 +1 @@ +e8348ca24375ba452cf96abf6a48a9aa06197d4298043e9514e4becd30dfb2a1
\ No newline at end of file diff --git a/db/schema_migrations/20230403041642 b/db/schema_migrations/20230403041642 new file mode 100644 index 00000000000..2e066ad05d8 --- /dev/null +++ b/db/schema_migrations/20230403041642 @@ -0,0 +1 @@ +695a7fb24cc41bf991f54df7250b7c72c4e22c6eefc6327b58bb658dcc072740
\ No newline at end of file diff --git a/db/schema_migrations/20230403113620 b/db/schema_migrations/20230403113620 new file mode 100644 index 00000000000..bbecdc62886 --- /dev/null +++ b/db/schema_migrations/20230403113620 @@ -0,0 +1 @@ +52b7d165f3fcbfd16af2c2054693af4ce7d97ca51ac1c8900d357bec4401cd14
\ No newline at end of file diff --git a/db/schema_migrations/20230403231455 b/db/schema_migrations/20230403231455 new file mode 100644 index 00000000000..5d9c1f5a620 --- /dev/null +++ b/db/schema_migrations/20230403231455 @@ -0,0 +1 @@ +39167c767e9cbf437f7c58ee42dbc1524a3963b7eb5a9c8421f6c218611d1291
\ No newline at end of file diff --git a/db/schema_migrations/20230403231841 b/db/schema_migrations/20230403231841 new file mode 100644 index 00000000000..f02d68ba424 --- /dev/null +++ b/db/schema_migrations/20230403231841 @@ -0,0 +1 @@ +86bcc78ab4b5681cd31f6ca1ae43cb3c3ec5d17392a1eaceee9520cfa684d36d
\ No newline at end of file diff --git a/db/schema_migrations/20230403232121 b/db/schema_migrations/20230403232121 new file mode 100644 index 00000000000..519a8dc0bb2 --- /dev/null +++ b/db/schema_migrations/20230403232121 @@ -0,0 +1 @@ +59297e1b83298ee3d02a70384355cd572229e5b5ab20ebea6dd9ffff0b9e243b
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 99e2d492c89..8b02dc32711 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -19831,7 +19831,9 @@ CREATE TABLE pages_deployments ( file_count integer NOT NULL, file_sha256 bytea NOT NULL, size bigint, + root_directory text DEFAULT 'public'::text, CONSTRAINT check_5f9132a958 CHECK ((size IS NOT NULL)), + CONSTRAINT check_7e938c810a CHECK ((char_length(root_directory) <= 255)), CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255)) ); @@ -23347,6 +23349,7 @@ CREATE TABLE user_preferences ( use_legacy_web_ide boolean DEFAULT false NOT NULL, use_new_navigation boolean, achievements_enabled boolean DEFAULT true NOT NULL, + pinned_nav_items jsonb DEFAULT '{}'::jsonb NOT NULL, CONSTRAINT check_89bf269f41 CHECK ((char_length(diffs_deletion_color) <= 7)), CONSTRAINT check_d07ccd35f7 CHECK ((char_length(diffs_addition_color) <= 7)) ); @@ -30764,6 +30767,8 @@ CREATE INDEX index_issue_tracker_data_on_integration_id ON issue_tracker_data US CREATE UNIQUE INDEX index_issue_user_mentions_on_note_id ON issue_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); +CREATE UNIQUE INDEX index_issue_user_mentions_on_note_id_convert_to_bigint ON issue_user_mentions USING btree (note_id_convert_to_bigint) WHERE (note_id_convert_to_bigint IS NOT NULL); + CREATE INDEX index_issues_on_author_id ON issues USING btree (author_id); CREATE INDEX index_issues_on_author_id_and_id_and_created_at ON issues USING btree (author_id, id, created_at); @@ -35223,6 +35228,9 @@ ALTER TABLE ONLY issues ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_geo_event_log_on_geo_event_id FOREIGN KEY (geo_event_id) REFERENCES geo_events(id) ON DELETE CASCADE; +ALTER TABLE ONLY issue_user_mentions + ADD CONSTRAINT fk_issue_user_mentions_note_id_convert_to_bigint FOREIGN KEY (note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID; + ALTER TABLE ONLY note_diff_files ADD CONSTRAINT fk_note_diff_files_diff_note_id_convert_to_bigint FOREIGN KEY (diff_note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID; |