diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-17 10:07:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-17 10:07:47 +0000 |
commit | d670c3006e6e44901bce0d53cc4768d1d80ffa92 (patch) | |
tree | 8f65743c232e5b76850c4cc264ba15e1185815ff /db | |
parent | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (diff) | |
download | gitlab-ce-d670c3006e6e44901bce0d53cc4768d1d80ffa92.tar.gz |
Add latest changes from gitlab-org/gitlab@14-0-stable-ee
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20210608103230_add_issue_id_to_test_report.rb | 17 | ||||
-rw-r--r-- | db/migrate/20210608103235_add_issue_index_to_test_report.rb | 17 | ||||
-rw-r--r-- | db/migrate/20210608110752_change_column_null_test_report_requirement.rb | 17 | ||||
-rw-r--r-- | db/migrate/20210608110760_add_requirement_test_reports_foreign_key.rb | 24 | ||||
-rw-r--r-- | db/migrate/20210614143954_add_unique_index_for_helm_packages.rb | 18 | ||||
-rw-r--r-- | db/schema_migrations/20210608103230 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20210608103235 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20210608110752 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20210608110760 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20210614143954 | 1 | ||||
-rw-r--r-- | db/structure.sql | 13 |
11 files changed, 109 insertions, 2 deletions
diff --git a/db/migrate/20210608103230_add_issue_id_to_test_report.rb b/db/migrate/20210608103230_add_issue_id_to_test_report.rb new file mode 100644 index 00000000000..f4e723d0af8 --- /dev/null +++ b/db/migrate/20210608103230_add_issue_id_to_test_report.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIssueIdToTestReport < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + def up + with_lock_retries do + add_column :requirements_management_test_reports, :issue_id, :bigint, null: true + end + end + + def down + with_lock_retries do + remove_column :requirements_management_test_reports, :issue_id + end + end +end diff --git a/db/migrate/20210608103235_add_issue_index_to_test_report.rb b/db/migrate/20210608103235_add_issue_index_to_test_report.rb new file mode 100644 index 00000000000..41f1970b2a9 --- /dev/null +++ b/db/migrate/20210608103235_add_issue_index_to_test_report.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIssueIndexToTestReport < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_requirements_management_test_reports_on_issue_id' + + def up + add_concurrent_index :requirements_management_test_reports, :issue_id, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :requirements_management_test_reports, INDEX_NAME + end +end diff --git a/db/migrate/20210608110752_change_column_null_test_report_requirement.rb b/db/migrate/20210608110752_change_column_null_test_report_requirement.rb new file mode 100644 index 00000000000..44a614a34ce --- /dev/null +++ b/db/migrate/20210608110752_change_column_null_test_report_requirement.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ChangeColumnNullTestReportRequirement < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + TARGET_TABLE = :requirements_management_test_reports + + def up + with_lock_retries do + change_column_null TARGET_TABLE, :requirement_id, true + end + end + + def down + # no-op as it's difficult to revert + end +end diff --git a/db/migrate/20210608110760_add_requirement_test_reports_foreign_key.rb b/db/migrate/20210608110760_add_requirement_test_reports_foreign_key.rb new file mode 100644 index 00000000000..e256bce6ae0 --- /dev/null +++ b/db/migrate/20210608110760_add_requirement_test_reports_foreign_key.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddRequirementTestReportsForeignKey < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + TARGET_TABLE = :requirements_management_test_reports + CONSTRAINT_NAME = 'requirements_test_reports_requirement_id_xor_issue_id' + + def up + add_concurrent_foreign_key TARGET_TABLE, :issues, column: :issue_id + + add_check_constraint(TARGET_TABLE, 'num_nonnulls(requirement_id, issue_id) = 1', CONSTRAINT_NAME) + end + + def down + remove_check_constraint TARGET_TABLE, CONSTRAINT_NAME + + with_lock_retries do + remove_foreign_key_if_exists(TARGET_TABLE, column: :issue_id) + end + end +end diff --git a/db/migrate/20210614143954_add_unique_index_for_helm_packages.rb b/db/migrate/20210614143954_add_unique_index_for_helm_packages.rb new file mode 100644 index 00000000000..e6b7ba7616d --- /dev/null +++ b/db/migrate/20210614143954_add_unique_index_for_helm_packages.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddUniqueIndexForHelmPackages < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_packages_on_project_id_name_version_unique_when_helm' + PACKAGE_TYPE_HELM = 11 + + disable_ddl_transaction! + + def up + add_concurrent_index :packages_packages, [:project_id, :name, :version], unique: true, where: "package_type = #{PACKAGE_TYPE_HELM}", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_packages, INDEX_NAME + end +end diff --git a/db/schema_migrations/20210608103230 b/db/schema_migrations/20210608103230 new file mode 100644 index 00000000000..541faa3aab7 --- /dev/null +++ b/db/schema_migrations/20210608103230 @@ -0,0 +1 @@ +12d8de65d287cf29fa2761264c42eb42e7fe2a5b36c279e623d93897503b5313
\ No newline at end of file diff --git a/db/schema_migrations/20210608103235 b/db/schema_migrations/20210608103235 new file mode 100644 index 00000000000..601c374e620 --- /dev/null +++ b/db/schema_migrations/20210608103235 @@ -0,0 +1 @@ +fc503b8e9672eb5638d2cb3468c8df4d9c0d998332909351121ace04d3f7214a
\ No newline at end of file diff --git a/db/schema_migrations/20210608110752 b/db/schema_migrations/20210608110752 new file mode 100644 index 00000000000..5c4a1f16971 --- /dev/null +++ b/db/schema_migrations/20210608110752 @@ -0,0 +1 @@ +cbe4cff5937f3ba39a4aeeed78dcc6dc6ece212b01b16bfcd61ccf4a20427dcc
\ No newline at end of file diff --git a/db/schema_migrations/20210608110760 b/db/schema_migrations/20210608110760 new file mode 100644 index 00000000000..46ace509e0d --- /dev/null +++ b/db/schema_migrations/20210608110760 @@ -0,0 +1 @@ +b84505713afce3bf0673329a3a4eaf85a00d4f8948f56d43d365d6cc47ef629c
\ No newline at end of file diff --git a/db/schema_migrations/20210614143954 b/db/schema_migrations/20210614143954 new file mode 100644 index 00000000000..7fd3ce9b49e --- /dev/null +++ b/db/schema_migrations/20210614143954 @@ -0,0 +1 @@ +b958d65f1b3b43d7bcd2a703489132ba9a2ba1e0374d45533399355ce6be9365
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index fcac180738c..6de556b602f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -17498,10 +17498,12 @@ ALTER SEQUENCE requirements_id_seq OWNED BY requirements.id; CREATE TABLE requirements_management_test_reports ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, - requirement_id bigint NOT NULL, + requirement_id bigint, author_id bigint, state smallint NOT NULL, - build_id bigint + build_id bigint, + issue_id bigint, + CONSTRAINT requirements_test_reports_requirement_id_xor_issue_id CHECK ((num_nonnulls(requirement_id, issue_id) = 1)) ); CREATE SEQUENCE requirements_management_test_reports_id_seq @@ -24115,6 +24117,8 @@ CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generi CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_golang ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 8); +CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_helm ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 11); + CREATE INDEX index_packages_package_file_build_infos_on_package_file_id ON packages_package_file_build_infos USING btree (package_file_id); CREATE INDEX index_packages_package_file_build_infos_on_pipeline_id ON packages_package_file_build_infos USING btree (pipeline_id); @@ -24489,6 +24493,8 @@ CREATE INDEX index_requirements_management_test_reports_on_author_id ON requirem CREATE INDEX index_requirements_management_test_reports_on_build_id ON requirements_management_test_reports USING btree (build_id); +CREATE INDEX index_requirements_management_test_reports_on_issue_id ON requirements_management_test_reports USING btree (issue_id); + CREATE INDEX index_requirements_management_test_reports_on_requirement_id ON requirements_management_test_reports USING btree (requirement_id); CREATE INDEX index_requirements_on_author_id ON requirements USING btree (author_id); @@ -25826,6 +25832,9 @@ ALTER TABLE ONLY vulnerabilities ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT fk_88c725229f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY requirements_management_test_reports + ADD CONSTRAINT fk_88f30752fc FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues ADD CONSTRAINT fk_899c8f3231 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; |