diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 00:07:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 00:07:37 +0300 |
commit | 1f6abbe6fa099f6d3d7629cfee85049020b54b33 (patch) | |
tree | d294f2d89c0edc61b3d23d196851757ce2842220 /db | |
parent | 6b5d8b17e28741bccf31029633cc5af7ceab1486 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
9 files changed, 87 insertions, 0 deletions
diff --git a/db/migrate/20220516092207_add_globally_allowed_ips_to_application_setting.rb b/db/migrate/20220516092207_add_globally_allowed_ips_to_application_setting.rb new file mode 100644 index 00000000000..895400aedc4 --- /dev/null +++ b/db/migrate/20220516092207_add_globally_allowed_ips_to_application_setting.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +class AddGloballyAllowedIpsToApplicationSetting < Gitlab::Database::Migration[2.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings + def change + add_column :application_settings, :globally_allowed_ips, :text, null: false, default: "" + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings.rb b/db/migrate/20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings.rb new file mode 100644 index 00000000000..887a7da0a74 --- /dev/null +++ b/db/migrate/20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToGloballyAllowedIpsOnApplicationSettings < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :globally_allowed_ips, 255 + end + + def down + remove_text_limit :application_settings, :globally_allowed_ips + end +end diff --git a/db/post_migrate/20220506123922_add_not_null_constraint_without_validation_to_requirements_issue_id.rb b/db/post_migrate/20220506123922_add_not_null_constraint_without_validation_to_requirements_issue_id.rb new file mode 100644 index 00000000000..1484a96d27b --- /dev/null +++ b/db/post_migrate/20220506123922_add_not_null_constraint_without_validation_to_requirements_issue_id.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddNotNullConstraintWithoutValidationToRequirementsIssueId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + CONSTRAINT_NAME = 'check_requirement_issue_not_null' + + def up + add_not_null_constraint( + :requirements, + :issue_id, + constraint_name: CONSTRAINT_NAME, + validate: false + ) + end + + def down + remove_not_null_constraint :requirements, :issue_id, constraint_name: CONSTRAINT_NAME + end +end diff --git a/db/post_migrate/20220506124021_schedule_populate_requirements_issue_id.rb b/db/post_migrate/20220506124021_schedule_populate_requirements_issue_id.rb new file mode 100644 index 00000000000..8f22324bf8d --- /dev/null +++ b/db/post_migrate/20220506124021_schedule_populate_requirements_issue_id.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class SchedulePopulateRequirementsIssueId < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + # 2022-05-06 There are no requirements with nil issue_id on .com + # this migration is supposed to fix records that could have nil issue_id + # on self managed instances. + BATCH_SIZE = 100 + + MIGRATION = 'MigrateRequirementsToWorkItems' + + disable_ddl_transaction! + + class Requirement < MigrationRecord + include EachBatch + + self.table_name = 'requirements' + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + Requirement.where(issue_id: nil), + MIGRATION, + 2.minutes, + batch_size: BATCH_SIZE, + track_jobs: true + ) + end + + def down + # NO OP + end +end diff --git a/db/schema_migrations/20220506123922 b/db/schema_migrations/20220506123922 new file mode 100644 index 00000000000..b905016fab3 --- /dev/null +++ b/db/schema_migrations/20220506123922 @@ -0,0 +1 @@ +df23d0cae2b318de6f1426f21cf895ba6118f3e5397ac28ad6c95c709648614c
\ No newline at end of file diff --git a/db/schema_migrations/20220506124021 b/db/schema_migrations/20220506124021 new file mode 100644 index 00000000000..b435705c554 --- /dev/null +++ b/db/schema_migrations/20220506124021 @@ -0,0 +1 @@ +07b19935546757b89800ef681eefd8de915caaa709bed038347a262e1da49553
\ No newline at end of file diff --git a/db/schema_migrations/20220516092207 b/db/schema_migrations/20220516092207 new file mode 100644 index 00000000000..8731d03e39e --- /dev/null +++ b/db/schema_migrations/20220516092207 @@ -0,0 +1 @@ +c55f8c6e45e933207eae2036cd2705530bce5c79ff54ac3e33cef111949c736d
\ No newline at end of file diff --git a/db/schema_migrations/20220516123101 b/db/schema_migrations/20220516123101 new file mode 100644 index 00000000000..ea64cc0ea46 --- /dev/null +++ b/db/schema_migrations/20220516123101 @@ -0,0 +1 @@ +e1421ae1b1f021c5aa1546b7ffdbab4fb26e6fbbe0d1d0d4f57cb39735bc0221
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 396cf191475..fa0f6a40688 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11305,6 +11305,7 @@ CREATE TABLE application_settings ( container_registry_pre_import_timeout integer DEFAULT 1800 NOT NULL, container_registry_import_timeout integer DEFAULT 600 NOT NULL, pipeline_limit_per_project_user_sha integer DEFAULT 0 NOT NULL, + globally_allowed_ips text DEFAULT ''::text NOT NULL, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)), @@ -11326,6 +11327,7 @@ CREATE TABLE application_settings ( CONSTRAINT check_5bcba483c4 CHECK ((char_length(sentry_environment) <= 255)), CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)), CONSTRAINT check_7227fad848 CHECK ((char_length(rate_limiting_response_text) <= 255)), + CONSTRAINT check_734cc9407a CHECK ((char_length(globally_allowed_ips) <= 255)), CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)), CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), CONSTRAINT check_8dca35398a CHECK ((char_length(public_runner_releases_url) <= 255)), @@ -24126,6 +24128,9 @@ ALTER TABLE sprints ALTER TABLE projects ADD CONSTRAINT check_fa75869cb1 CHECK ((project_namespace_id IS NOT NULL)) NOT VALID; +ALTER TABLE requirements + ADD CONSTRAINT check_requirement_issue_not_null CHECK ((issue_id IS NOT NULL)) NOT VALID; + ALTER TABLE ONLY ci_build_needs ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id); |