diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-14 03:17:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-14 03:17:46 +0300 |
commit | 270353e1ff556a43333f82f171c3a485958126f0 (patch) | |
tree | c7bb4ac335b1e101b9bf92905ec2e8e170c6696c /db | |
parent | b2e3da6a38f143a8c782dae4baceae3ed764733d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
9 files changed, 60 insertions, 1 deletions
diff --git a/db/migrate/20230406040908_add_system_note_metadata_id__to_resource_link_events.rb b/db/migrate/20230406040908_add_system_note_metadata_id__to_resource_link_events.rb new file mode 100644 index 00000000000..042e588a5f5 --- /dev/null +++ b/db/migrate/20230406040908_add_system_note_metadata_id__to_resource_link_events.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddSystemNoteMetadataIdToResourceLinkEvents < Gitlab::Database::Migration[2.1] + def change + add_column :resource_link_events, :system_note_metadata_id, :bigint + end +end diff --git a/db/migrate/20230406042906_add_unique_index_to_resource_link_events_on_system_note_metadata_id.rb b/db/migrate/20230406042906_add_unique_index_to_resource_link_events_on_system_note_metadata_id.rb new file mode 100644 index 00000000000..97d2e89c80b --- /dev/null +++ b/db/migrate/20230406042906_add_unique_index_to_resource_link_events_on_system_note_metadata_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddUniqueIndexToResourceLinkEventsOnSystemNoteMetadataId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'unique_index_on_system_note_metadata_id' + + def up + add_concurrent_index :resource_link_events, :system_note_metadata_id, unique: true, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :resource_link_events, name: INDEX_NAME + end +end diff --git a/db/migrate/20230406043900_add_system_note_metadata_foreign_key_to_resource_link_events.rb b/db/migrate/20230406043900_add_system_note_metadata_foreign_key_to_resource_link_events.rb new file mode 100644 index 00000000000..431e7ac0e7e --- /dev/null +++ b/db/migrate/20230406043900_add_system_note_metadata_foreign_key_to_resource_link_events.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddSystemNoteMetadataForeignKeyToResourceLinkEvents < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :resource_link_events, :system_note_metadata, + column: :system_note_metadata_id, on_delete: :cascade, validate: false + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :resource_link_events, column: :system_note_metadata_id + end + end +end diff --git a/db/migrate/20230406073847_validate_foreign_key_for_resource_link_events_on_system_note_metadata_id.rb b/db/migrate/20230406073847_validate_foreign_key_for_resource_link_events_on_system_note_metadata_id.rb new file mode 100644 index 00000000000..f06657ccabc --- /dev/null +++ b/db/migrate/20230406073847_validate_foreign_key_for_resource_link_events_on_system_note_metadata_id.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class ValidateForeignKeyForResourceLinkEventsOnSystemNoteMetadataId < Gitlab::Database::Migration[2.1] + def up + validate_foreign_key :resource_link_events, :system_note_metadata_id + end + + def down + # No-op + end +end diff --git a/db/schema_migrations/20230406040908 b/db/schema_migrations/20230406040908 new file mode 100644 index 00000000000..e5ca15fe7e6 --- /dev/null +++ b/db/schema_migrations/20230406040908 @@ -0,0 +1 @@ +33c9561c8f21f756095ff7396b78bf78bd7f41e18e508c89b759d367d5e920ba
\ No newline at end of file diff --git a/db/schema_migrations/20230406042906 b/db/schema_migrations/20230406042906 new file mode 100644 index 00000000000..a32d144741b --- /dev/null +++ b/db/schema_migrations/20230406042906 @@ -0,0 +1 @@ +b6608c1bd719c6fcfe701b11737ebfa7a8db8da795a0037d08bb7adc0c9b40e2
\ No newline at end of file diff --git a/db/schema_migrations/20230406043900 b/db/schema_migrations/20230406043900 new file mode 100644 index 00000000000..e41be929522 --- /dev/null +++ b/db/schema_migrations/20230406043900 @@ -0,0 +1 @@ +83c9ff25c312bd1c11e9be4fc8da12f89ec72174a0b303513899ee2fcd18e4d3
\ No newline at end of file diff --git a/db/schema_migrations/20230406073847 b/db/schema_migrations/20230406073847 new file mode 100644 index 00000000000..8c854a9350c --- /dev/null +++ b/db/schema_migrations/20230406073847 @@ -0,0 +1 @@ +58b22a8ed1ea4f21b8a3b42ffdf4853c111d8c462ffbd97d5f7080e2c0587473
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index d0bf9a5e91a..c274a315449 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -21751,7 +21751,8 @@ CREATE TABLE resource_link_events ( user_id bigint NOT NULL, issue_id bigint NOT NULL, child_work_item_id bigint NOT NULL, - created_at timestamp with time zone NOT NULL + created_at timestamp with time zone NOT NULL, + system_note_metadata_id bigint ); CREATE SEQUENCE resource_link_events_id_seq @@ -32869,6 +32870,8 @@ CREATE UNIQUE INDEX unique_index_ci_build_pending_states_on_partition_id_build_i CREATE UNIQUE INDEX unique_index_for_project_pages_unique_domain ON project_settings USING btree (pages_unique_domain) WHERE (pages_unique_domain IS NOT NULL); +CREATE UNIQUE INDEX unique_index_on_system_note_metadata_id ON resource_link_events USING btree (system_note_metadata_id); + CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); CREATE UNIQUE INDEX unique_packages_project_id_and_name_and_version_when_debian ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 9) AND (status <> 4)); @@ -34441,6 +34444,9 @@ ALTER TABLE ONLY merge_requests_compliance_violations ALTER TABLE ONLY coverage_fuzzing_corpuses ADD CONSTRAINT fk_29f6f15f82 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY resource_link_events + ADD CONSTRAINT fk_2a039c40f4 FOREIGN KEY (system_note_metadata_id) REFERENCES system_note_metadata(id) ON DELETE CASCADE; + ALTER TABLE ONLY ml_candidates ADD CONSTRAINT fk_2a0421d824 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; |