From f119af78abbd9cffda2103d778c3b2f555087e2f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 9 May 2023 03:18:46 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../migrate_human_user_type.yml | 6 ++ db/docs/clusters_applications_knative.yml | 8 -- .../clusters_applications_knative.yml | 10 +++ ...20230327103401_queue_migrate_human_user_type.rb | 25 ++++++ ...503152349_drop_clusters_applications_knative.rb | 29 +++++++ db/schema_migrations/20230327103401 | 1 + db/schema_migrations/20230503152349 | 1 + db/structure.sql | 92 +++++++--------------- 8 files changed, 101 insertions(+), 71 deletions(-) create mode 100644 db/docs/batched_background_migrations/migrate_human_user_type.yml delete mode 100644 db/docs/clusters_applications_knative.yml create mode 100644 db/docs/deleted_tables/clusters_applications_knative.yml create mode 100644 db/post_migrate/20230327103401_queue_migrate_human_user_type.rb create mode 100644 db/post_migrate/20230503152349_drop_clusters_applications_knative.rb create mode 100644 db/schema_migrations/20230327103401 create mode 100644 db/schema_migrations/20230503152349 (limited to 'db') diff --git a/db/docs/batched_background_migrations/migrate_human_user_type.yml b/db/docs/batched_background_migrations/migrate_human_user_type.yml new file mode 100644 index 00000000000..869a4fe7351 --- /dev/null +++ b/db/docs/batched_background_migrations/migrate_human_user_type.yml @@ -0,0 +1,6 @@ +--- +migration_job_name: MigrateHumanUserType +description: Migrates human user type from old value (nil) to new value (0) for better indexing +feature_category: user_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/115849 +milestone: 16.0 diff --git a/db/docs/clusters_applications_knative.yml b/db/docs/clusters_applications_knative.yml deleted file mode 100644 index 5cad3c342b0..00000000000 --- a/db/docs/clusters_applications_knative.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -table_name: clusters_applications_knative -feature_categories: -- deployment_management -description: "(Deprecated) A GitLab managed Knative installation in a Kubernetes cluster" -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/b5155b90ee233e2824c168fbb06b3ce5d3aeb194 -milestone: '11.5' -gitlab_schema: gitlab_main diff --git a/db/docs/deleted_tables/clusters_applications_knative.yml b/db/docs/deleted_tables/clusters_applications_knative.yml new file mode 100644 index 00000000000..666f126f022 --- /dev/null +++ b/db/docs/deleted_tables/clusters_applications_knative.yml @@ -0,0 +1,10 @@ +--- +table_name: clusters_applications_knative +feature_categories: +- deployment_management +description: "(Deprecated) A GitLab managed Knative installation in a Kubernetes cluster" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/b5155b90ee233e2824c168fbb06b3ce5d3aeb194 +milestone: '11.5' +gitlab_schema: gitlab_main +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119515 +removed_in_milestone: '16.0' diff --git a/db/post_migrate/20230327103401_queue_migrate_human_user_type.rb b/db/post_migrate/20230327103401_queue_migrate_human_user_type.rb new file mode 100644 index 00000000000..d686c70cb5a --- /dev/null +++ b/db/post_migrate/20230327103401_queue_migrate_human_user_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class QueueMigrateHumanUserType < Gitlab::Database::Migration[2.1] + MIGRATION = "MigrateHumanUserType" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 2000 + SUB_BATCH_SIZE = 10 + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :users, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :users, :id, []) + end +end diff --git a/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb b/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb new file mode 100644 index 00000000000..c94b9bba64b --- /dev/null +++ b/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class DropClustersApplicationsKnative < Gitlab::Database::Migration[2.1] + def up + drop_table :clusters_applications_knative + end + + # Based on init migration: + # https://gitlab.com/gitlab-org/gitlab/-/blob/b237f836df215a4ada92b9406733e6cd2483ca2d/db/migrate/20181228175414_init_schema.rb#L730-L740 + # rubocop:disable Migration/SchemaAdditionMethodsNoPost + def down + create_table "clusters_applications_knative", id: :serial, force: :cascade do |t| + t.integer "cluster_id", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.integer "status", null: false + t.string "version", null: false + t.string "hostname" + t.text "status_reason" + t.string "external_hostname" + t.string "external_ip" + t.index ["cluster_id"], name: "index_clusters_applications_knative_on_cluster_id", unique: true + end + end + # rubocop:enable Migration/SchemaAdditionMethodsNoPost +end diff --git a/db/schema_migrations/20230327103401 b/db/schema_migrations/20230327103401 new file mode 100644 index 00000000000..4dc9095594a --- /dev/null +++ b/db/schema_migrations/20230327103401 @@ -0,0 +1 @@ +c5c1627079f081d241031e0ffb205b3088e83e97514e692d3093ab012d727365 \ No newline at end of file diff --git a/db/schema_migrations/20230503152349 b/db/schema_migrations/20230503152349 new file mode 100644 index 00000000000..b53f7e1da28 --- /dev/null +++ b/db/schema_migrations/20230503152349 @@ -0,0 +1 @@ +1cda8d54c964870fd0660dc864e39ef31c0a91994a275b7478d615141670b693 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 6aa2bd22823..1d7b24ebef3 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11279,8 +11279,8 @@ CREATE TABLE appearances ( email_header_and_footer_enabled boolean DEFAULT false NOT NULL, profile_image_guidelines text, profile_image_guidelines_html text, - pwa_icon text, pwa_short_name text, + pwa_icon text, pwa_name text, pwa_description text, CONSTRAINT appearances_profile_image_guidelines CHECK ((char_length(profile_image_guidelines) <= 4096)), @@ -11694,6 +11694,10 @@ CREATE TABLE application_settings ( database_grafana_api_url text, database_grafana_tag text, public_runner_releases_url text DEFAULT 'https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases'::text NOT NULL, + password_uppercase_required boolean DEFAULT false NOT NULL, + password_lowercase_required boolean DEFAULT false NOT NULL, + password_number_required boolean DEFAULT false NOT NULL, + password_symbol_required boolean DEFAULT false NOT NULL, encrypted_arkose_labs_public_api_key bytea, encrypted_arkose_labs_public_api_key_iv bytea, encrypted_arkose_labs_private_api_key bytea, @@ -11704,14 +11708,14 @@ CREATE TABLE application_settings ( inactive_projects_min_size_mb integer DEFAULT 0 NOT NULL, inactive_projects_send_warning_email_after_months integer DEFAULT 1 NOT NULL, delayed_group_deletion boolean DEFAULT true NOT NULL, + maven_package_requests_forwarding boolean DEFAULT true NOT NULL, arkose_labs_namespace text DEFAULT 'client'::text NOT NULL, max_export_size integer DEFAULT 0, + encrypted_slack_app_signing_secret bytea, + encrypted_slack_app_signing_secret_iv bytea, 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, - encrypted_slack_app_signing_secret bytea, - encrypted_slack_app_signing_secret_iv bytea, - globally_allowed_ips text DEFAULT ''::text NOT NULL, dingtalk_integration_enabled boolean DEFAULT false NOT NULL, encrypted_dingtalk_corpid bytea, encrypted_dingtalk_corpid_iv bytea, @@ -11719,11 +11723,8 @@ CREATE TABLE application_settings ( encrypted_dingtalk_app_key_iv bytea, encrypted_dingtalk_app_secret bytea, encrypted_dingtalk_app_secret_iv bytea, - password_uppercase_required boolean DEFAULT false NOT NULL, - password_lowercase_required boolean DEFAULT false NOT NULL, - password_number_required boolean DEFAULT false NOT NULL, - password_symbol_required boolean DEFAULT false NOT NULL, jira_connect_application_key text, + globally_allowed_ips text DEFAULT ''::text NOT NULL, container_registry_pre_import_tags_rate numeric(6,2) DEFAULT 0.5 NOT NULL, license_usage_data_exported boolean DEFAULT false NOT NULL, phone_verification_code_enabled boolean DEFAULT false NOT NULL, @@ -11738,34 +11739,33 @@ CREATE TABLE application_settings ( error_tracking_api_url text, git_rate_limit_users_allowlist text[] DEFAULT '{}'::text[] NOT NULL, error_tracking_access_token_encrypted text, + invitation_flow_enforcement boolean DEFAULT false NOT NULL, package_registry_cleanup_policies_worker_capacity integer DEFAULT 2 NOT NULL, deactivate_dormant_users_period integer DEFAULT 90 NOT NULL, auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL, - invitation_flow_enforcement boolean DEFAULT false NOT NULL, max_pages_custom_domains_per_project integer DEFAULT 0 NOT NULL, cube_api_base_url text, encrypted_cube_api_key bytea, encrypted_cube_api_key_iv bytea, - maven_package_requests_forwarding boolean DEFAULT true NOT NULL, - dashboard_limit_enabled boolean DEFAULT false NOT NULL, - dashboard_limit integer DEFAULT 0 NOT NULL, - dashboard_notification_limit integer DEFAULT 0 NOT NULL, - dashboard_enforcement_limit integer DEFAULT 0 NOT NULL, - dashboard_limit_new_namespace_creation_enforcement_date date, jitsu_host text, jitsu_project_xid text, jitsu_administrator_email text, encrypted_jitsu_administrator_password bytea, encrypted_jitsu_administrator_password_iv bytea, + dashboard_limit_enabled boolean DEFAULT false NOT NULL, + dashboard_limit integer DEFAULT 0 NOT NULL, + dashboard_notification_limit integer DEFAULT 0 NOT NULL, + dashboard_enforcement_limit integer DEFAULT 0 NOT NULL, + dashboard_limit_new_namespace_creation_enforcement_date date, can_create_group boolean DEFAULT true NOT NULL, lock_maven_package_requests_forwarding boolean DEFAULT false NOT NULL, lock_pypi_package_requests_forwarding boolean DEFAULT false NOT NULL, lock_npm_package_requests_forwarding boolean DEFAULT false NOT NULL, + jira_connect_proxy_url text, password_expiration_enabled boolean DEFAULT false NOT NULL, password_expires_in_days integer DEFAULT 90 NOT NULL, password_expires_notice_before_days integer DEFAULT 7 NOT NULL, product_analytics_enabled boolean DEFAULT false NOT NULL, - jira_connect_proxy_url text, email_confirmation_setting smallint DEFAULT 0, disable_admin_oauth_scopes boolean DEFAULT false NOT NULL, default_preferred_language text DEFAULT 'en'::text NOT NULL, @@ -11774,37 +11774,37 @@ CREATE TABLE application_settings ( encrypted_telesign_customer_xid_iv bytea, encrypted_telesign_api_key bytea, encrypted_telesign_api_key_iv bytea, - max_terraform_state_size_bytes integer DEFAULT 0 NOT NULL, disable_personal_access_tokens boolean DEFAULT false NOT NULL, + max_terraform_state_size_bytes integer DEFAULT 0 NOT NULL, bulk_import_enabled boolean DEFAULT false NOT NULL, - user_defaults_to_private_profile boolean DEFAULT false NOT NULL, allow_runner_registration_token boolean DEFAULT true NOT NULL, + user_defaults_to_private_profile boolean DEFAULT false NOT NULL, + allow_possible_spam boolean DEFAULT false NOT NULL, + default_syntax_highlighting_theme integer DEFAULT 1 NOT NULL, encrypted_product_analytics_clickhouse_connection_string bytea, encrypted_product_analytics_clickhouse_connection_string_iv bytea, - allow_possible_spam boolean DEFAULT false NOT NULL, search_max_shard_size_gb integer DEFAULT 50 NOT NULL, search_max_docs_denominator integer DEFAULT 5000000 NOT NULL, search_min_docs_before_rollover integer DEFAULT 100000 NOT NULL, deactivation_email_additional_text text, - git_rate_limit_users_alertlist integer[] DEFAULT '{}'::integer[] NOT NULL, jira_connect_public_key_storage_enabled boolean DEFAULT false NOT NULL, - security_policy_global_group_approvers_enabled boolean DEFAULT true NOT NULL, - default_syntax_highlighting_theme integer DEFAULT 1 NOT NULL, + git_rate_limit_users_alertlist integer[] DEFAULT '{}'::integer[] NOT NULL, allow_deploy_tokens_and_keys_with_external_authn boolean DEFAULT false NOT NULL, + security_policy_global_group_approvers_enabled boolean DEFAULT true NOT NULL, projects_api_rate_limit_unauthenticated integer DEFAULT 400 NOT NULL, deny_all_requests_except_allowed boolean DEFAULT false NOT NULL, product_analytics_data_collector_host text, lock_memberships_to_saml boolean DEFAULT false NOT NULL, - update_runner_versions_enabled boolean DEFAULT true NOT NULL, gitlab_dedicated_instance boolean DEFAULT false NOT NULL, + update_runner_versions_enabled boolean DEFAULT true NOT NULL, database_apdex_settings jsonb, encrypted_openai_api_key bytea, encrypted_openai_api_key_iv bytea, database_max_running_batched_background_migrations integer DEFAULT 2 NOT NULL, - silent_mode_enabled boolean DEFAULT false NOT NULL, - package_metadata_purl_types smallint[] DEFAULT '{}'::smallint[], encrypted_product_analytics_configurator_connection_string bytea, encrypted_product_analytics_configurator_connection_string_iv bytea, + silent_mode_enabled boolean DEFAULT false NOT NULL, + package_metadata_purl_types smallint[] DEFAULT '{}'::smallint[], ci_max_includes integer DEFAULT 150 NOT NULL, encrypted_tofa_credentials bytea, encrypted_tofa_credentials_iv bytea, @@ -14387,28 +14387,6 @@ CREATE TABLE clusters ( helm_major_version integer DEFAULT 3 NOT NULL ); -CREATE TABLE clusters_applications_knative ( - id integer NOT NULL, - cluster_id integer NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - status integer NOT NULL, - version character varying NOT NULL, - hostname character varying, - status_reason text, - external_ip character varying, - external_hostname character varying -); - -CREATE SEQUENCE clusters_applications_knative_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE clusters_applications_knative_id_seq OWNED BY clusters_applications_knative.id; - CREATE TABLE clusters_applications_runners ( id integer NOT NULL, cluster_id integer NOT NULL, @@ -18702,13 +18680,13 @@ CREATE TABLE namespace_settings ( runner_token_expiration_interval integer, subgroup_runner_token_expiration_interval integer, project_runner_token_expiration_interval integer, + show_diff_preview_in_email boolean DEFAULT true NOT NULL, enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, unique_project_download_limit smallint DEFAULT 0 NOT NULL, unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL, project_import_level smallint DEFAULT 50 NOT NULL, unique_project_download_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL, auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL, - show_diff_preview_in_email boolean DEFAULT true NOT NULL, only_allow_merge_if_pipeline_succeeds boolean DEFAULT false NOT NULL, allow_merge_on_skipped_pipeline boolean DEFAULT false NOT NULL, only_allow_merge_if_all_discussions_are_resolved boolean DEFAULT false NOT NULL, @@ -20095,7 +20073,6 @@ CREATE TABLE plan_limits ( helm_max_file_size bigint DEFAULT 5242880 NOT NULL, ci_registered_group_runners integer DEFAULT 1000 NOT NULL, ci_registered_project_runners integer DEFAULT 1000 NOT NULL, - web_hook_calls integer DEFAULT 0 NOT NULL, ci_daily_pipeline_schedule_triggers integer DEFAULT 0 NOT NULL, ci_max_artifact_size_running_container_scanning integer DEFAULT 0 NOT NULL, ci_max_artifact_size_cluster_image_scanning integer DEFAULT 0 NOT NULL, @@ -20120,6 +20097,7 @@ CREATE TABLE plan_limits ( enforcement_limit integer DEFAULT 0 NOT NULL, notification_limit integer DEFAULT 0 NOT NULL, dashboard_limit_enabled_at timestamp with time zone, + web_hook_calls integer DEFAULT 0 NOT NULL, project_access_token_limit integer DEFAULT 0 NOT NULL ); @@ -21164,11 +21142,11 @@ CREATE TABLE project_settings ( target_platforms character varying[] DEFAULT '{}'::character varying[] NOT NULL, enforce_auth_checks_on_uploads boolean DEFAULT true NOT NULL, selective_code_owner_removals boolean DEFAULT false NOT NULL, + issue_branch_template text, show_diff_preview_in_email boolean DEFAULT true NOT NULL, - suggested_reviewers_enabled boolean DEFAULT false NOT NULL, jitsu_key text, + suggested_reviewers_enabled boolean DEFAULT false NOT NULL, only_allow_merge_if_all_status_checks_passed boolean DEFAULT false NOT NULL, - issue_branch_template text, mirror_branch_regex text, allow_pipeline_trigger_approve_deployment boolean DEFAULT false NOT NULL, emails_enabled boolean DEFAULT true NOT NULL, @@ -25031,8 +25009,6 @@ ALTER TABLE ONLY cluster_providers_gcp ALTER COLUMN id SET DEFAULT nextval('clus ALTER TABLE ONLY clusters ALTER COLUMN id SET DEFAULT nextval('clusters_id_seq'::regclass); -ALTER TABLE ONLY clusters_applications_knative ALTER COLUMN id SET DEFAULT nextval('clusters_applications_knative_id_seq'::regclass); - ALTER TABLE ONLY clusters_applications_runners ALTER COLUMN id SET DEFAULT nextval('clusters_applications_runners_id_seq'::regclass); ALTER TABLE ONLY clusters_kubernetes_namespaces ALTER COLUMN id SET DEFAULT nextval('clusters_kubernetes_namespaces_id_seq'::regclass); @@ -26934,9 +26910,6 @@ ALTER TABLE ONLY cluster_providers_aws ALTER TABLE ONLY cluster_providers_gcp ADD CONSTRAINT cluster_providers_gcp_pkey PRIMARY KEY (id); -ALTER TABLE ONLY clusters_applications_knative - ADD CONSTRAINT clusters_applications_knative_pkey PRIMARY KEY (id); - ALTER TABLE ONLY clusters_applications_runners ADD CONSTRAINT clusters_applications_runners_pkey PRIMARY KEY (id); @@ -30395,8 +30368,6 @@ CREATE INDEX index_cluster_providers_gcp_on_cloud_run ON cluster_providers_gcp U CREATE UNIQUE INDEX index_cluster_providers_gcp_on_cluster_id ON cluster_providers_gcp USING btree (cluster_id); -CREATE UNIQUE INDEX index_clusters_applications_knative_on_cluster_id ON clusters_applications_knative USING btree (cluster_id); - CREATE UNIQUE INDEX index_clusters_applications_runners_on_cluster_id ON clusters_applications_runners USING btree (cluster_id); CREATE INDEX index_clusters_applications_runners_on_runner_id ON clusters_applications_runners USING btree (runner_id); @@ -31389,8 +31360,6 @@ CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_i CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id); -CREATE UNIQUE INDEX index_merge_request_user_mentions_note_id_convert_to_bigint ON merge_request_user_mentions USING btree (note_id_convert_to_bigint) WHERE (note_id_convert_to_bigint IS NOT NULL); - CREATE UNIQUE INDEX index_merge_request_user_mentions_on_note_id ON merge_request_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); CREATE INDEX index_merge_requests_closing_issues_on_issue_id ON merge_requests_closing_issues USING btree (issue_id); @@ -35741,9 +35710,6 @@ 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 merge_request_user_mentions - ADD CONSTRAINT fk_merge_request_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 ml_candidate_metrics ADD CONSTRAINT fk_ml_candidate_metrics_on_candidate_id FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id) ON DELETE CASCADE; -- cgit v1.2.1