diff options
Diffstat (limited to 'db/structure.sql')
-rw-r--r-- | db/structure.sql | 600 |
1 files changed, 524 insertions, 76 deletions
diff --git a/db/structure.sql b/db/structure.sql index 4e6fc7e9260..f29f9178a26 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -8953,6 +8953,43 @@ CREATE SEQUENCE analytics_cycle_analytics_project_stages_id_seq ALTER SEQUENCE analytics_cycle_analytics_project_stages_id_seq OWNED BY analytics_cycle_analytics_project_stages.id; +CREATE TABLE analytics_devops_adoption_segment_selections ( + id bigint NOT NULL, + segment_id bigint NOT NULL, + group_id bigint, + project_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + CONSTRAINT segment_selection_project_id_or_group_id_required CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL)))) +); + +CREATE SEQUENCE analytics_devops_adoption_segment_selections_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE analytics_devops_adoption_segment_selections_id_seq OWNED BY analytics_devops_adoption_segment_selections.id; + +CREATE TABLE analytics_devops_adoption_segments ( + id bigint NOT NULL, + name text NOT NULL, + last_recorded_at timestamp with time zone, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + CONSTRAINT check_4be7a006fd CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE analytics_devops_adoption_segments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE analytics_devops_adoption_segments_id_seq OWNED BY analytics_devops_adoption_segments.id; + CREATE TABLE analytics_instance_statistics_measurements ( id bigint NOT NULL, count bigint NOT NULL, @@ -9046,7 +9083,6 @@ CREATE TABLE application_settings ( max_attachment_size integer DEFAULT 10 NOT NULL, default_project_visibility integer DEFAULT 0 NOT NULL, default_snippet_visibility integer DEFAULT 0 NOT NULL, - domain_whitelist text, user_oauth_applications boolean DEFAULT true, after_sign_out_path character varying, session_expire_delay integer DEFAULT 10080 NOT NULL, @@ -9082,8 +9118,6 @@ CREATE TABLE application_settings ( elasticsearch_search boolean DEFAULT false NOT NULL, repository_storages character varying DEFAULT 'default'::character varying, enabled_git_access_protocol character varying, - domain_blacklist_enabled boolean DEFAULT false, - domain_blacklist text, usage_ping_enabled boolean DEFAULT true NOT NULL, sign_in_text_html text, help_page_text_html text, @@ -9171,7 +9205,7 @@ CREATE TABLE application_settings ( custom_project_templates_group_id integer, usage_stats_set_by_user_id integer, receive_max_input_size integer, - diff_max_patch_bytes integer DEFAULT 102400 NOT NULL, + diff_max_patch_bytes integer DEFAULT 204800 NOT NULL, archive_builds_in_seconds integer, commit_email_hostname character varying, protected_ci_variables boolean DEFAULT true NOT NULL, @@ -9257,7 +9291,6 @@ CREATE TABLE application_settings ( email_restrictions_enabled boolean DEFAULT false NOT NULL, email_restrictions text, npm_package_requests_forwarding boolean DEFAULT true NOT NULL, - namespace_storage_size_limit bigint DEFAULT 0 NOT NULL, seat_link_enabled boolean DEFAULT true NOT NULL, container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL, issues_create_limit integer DEFAULT 0 NOT NULL, @@ -9291,16 +9324,39 @@ CREATE TABLE application_settings ( gitpod_enabled boolean DEFAULT false NOT NULL, gitpod_url text DEFAULT 'https://gitpod.io/'::text, abuse_notification_email character varying, - require_admin_approval_after_user_signup boolean DEFAULT false NOT NULL, + require_admin_approval_after_user_signup boolean DEFAULT true NOT NULL, help_page_documentation_base_url text, automatic_purchased_storage_allocation boolean DEFAULT false NOT NULL, + encrypted_ci_jwt_signing_key text, + encrypted_ci_jwt_signing_key_iv text, + container_registry_expiration_policies_worker_capacity integer DEFAULT 0 NOT NULL, + elasticsearch_analyzers_smartcn_enabled boolean DEFAULT false NOT NULL, + elasticsearch_analyzers_smartcn_search boolean DEFAULT false NOT NULL, + elasticsearch_analyzers_kuromoji_enabled boolean DEFAULT false NOT NULL, + elasticsearch_analyzers_kuromoji_search boolean DEFAULT false NOT NULL, + secret_detection_token_revocation_enabled boolean DEFAULT false NOT NULL, + secret_detection_token_revocation_url text, + encrypted_secret_detection_token_revocation_token text, + encrypted_secret_detection_token_revocation_token_iv text, + domain_denylist_enabled boolean DEFAULT false, + domain_denylist text, + domain_allowlist text, + new_user_signups_cap integer, + encrypted_cloud_license_auth_token text, + encrypted_cloud_license_auth_token_iv text, + secret_detection_revocation_token_types_url text, + CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)), CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)), CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)), + CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), + CONSTRAINT check_9a719834eb CHECK ((char_length(secret_detection_token_revocation_url) <= 255)), CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)), + CONSTRAINT check_a5704163cc CHECK ((char_length(secret_detection_revocation_token_types_url) <= 255)), CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)), CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)), - CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)) + CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)), + CONSTRAINT check_ef6176834f CHECK ((char_length(encrypted_cloud_license_auth_token_iv) <= 255)) ); CREATE SEQUENCE application_settings_id_seq @@ -9608,7 +9664,9 @@ CREATE TABLE aws_roles ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, role_arn character varying(2048), - role_external_id character varying(64) NOT NULL + role_external_id character varying(64) NOT NULL, + region text, + CONSTRAINT check_57adedab55 CHECK ((char_length(region) <= 255)) ); CREATE TABLE background_migration_jobs ( @@ -9865,6 +9923,26 @@ CREATE SEQUENCE bulk_import_entities_id_seq ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id; +CREATE TABLE bulk_import_trackers ( + id bigint NOT NULL, + bulk_import_entity_id bigint NOT NULL, + relation text NOT NULL, + next_page text, + has_next_page boolean DEFAULT false NOT NULL, + CONSTRAINT check_2d45cae629 CHECK ((char_length(relation) <= 255)), + CONSTRAINT check_40aeaa600b CHECK ((char_length(next_page) <= 255)), + CONSTRAINT check_next_page_requirement CHECK (((has_next_page IS FALSE) OR (next_page IS NOT NULL))) +); + +CREATE SEQUENCE bulk_import_trackers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE bulk_import_trackers_id_seq OWNED BY bulk_import_trackers.id; + CREATE TABLE bulk_imports ( id bigint NOT NULL, user_id integer NOT NULL, @@ -10129,7 +10207,8 @@ CREATE TABLE ci_daily_build_group_report_results ( last_pipeline_id bigint NOT NULL, ref_path text NOT NULL, group_name text NOT NULL, - data jsonb NOT NULL + data jsonb NOT NULL, + default_branch boolean DEFAULT false NOT NULL ); CREATE SEQUENCE ci_daily_build_group_report_results_id_seq @@ -10653,6 +10732,38 @@ CREATE SEQUENCE ci_subscriptions_projects_id_seq ALTER SEQUENCE ci_subscriptions_projects_id_seq OWNED BY ci_subscriptions_projects.id; +CREATE TABLE ci_test_case_failures ( + id bigint NOT NULL, + failed_at timestamp with time zone, + test_case_id bigint NOT NULL, + build_id bigint NOT NULL +); + +CREATE SEQUENCE ci_test_case_failures_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_test_case_failures_id_seq OWNED BY ci_test_case_failures.id; + +CREATE TABLE ci_test_cases ( + id bigint NOT NULL, + project_id bigint NOT NULL, + key_hash text NOT NULL, + CONSTRAINT check_dd3c5d1c15 CHECK ((char_length(key_hash) <= 64)) +); + +CREATE SEQUENCE ci_test_cases_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_test_cases_id_seq OWNED BY ci_test_cases.id; + CREATE TABLE ci_trigger_requests ( id integer NOT NULL, trigger_id integer NOT NULL, @@ -10883,7 +10994,8 @@ CREATE TABLE clusters ( namespace_per_environment boolean DEFAULT true NOT NULL, management_project_id integer, cleanup_status smallint DEFAULT 1 NOT NULL, - cleanup_status_reason text + cleanup_status_reason text, + helm_major_version integer DEFAULT 2 NOT NULL ); CREATE TABLE clusters_applications_cert_managers ( @@ -11197,11 +11309,11 @@ CREATE TABLE container_expiration_policies ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, next_run_at timestamp with time zone, - name_regex character varying(255), + name_regex character varying(255) DEFAULT '.*'::character varying, cadence character varying(12) DEFAULT '1d'::character varying NOT NULL, older_than character varying(12) DEFAULT '90d'::character varying, keep_n integer DEFAULT 10, - enabled boolean DEFAULT true NOT NULL, + enabled boolean DEFAULT false NOT NULL, name_regex_keep text, CONSTRAINT container_expiration_policies_name_regex_keep CHECK ((char_length(name_regex_keep) <= 255)) ); @@ -11213,7 +11325,8 @@ CREATE TABLE container_repositories ( created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, status smallint, - expiration_policy_started_at timestamp with time zone + expiration_policy_started_at timestamp with time zone, + expiration_policy_cleanup_status smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE container_repositories_id_seq @@ -11270,6 +11383,23 @@ CREATE SEQUENCE conversational_development_index_metrics_id_seq ALTER SEQUENCE conversational_development_index_metrics_id_seq OWNED BY conversational_development_index_metrics.id; +CREATE TABLE csv_issue_imports ( + id bigint NOT NULL, + project_id bigint NOT NULL, + user_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE csv_issue_imports_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE csv_issue_imports_id_seq OWNED BY csv_issue_imports.id; + CREATE TABLE custom_emoji ( id bigint NOT NULL, namespace_id bigint NOT NULL, @@ -11547,7 +11677,9 @@ CREATE TABLE design_management_designs ( issue_id integer, filename character varying NOT NULL, relative_position integer, - CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)) + iid integer, + CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)), + CONSTRAINT check_cfb92df01a CHECK ((iid IS NOT NULL)) ); CREATE SEQUENCE design_management_designs_id_seq @@ -12647,10 +12779,12 @@ CREATE TABLE group_wiki_repositories ( CREATE TABLE historical_data ( id integer NOT NULL, - date date NOT NULL, + date date, active_user_count integer, created_at timestamp without time zone, - updated_at timestamp without time zone + updated_at timestamp without time zone, + recorded_at timestamp with time zone, + CONSTRAINT check_640e8cf66c CHECK ((recorded_at IS NOT NULL)) ); CREATE SEQUENCE historical_data_id_seq @@ -13063,6 +13197,9 @@ CREATE TABLE jira_tracker_data ( project_key text, issues_enabled boolean DEFAULT false NOT NULL, deployment_type smallint DEFAULT 0 NOT NULL, + vulnerabilities_issuetype text, + vulnerabilities_enabled boolean DEFAULT false NOT NULL, + CONSTRAINT check_0bf84b76e9 CHECK ((char_length(vulnerabilities_issuetype) <= 255)), CONSTRAINT check_214cf6a48b CHECK ((char_length(project_key) <= 255)) ); @@ -13354,6 +13491,23 @@ CREATE SEQUENCE merge_request_blocks_id_seq ALTER SEQUENCE merge_request_blocks_id_seq OWNED BY merge_request_blocks.id; +CREATE TABLE merge_request_cleanup_schedules ( + merge_request_id bigint NOT NULL, + scheduled_at timestamp with time zone NOT NULL, + completed_at timestamp with time zone, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq OWNED BY merge_request_cleanup_schedules.merge_request_id; + CREATE TABLE merge_request_context_commit_diff_files ( sha bytea NOT NULL, relative_order integer NOT NULL, @@ -13724,7 +13878,8 @@ CREATE TABLE namespace_root_storage_statistics ( storage_size bigint DEFAULT 0 NOT NULL, packages_size bigint DEFAULT 0 NOT NULL, snippets_size bigint DEFAULT 0 NOT NULL, - pipeline_artifacts_size bigint DEFAULT 0 NOT NULL + pipeline_artifacts_size bigint DEFAULT 0 NOT NULL, + uploads_size bigint DEFAULT 0 NOT NULL ); CREATE TABLE namespace_settings ( @@ -14298,6 +14453,21 @@ CREATE TABLE packages_nuget_metadata ( CONSTRAINT packages_nuget_metadata_project_url_constraint CHECK ((char_length(project_url) <= 255)) ); +CREATE TABLE packages_package_file_build_infos ( + id bigint NOT NULL, + package_file_id bigint NOT NULL, + pipeline_id bigint +); + +CREATE SEQUENCE packages_package_file_build_infos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_package_file_build_infos_id_seq OWNED BY packages_package_file_build_infos.id; + CREATE TABLE packages_package_files ( id bigint NOT NULL, package_id bigint NOT NULL, @@ -14380,6 +14550,8 @@ CREATE TABLE pages_deployments ( file_store smallint NOT NULL, size integer NOT NULL, file text NOT NULL, + file_count integer NOT NULL, + file_sha256 bytea NOT NULL, CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255)) ); @@ -14524,7 +14696,7 @@ CREATE TABLE plan_limits ( offset_pagination_limit integer DEFAULT 50000 NOT NULL, ci_instance_level_variables integer DEFAULT 25 NOT NULL, storage_size_limit integer DEFAULT 0 NOT NULL, - ci_max_artifact_size_lsif integer DEFAULT 20 NOT NULL, + ci_max_artifact_size_lsif integer DEFAULT 100 NOT NULL, ci_max_artifact_size_archive integer DEFAULT 0 NOT NULL, ci_max_artifact_size_metadata integer DEFAULT 0 NOT NULL, ci_max_artifact_size_trace integer DEFAULT 0 NOT NULL, @@ -14615,6 +14787,8 @@ CREATE VIEW postgres_indexes AS pg_index.indisvalid AS valid_index, pg_class.relispartition AS partitioned, pg_index.indisexclusion AS exclusion, + (pg_index.indexprs IS NOT NULL) AS expression, + (pg_index.indpred IS NOT NULL) AS partial, pg_indexes.indexdef AS definition, pg_relation_size((pg_class.oid)::regclass) AS ondisk_size_bytes FROM (((pg_index @@ -14623,6 +14797,48 @@ CREATE VIEW postgres_indexes AS JOIN pg_indexes ON ((pg_class.relname = pg_indexes.indexname))) WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name]))); +CREATE VIEW postgres_partitioned_tables AS + SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier, + pg_class.oid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + CASE partitioned_tables.partstrat + WHEN 'l'::"char" THEN 'list'::text + WHEN 'r'::"char" THEN 'range'::text + WHEN 'h'::"char" THEN 'hash'::text + ELSE NULL::text + END AS strategy, + array_agg(pg_attribute.attname) AS key_columns + FROM (((( SELECT pg_partitioned_table.partrelid, + pg_partitioned_table.partstrat, + unnest(pg_partitioned_table.partattrs) AS column_position + FROM pg_partitioned_table) partitioned_tables + JOIN pg_class ON ((partitioned_tables.partrelid = pg_class.oid))) + JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid))) + JOIN pg_attribute ON (((pg_attribute.attrelid = pg_class.oid) AND (pg_attribute.attnum = partitioned_tables.column_position)))) + WHERE (pg_namespace.nspname = "current_schema"()) + GROUP BY (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text), pg_class.oid, pg_namespace.nspname, pg_class.relname, + CASE partitioned_tables.partstrat + WHEN 'l'::"char" THEN 'list'::text + WHEN 'r'::"char" THEN 'range'::text + WHEN 'h'::"char" THEN 'hash'::text + ELSE NULL::text + END; + +CREATE VIEW postgres_partitions AS + SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier, + pg_class.oid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + (((parent_namespace.nspname)::text || '.'::text) || (parent_class.relname)::text) AS parent_identifier, + pg_get_expr(pg_class.relpartbound, pg_inherits.inhrelid) AS condition + FROM ((((pg_class + JOIN pg_namespace ON ((pg_namespace.oid = pg_class.relnamespace))) + JOIN pg_inherits ON ((pg_class.oid = pg_inherits.inhrelid))) + JOIN pg_class parent_class ON ((pg_inherits.inhparent = parent_class.oid))) + JOIN pg_namespace parent_namespace ON ((parent_class.relnamespace = parent_namespace.oid))) + WHERE (pg_class.relispartition AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name]))); + CREATE TABLE postgres_reindex_actions ( id bigint NOT NULL, action_start timestamp with time zone NOT NULL, @@ -14717,7 +14933,9 @@ CREATE TABLE project_ci_cd_settings ( group_runners_enabled boolean DEFAULT true NOT NULL, merge_pipelines_enabled boolean, default_git_depth integer, - forward_deployment_enabled boolean + forward_deployment_enabled boolean, + merge_trains_enabled boolean DEFAULT false, + auto_rollback_enabled boolean DEFAULT false NOT NULL ); CREATE SEQUENCE project_ci_cd_settings_id_seq @@ -14731,7 +14949,7 @@ ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id; CREATE TABLE project_compliance_framework_settings ( project_id bigint NOT NULL, - framework smallint NOT NULL, + framework smallint, framework_id bigint, CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL)) ); @@ -14842,7 +15060,8 @@ CREATE TABLE project_features ( repository_access_level integer DEFAULT 20 NOT NULL, pages_access_level integer NOT NULL, forking_access_level integer, - metrics_dashboard_access_level integer + metrics_dashboard_access_level integer, + requirements_access_level integer DEFAULT 20 NOT NULL ); CREATE SEQUENCE project_features_id_seq @@ -15041,6 +15260,7 @@ CREATE TABLE project_settings ( allow_merge_on_skipped_pipeline boolean, squash_option smallint DEFAULT 3, has_confluence boolean DEFAULT false NOT NULL, + has_vulnerabilities boolean DEFAULT false NOT NULL, CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)) ); @@ -15058,7 +15278,8 @@ CREATE TABLE project_statistics ( packages_size bigint DEFAULT 0 NOT NULL, wiki_size bigint, snippets_size bigint, - pipeline_artifacts_size bigint DEFAULT 0 NOT NULL + pipeline_artifacts_size bigint DEFAULT 0 NOT NULL, + uploads_size bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE project_statistics_id_seq @@ -15840,6 +16061,7 @@ CREATE TABLE security_findings ( confidence smallint NOT NULL, project_fingerprint text NOT NULL, deduplicated boolean DEFAULT false NOT NULL, + "position" integer, CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)) ); @@ -15857,8 +16079,7 @@ CREATE TABLE security_scans ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, build_id bigint NOT NULL, - scan_type smallint NOT NULL, - scanned_resources_count integer + scan_type smallint NOT NULL ); CREATE SEQUENCE security_scans_id_seq @@ -16049,6 +16270,27 @@ CREATE TABLE snippet_repositories ( CONSTRAINT snippet_repositories_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255)) ); +CREATE TABLE snippet_repository_storage_moves ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + snippet_id bigint NOT NULL, + state smallint DEFAULT 1 NOT NULL, + source_storage_name text NOT NULL, + destination_storage_name text NOT NULL, + CONSTRAINT snippet_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)), + CONSTRAINT snippet_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255)) +); + +CREATE SEQUENCE snippet_repository_storage_moves_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE snippet_repository_storage_moves_id_seq OWNED BY snippet_repository_storage_moves.id; + CREATE TABLE snippet_statistics ( snippet_id bigint NOT NULL, repository_size bigint DEFAULT 0 NOT NULL, @@ -16092,7 +16334,8 @@ CREATE TABLE snippets ( description_html text, encrypted_secret_token character varying(255), encrypted_secret_token_iv character varying(255), - secret boolean DEFAULT false NOT NULL + secret boolean DEFAULT false NOT NULL, + repository_read_only boolean DEFAULT false NOT NULL ); CREATE SEQUENCE snippets_id_seq @@ -16356,6 +16599,7 @@ CREATE TABLE terraform_state_versions ( verified_at timestamp with time zone, verification_checksum bytea, verification_failure text, + ci_build_id bigint, CONSTRAINT check_0824bb7bbd CHECK ((char_length(file) <= 255)), CONSTRAINT tf_state_versions_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255)) ); @@ -16381,13 +16625,7 @@ CREATE TABLE terraform_states ( locked_by_user_id bigint, uuid character varying(32) NOT NULL, name character varying(255), - verification_retry_at timestamp with time zone, - verified_at timestamp with time zone, - verification_retry_count smallint, - verification_checksum bytea, - verification_failure text, - versioning_enabled boolean DEFAULT false NOT NULL, - CONSTRAINT check_21a47163ea CHECK ((char_length(verification_failure) <= 255)) + versioning_enabled boolean DEFAULT false NOT NULL ); CREATE SEQUENCE terraform_states_id_seq @@ -16649,7 +16887,8 @@ CREATE TABLE user_statuses ( cached_markdown_version integer, emoji character varying DEFAULT 'speech_balloon'::character varying NOT NULL, message character varying(100), - message_html character varying + message_html character varying, + availability smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE user_statuses_user_id_seq @@ -16929,6 +17168,26 @@ CREATE SEQUENCE vulnerability_feedback_id_seq ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id; +CREATE TABLE vulnerability_finding_links ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + vulnerability_occurrence_id bigint NOT NULL, + name text, + url text NOT NULL, + CONSTRAINT check_55f0a95439 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_b7fe886df6 CHECK ((char_length(url) <= 2048)) +); + +CREATE SEQUENCE vulnerability_finding_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_finding_links_id_seq OWNED BY vulnerability_finding_links.id; + CREATE TABLE vulnerability_historical_statistics ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17166,7 +17425,9 @@ CREATE TABLE web_hooks ( encrypted_token_iv character varying, encrypted_url character varying, encrypted_url_iv character varying, - deployment_events boolean DEFAULT false NOT NULL + deployment_events boolean DEFAULT false NOT NULL, + releases_events boolean DEFAULT false NOT NULL, + feature_flag_events boolean DEFAULT false NOT NULL ); CREATE SEQUENCE web_hooks_id_seq @@ -17333,6 +17594,10 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER COLUMN id S ALTER TABLE ONLY analytics_cycle_analytics_project_stages ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_project_stages_id_seq'::regclass); +ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segment_selections_id_seq'::regclass); + +ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segments_id_seq'::regclass); + ALTER TABLE ONLY analytics_instance_statistics_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_instance_statistics_measurements_id_seq'::regclass); ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass); @@ -17395,6 +17660,8 @@ ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass); +ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_trackers_id_seq'::regclass); + ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass); ALTER TABLE ONLY chat_names ALTER COLUMN id SET DEFAULT nextval('chat_names_id_seq'::regclass); @@ -17469,6 +17736,10 @@ ALTER TABLE ONLY ci_stages ALTER COLUMN id SET DEFAULT nextval('ci_stages_id_seq ALTER TABLE ONLY ci_subscriptions_projects ALTER COLUMN id SET DEFAULT nextval('ci_subscriptions_projects_id_seq'::regclass); +ALTER TABLE ONLY ci_test_case_failures ALTER COLUMN id SET DEFAULT nextval('ci_test_case_failures_id_seq'::regclass); + +ALTER TABLE ONLY ci_test_cases ALTER COLUMN id SET DEFAULT nextval('ci_test_cases_id_seq'::regclass); + ALTER TABLE ONLY ci_trigger_requests ALTER COLUMN id SET DEFAULT nextval('ci_trigger_requests_id_seq'::regclass); ALTER TABLE ONLY ci_triggers ALTER COLUMN id SET DEFAULT nextval('ci_triggers_id_seq'::regclass); @@ -17523,6 +17794,8 @@ ALTER TABLE ONLY container_repositories ALTER COLUMN id SET DEFAULT nextval('con ALTER TABLE ONLY conversational_development_index_metrics ALTER COLUMN id SET DEFAULT nextval('conversational_development_index_metrics_id_seq'::regclass); +ALTER TABLE ONLY csv_issue_imports ALTER COLUMN id SET DEFAULT nextval('csv_issue_imports_id_seq'::regclass); + ALTER TABLE ONLY custom_emoji ALTER COLUMN id SET DEFAULT nextval('custom_emoji_id_seq'::regclass); ALTER TABLE ONLY dast_scanner_profiles ALTER COLUMN id SET DEFAULT nextval('dast_scanner_profiles_id_seq'::regclass); @@ -17719,6 +17992,8 @@ ALTER TABLE ONLY merge_request_assignees ALTER COLUMN id SET DEFAULT nextval('me ALTER TABLE ONLY merge_request_blocks ALTER COLUMN id SET DEFAULT nextval('merge_request_blocks_id_seq'::regclass); +ALTER TABLE ONLY merge_request_cleanup_schedules ALTER COLUMN merge_request_id SET DEFAULT nextval('merge_request_cleanup_schedules_merge_request_id_seq'::regclass); + ALTER TABLE ONLY merge_request_context_commits ALTER COLUMN id SET DEFAULT nextval('merge_request_context_commits_id_seq'::regclass); ALTER TABLE ONLY merge_request_diff_details ALTER COLUMN merge_request_diff_id SET DEFAULT nextval('merge_request_diff_details_merge_request_diff_id_seq'::regclass); @@ -17793,6 +18068,8 @@ ALTER TABLE ONLY packages_events ALTER COLUMN id SET DEFAULT nextval('packages_e ALTER TABLE ONLY packages_maven_metadata ALTER COLUMN id SET DEFAULT nextval('packages_maven_metadata_id_seq'::regclass); +ALTER TABLE ONLY packages_package_file_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_package_file_build_infos_id_seq'::regclass); + ALTER TABLE ONLY packages_package_files ALTER COLUMN id SET DEFAULT nextval('packages_package_files_id_seq'::regclass); ALTER TABLE ONLY packages_packages ALTER COLUMN id SET DEFAULT nextval('packages_packages_id_seq'::regclass); @@ -17943,6 +18220,8 @@ ALTER TABLE ONLY slack_integrations ALTER COLUMN id SET DEFAULT nextval('slack_i ALTER TABLE ONLY smartcard_identities ALTER COLUMN id SET DEFAULT nextval('smartcard_identities_id_seq'::regclass); +ALTER TABLE ONLY snippet_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('snippet_repository_storage_moves_id_seq'::regclass); + ALTER TABLE ONLY snippet_user_mentions ALTER COLUMN id SET DEFAULT nextval('snippet_user_mentions_id_seq'::regclass); ALTER TABLE ONLY snippets ALTER COLUMN id SET DEFAULT nextval('snippets_id_seq'::regclass); @@ -18015,6 +18294,8 @@ ALTER TABLE ONLY vulnerability_exports ALTER COLUMN id SET DEFAULT nextval('vuln ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_historical_statistics_id_seq'::regclass); ALTER TABLE ONLY vulnerability_identifiers ALTER COLUMN id SET DEFAULT nextval('vulnerability_identifiers_id_seq'::regclass); @@ -18276,9 +18557,18 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER TABLE ONLY analytics_cycle_analytics_project_stages ADD CONSTRAINT analytics_cycle_analytics_project_stages_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT analytics_devops_adoption_segment_selections_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY analytics_devops_adoption_segments + ADD CONSTRAINT analytics_devops_adoption_segments_pkey PRIMARY KEY (id); + ALTER TABLE ONLY analytics_instance_statistics_measurements ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_language_trend_repository_languages + ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date); + ALTER TABLE ONLY appearances ADD CONSTRAINT appearances_pkey PRIMARY KEY (id); @@ -18309,6 +18599,9 @@ ALTER TABLE ONLY approval_project_rules_groups ALTER TABLE ONLY approval_project_rules ADD CONSTRAINT approval_project_rules_pkey PRIMARY KEY (id); +ALTER TABLE ONLY approval_project_rules_protected_branches + ADD CONSTRAINT approval_project_rules_protected_branches_pkey PRIMARY KEY (approval_project_rule_id, protected_branch_id); + ALTER TABLE ONLY approval_project_rules_users ADD CONSTRAINT approval_project_rules_users_pkey PRIMARY KEY (id); @@ -18381,6 +18674,9 @@ ALTER TABLE ONLY bulk_import_configurations ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id); +ALTER TABLE ONLY bulk_import_trackers + ADD CONSTRAINT bulk_import_trackers_pkey PRIMARY KEY (id); + ALTER TABLE ONLY bulk_imports ADD CONSTRAINT bulk_imports_pkey PRIMARY KEY (id); @@ -18411,6 +18707,9 @@ ALTER TABLE ONLY ci_build_trace_chunks ALTER TABLE ONLY ci_build_trace_section_names ADD CONSTRAINT ci_build_trace_section_names_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_build_trace_sections + ADD CONSTRAINT ci_build_trace_sections_pkey PRIMARY KEY (build_id, section_name_id); + ALTER TABLE ONLY ci_builds_metadata ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY (id); @@ -18498,6 +18797,12 @@ ALTER TABLE ONLY ci_stages ALTER TABLE ONLY ci_subscriptions_projects ADD CONSTRAINT ci_subscriptions_projects_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_test_case_failures + ADD CONSTRAINT ci_test_case_failures_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY ci_test_cases + ADD CONSTRAINT ci_test_cases_pkey PRIMARY KEY (id); + ALTER TABLE ONLY ci_trigger_requests ADD CONSTRAINT ci_trigger_requests_pkey PRIMARY KEY (id); @@ -18582,6 +18887,9 @@ ALTER TABLE ONLY container_repositories ALTER TABLE ONLY conversational_development_index_metrics ADD CONSTRAINT conversational_development_index_metrics_pkey PRIMARY KEY (id); +ALTER TABLE ONLY csv_issue_imports + ADD CONSTRAINT csv_issue_imports_pkey PRIMARY KEY (id); + ALTER TABLE ONLY custom_emoji ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id); @@ -18615,6 +18923,9 @@ ALTER TABLE ONLY deploy_tokens ALTER TABLE ONLY deployment_clusters ADD CONSTRAINT deployment_clusters_pkey PRIMARY KEY (deployment_id); +ALTER TABLE ONLY deployment_merge_requests + ADD CONSTRAINT deployment_merge_requests_pkey PRIMARY KEY (deployment_id, merge_request_id); + ALTER TABLE ONLY deployments ADD CONSTRAINT deployments_pkey PRIMARY KEY (id); @@ -18813,6 +19124,9 @@ ALTER TABLE ONLY issuable_severities ALTER TABLE ONLY issuable_slas ADD CONSTRAINT issuable_slas_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issue_assignees + ADD CONSTRAINT issue_assignees_pkey PRIMARY KEY (issue_id, user_id); + ALTER TABLE ONLY issue_email_participants ADD CONSTRAINT issue_email_participants_pkey PRIMARY KEY (id); @@ -18831,6 +19145,12 @@ ALTER TABLE ONLY issue_user_mentions ALTER TABLE ONLY issues ADD CONSTRAINT issues_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issues_prometheus_alert_events + ADD CONSTRAINT issues_prometheus_alert_events_pkey PRIMARY KEY (issue_id, prometheus_alert_event_id); + +ALTER TABLE ONLY issues_self_managed_prometheus_alert_events + ADD CONSTRAINT issues_self_managed_prometheus_alert_events_pkey PRIMARY KEY (issue_id, self_managed_prometheus_alert_event_id); + ALTER TABLE ONLY sprints ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint EXCLUDE USING gist (group_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL)); @@ -18891,12 +19211,21 @@ ALTER TABLE ONLY merge_request_assignees ALTER TABLE ONLY merge_request_blocks ADD CONSTRAINT merge_request_blocks_pkey PRIMARY KEY (id); +ALTER TABLE ONLY merge_request_cleanup_schedules + ADD CONSTRAINT merge_request_cleanup_schedules_pkey PRIMARY KEY (merge_request_id); + ALTER TABLE ONLY merge_request_context_commits ADD CONSTRAINT merge_request_context_commits_pkey PRIMARY KEY (id); +ALTER TABLE ONLY merge_request_diff_commits + ADD CONSTRAINT merge_request_diff_commits_pkey PRIMARY KEY (merge_request_diff_id, relative_order); + ALTER TABLE ONLY merge_request_diff_details ADD CONSTRAINT merge_request_diff_details_pkey PRIMARY KEY (merge_request_diff_id); +ALTER TABLE ONLY merge_request_diff_files + ADD CONSTRAINT merge_request_diff_files_pkey PRIMARY KEY (merge_request_diff_id, relative_order); + ALTER TABLE ONLY merge_request_diffs ADD CONSTRAINT merge_request_diffs_pkey PRIMARY KEY (id); @@ -18924,6 +19253,9 @@ ALTER TABLE ONLY metrics_dashboard_annotations ALTER TABLE ONLY metrics_users_starred_dashboards ADD CONSTRAINT metrics_users_starred_dashboards_pkey PRIMARY KEY (id); +ALTER TABLE ONLY milestone_releases + ADD CONSTRAINT milestone_releases_pkey PRIMARY KEY (milestone_id, release_id); + ALTER TABLE ONLY milestones ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); @@ -19023,6 +19355,9 @@ ALTER TABLE ONLY packages_nuget_dependency_link_metadata ALTER TABLE ONLY packages_nuget_metadata ADD CONSTRAINT packages_nuget_metadata_pkey PRIMARY KEY (package_id); +ALTER TABLE ONLY packages_package_file_build_infos + ADD CONSTRAINT packages_package_file_build_infos_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_package_files ADD CONSTRAINT packages_package_files_pkey PRIMARY KEY (id); @@ -19077,6 +19412,9 @@ ALTER TABLE ONLY project_alerting_settings ALTER TABLE ONLY project_aliases ADD CONSTRAINT project_aliases_pkey PRIMARY KEY (id); +ALTER TABLE ONLY project_authorizations + ADD CONSTRAINT project_authorizations_pkey PRIMARY KEY (user_id, project_id, access_level); + ALTER TABLE ONLY project_auto_devops ADD CONSTRAINT project_auto_devops_pkey PRIMARY KEY (id); @@ -19122,6 +19460,9 @@ ALTER TABLE ONLY project_metrics_settings ALTER TABLE ONLY project_mirror_data ADD CONSTRAINT project_mirror_data_pkey PRIMARY KEY (id); +ALTER TABLE ONLY project_pages_metadata + ADD CONSTRAINT project_pages_metadata_pkey PRIMARY KEY (project_id); + ALTER TABLE ONLY project_repositories ADD CONSTRAINT project_repositories_pkey PRIMARY KEY (id); @@ -19179,6 +19520,9 @@ ALTER TABLE ONLY protected_tag_create_access_levels ALTER TABLE ONLY protected_tags ADD CONSTRAINT protected_tags_pkey PRIMARY KEY (id); +ALTER TABLE ONLY push_event_payloads + ADD CONSTRAINT push_event_payloads_pkey PRIMARY KEY (event_id); + ALTER TABLE ONLY push_rules ADD CONSTRAINT push_rules_pkey PRIMARY KEY (id); @@ -19197,6 +19541,9 @@ ALTER TABLE ONLY releases ALTER TABLE ONLY remote_mirrors ADD CONSTRAINT remote_mirrors_pkey PRIMARY KEY (id); +ALTER TABLE ONLY repository_languages + ADD CONSTRAINT repository_languages_pkey PRIMARY KEY (project_id, programming_language_id); + ALTER TABLE ONLY required_code_owners_sections ADD CONSTRAINT required_code_owners_sections_pkey PRIMARY KEY (id); @@ -19278,6 +19625,9 @@ ALTER TABLE ONLY smartcard_identities ALTER TABLE ONLY snippet_repositories ADD CONSTRAINT snippet_repositories_pkey PRIMARY KEY (snippet_id); +ALTER TABLE ONLY snippet_repository_storage_moves + ADD CONSTRAINT snippet_repository_storage_moves_pkey PRIMARY KEY (id); + ALTER TABLE ONLY snippet_statistics ADD CONSTRAINT snippet_statistics_pkey PRIMARY KEY (snippet_id); @@ -19362,6 +19712,9 @@ ALTER TABLE ONLY user_details ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id); +ALTER TABLE ONLY user_interacted_projects + ADD CONSTRAINT user_interacted_projects_pkey PRIMARY KEY (project_id, user_id); + ALTER TABLE ONLY user_preferences ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (id); @@ -19377,6 +19730,9 @@ ALTER TABLE ONLY users_ops_dashboard_projects ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id); +ALTER TABLE ONLY users_security_dashboard_projects + ADD CONSTRAINT users_security_dashboard_projects_pkey PRIMARY KEY (project_id, user_id); + ALTER TABLE ONLY users_star_projects ADD CONSTRAINT users_star_projects_pkey PRIMARY KEY (id); @@ -19392,6 +19748,9 @@ ALTER TABLE ONLY vulnerability_exports ALTER TABLE ONLY vulnerability_feedback ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_finding_links + ADD CONSTRAINT vulnerability_finding_links_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_historical_statistics ADD CONSTRAINT vulnerability_historical_statistics_pkey PRIMARY KEY (id); @@ -19576,14 +19935,14 @@ CREATE INDEX product_analytics_events_exper_project_id_collector_tstamp_idx9 ON CREATE INDEX product_analytics_events_experi_project_id_collector_tstamp_idx ON gitlab_partitions_static.product_analytics_events_experimental_00 USING btree (project_id, collector_tstamp); +CREATE INDEX active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[NULL::integer, 6, 4]))) AND ((user_type IS NULL) OR (user_type <> ALL ('{2,6,1,3,7,8}'::smallint[])))); + CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events USING btree (created_at, author_id); CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING btree (created_at, author_id); CREATE INDEX analytics_repository_languages_on_project_id ON analytics_language_trend_repository_languages USING btree (project_id); -CREATE UNIQUE INDEX analytics_repository_languages_unique_index ON analytics_language_trend_repository_languages USING btree (programming_language_id, project_id, snapshot_date); - CREATE UNIQUE INDEX any_approver_merge_request_rule_type_unique_index ON approval_merge_request_rules USING btree (merge_request_id, rule_type) WHERE (rule_type = 4); CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_project_rules USING btree (project_id) WHERE (rule_type = 3); @@ -19604,6 +19963,8 @@ CREATE INDEX backup_labels_title_idx ON backup_labels USING btree (title); CREATE INDEX backup_labels_type_project_id_idx ON backup_labels USING btree (type, project_id); +CREATE UNIQUE INDEX bulk_import_trackers_uniq_relation_by_entity ON bulk_import_trackers USING btree (bulk_import_entity_id, relation); + CREATE INDEX ci_builds_gitlab_monitor_metrics ON ci_builds USING btree (status, created_at, project_id) WHERE ((type)::text = 'Ci::Build'::text); CREATE INDEX code_owner_approval_required ON protected_branches USING btree (project_id, code_owner_approval_required) WHERE (code_owner_approval_required = true); @@ -19618,15 +19979,17 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL); +CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id); + CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at); CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1); CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled); -CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); +CREATE INDEX idx_container_repositories_on_exp_cleanup_status_and_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, expiration_policy_started_at); -CREATE UNIQUE INDEX idx_deployment_merge_requests_unique_index ON deployment_merge_requests USING btree (deployment_id, merge_request_id); +CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_merge_requests USING btree (environment_id, merge_request_id); @@ -19668,6 +20031,8 @@ CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_c CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name); +CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); + CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type); @@ -19756,6 +20121,8 @@ CREATE INDEX index_analytics_ca_project_stages_on_start_event_label_id ON analyt CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true); +CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_name ON analytics_devops_adoption_segments USING btree (name); + CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON application_settings USING btree (custom_project_templates_group_id); CREATE INDEX index_application_settings_on_file_template_project_id ON application_settings USING btree (file_template_project_id); @@ -19796,8 +20163,6 @@ CREATE INDEX index_approval_project_rules_on_rule_type ON approval_project_rules CREATE INDEX index_approval_project_rules_protected_branches_pb_id ON approval_project_rules_protected_branches USING btree (protected_branch_id); -CREATE UNIQUE INDEX index_approval_project_rules_protected_branches_unique ON approval_project_rules_protected_branches USING btree (approval_project_rule_id, protected_branch_id); - CREATE UNIQUE INDEX index_approval_project_rules_users_1 ON approval_project_rules_users USING btree (approval_project_rule_id, user_id); CREATE INDEX index_approval_project_rules_users_2 ON approval_project_rules_users USING btree (user_id); @@ -19922,8 +20287,6 @@ CREATE UNIQUE INDEX index_ci_build_trace_chunks_on_build_id_and_chunk_index ON c CREATE UNIQUE INDEX index_ci_build_trace_section_names_on_project_id_and_name ON ci_build_trace_section_names USING btree (project_id, name); -CREATE UNIQUE INDEX index_ci_build_trace_sections_on_build_id_and_section_name_id ON ci_build_trace_sections USING btree (build_id, section_name_id); - CREATE INDEX index_ci_build_trace_sections_on_project_id ON ci_build_trace_sections USING btree (project_id); CREATE INDEX index_ci_build_trace_sections_on_section_name_id ON ci_build_trace_sections USING btree (section_name_id); @@ -19984,6 +20347,8 @@ CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runn CREATE INDEX index_ci_daily_build_group_report_results_on_last_pipeline_id ON ci_daily_build_group_report_results USING btree (last_pipeline_id); +CREATE INDEX index_ci_daily_build_group_report_results_on_project_and_date ON ci_daily_build_group_report_results USING btree (project_id, date DESC) WHERE ((default_branch = true) AND ((data -> 'coverage'::text) IS NOT NULL)); + CREATE INDEX index_ci_deleted_objects_on_pick_up_at ON ci_deleted_objects USING btree (pick_up_at); CREATE INDEX index_ci_freeze_periods_on_project_id ON ci_freeze_periods USING btree (project_id); @@ -20002,8 +20367,6 @@ CREATE INDEX index_ci_job_artifacts_on_file_store ON ci_job_artifacts USING btre CREATE UNIQUE INDEX index_ci_job_artifacts_on_job_id_and_file_type ON ci_job_artifacts USING btree (job_id, file_type); -CREATE INDEX index_ci_job_artifacts_on_license_compliance_file_types ON ci_job_artifacts USING btree (job_id, file_type) WHERE ((file_type = 10) OR (file_type = 101)); - CREATE INDEX index_ci_job_artifacts_on_project_id ON ci_job_artifacts USING btree (project_id); CREATE INDEX index_ci_job_artifacts_on_project_id_for_security_reports ON ci_job_artifacts USING btree (project_id) WHERE (file_type = ANY (ARRAY[5, 6, 7, 8])); @@ -20064,6 +20427,8 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_source ON ci_pipelines USING b CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_config_source ON ci_pipelines USING btree (project_id, status, config_source); +CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_created_at ON ci_pipelines USING btree (project_id, status, created_at); + CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_updated_at ON ci_pipelines USING btree (project_id, status, updated_at); CREATE INDEX index_ci_pipelines_on_project_id_and_user_id_and_status_and_ref ON ci_pipelines USING btree (project_id, user_id, status, ref) WHERE (source <> 12); @@ -20130,6 +20495,10 @@ CREATE INDEX index_ci_subscriptions_projects_on_upstream_project_id ON ci_subscr CREATE UNIQUE INDEX index_ci_subscriptions_projects_unique_subscription ON ci_subscriptions_projects USING btree (downstream_project_id, upstream_project_id); +CREATE INDEX index_ci_test_case_failures_on_build_id ON ci_test_case_failures USING btree (build_id); + +CREATE UNIQUE INDEX index_ci_test_cases_on_project_id_and_key_hash ON ci_test_cases USING btree (project_id, key_hash); + CREATE INDEX index_ci_trigger_requests_on_commit_id ON ci_trigger_requests USING btree (commit_id); CREATE INDEX index_ci_trigger_requests_on_trigger_id_and_id ON ci_trigger_requests USING btree (trigger_id, id DESC); @@ -20216,12 +20585,18 @@ CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON c CREATE INDEX index_container_repositories_on_project_id ON container_repositories USING btree (project_id); +CREATE INDEX index_container_repositories_on_project_id_and_id ON container_repositories USING btree (project_id, id); + CREATE UNIQUE INDEX index_container_repositories_on_project_id_and_name ON container_repositories USING btree (project_id, name); CREATE INDEX index_container_repository_on_name_trigram ON container_repositories USING gin (name gin_trgm_ops); CREATE INDEX index_created_at_on_codeowner_approval_merge_request_rules ON approval_merge_request_rules USING btree (created_at) WHERE ((rule_type = 2) AND (section <> 'codeowners'::text)); +CREATE INDEX index_csv_issue_imports_on_project_id ON csv_issue_imports USING btree (project_id); + +CREATE INDEX index_csv_issue_imports_on_user_id ON csv_issue_imports USING btree (user_id); + CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji USING btree (namespace_id, name); CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name); @@ -20236,7 +20611,7 @@ CREATE INDEX index_dast_site_tokens_on_project_id ON dast_site_tokens USING btre CREATE INDEX index_dast_site_validations_on_dast_site_token_id ON dast_site_validations USING btree (dast_site_token_id); -CREATE INDEX index_dast_site_validations_on_url_base ON dast_site_validations USING btree (url_base); +CREATE INDEX index_dast_site_validations_on_url_base_and_state ON dast_site_validations USING btree (url_base, state); CREATE INDEX index_dast_sites_on_dast_site_validation_id ON dast_sites USING btree (dast_site_validation_id); @@ -20302,6 +20677,8 @@ CREATE INDEX index_description_versions_on_merge_request_id ON description_versi CREATE INDEX index_design_management_designs_issue_id_relative_position_id ON design_management_designs USING btree (issue_id, relative_position, id); +CREATE UNIQUE INDEX index_design_management_designs_on_iid_and_project_id ON design_management_designs USING btree (project_id, iid); + CREATE UNIQUE INDEX index_design_management_designs_on_issue_id_and_filename ON design_management_designs USING btree (issue_id, filename); CREATE INDEX index_design_management_designs_on_project_id ON design_management_designs USING btree (project_id); @@ -20384,6 +20761,8 @@ CREATE INDEX index_epics_on_group_id ON epics USING btree (group_id); CREATE UNIQUE INDEX index_epics_on_group_id_and_external_key ON epics USING btree (group_id, external_key) WHERE (external_key IS NOT NULL); +CREATE UNIQUE INDEX index_epics_on_group_id_and_iid ON epics USING btree (group_id, iid); + CREATE INDEX index_epics_on_group_id_and_iid_varchar_pattern ON epics USING btree (group_id, ((iid)::character varying) varchar_pattern_ops); CREATE INDEX index_epics_on_iid ON epics USING btree (iid); @@ -20628,8 +21007,6 @@ CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree (issue_id); -CREATE UNIQUE INDEX index_issue_assignees_on_issue_id_and_user_id ON issue_assignees USING btree (issue_id, user_id); - CREATE INDEX index_issue_assignees_on_user_id ON issue_assignees USING btree (user_id); CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_email ON issue_email_participants USING btree (issue_id, email); @@ -20670,6 +21047,10 @@ CREATE INDEX index_issues_on_milestone_id ON issues USING btree (milestone_id); CREATE INDEX index_issues_on_moved_to_id ON issues USING btree (moved_to_id) WHERE (moved_to_id IS NOT NULL); +CREATE INDEX index_issues_on_project_id_and_closed_at ON issues USING btree (project_id, closed_at); + +CREATE INDEX index_issues_on_project_id_and_created_at_issue_type_incident ON issues USING btree (project_id, created_at) WHERE (issue_type = 1); + CREATE UNIQUE INDEX index_issues_on_project_id_and_external_key ON issues USING btree (project_id, external_key) WHERE (external_key IS NOT NULL); CREATE UNIQUE INDEX index_issues_on_project_id_and_iid ON issues USING btree (project_id, iid); @@ -20684,8 +21065,6 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at); CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL); -CREATE INDEX index_issues_project_id_issue_type_incident ON issues USING btree (project_id) WHERE (issue_type = 1); - CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key); CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id); @@ -20786,14 +21165,12 @@ CREATE INDEX index_merge_request_assignees_on_user_id ON merge_request_assignees CREATE INDEX index_merge_request_blocks_on_blocked_merge_request_id ON merge_request_blocks USING btree (blocked_merge_request_id); -CREATE UNIQUE INDEX index_merge_request_diff_commits_on_mr_diff_id_and_order ON merge_request_diff_commits USING btree (merge_request_diff_id, relative_order); +CREATE UNIQUE INDEX index_merge_request_cleanup_schedules_on_merge_request_id ON merge_request_cleanup_schedules USING btree (merge_request_id); CREATE INDEX index_merge_request_diff_commits_on_sha ON merge_request_diff_commits USING btree (sha); CREATE INDEX index_merge_request_diff_details_on_merge_request_diff_id ON merge_request_diff_details USING btree (merge_request_diff_id); -CREATE UNIQUE INDEX index_merge_request_diff_files_on_mr_diff_id_and_order ON merge_request_diff_files USING btree (merge_request_diff_id, relative_order); - CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL))); CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_diffs USING btree (external_diff_store); @@ -20816,8 +21193,6 @@ CREATE INDEX index_merge_request_metrics_on_pipeline_id ON merge_request_metrics CREATE INDEX index_merge_request_metrics_on_target_project_id ON merge_request_metrics USING btree (target_project_id); -CREATE INDEX index_merge_request_metrics_on_target_project_id_merged_at ON merge_request_metrics USING btree (target_project_id, merged_at); - CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_id ON merge_request_reviewers USING btree (merge_request_id, user_id); CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id); @@ -20858,8 +21233,12 @@ CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON merge_r CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON merge_requests USING btree (target_project_id, iid, state_id); +CREATE INDEX index_merge_requests_on_target_project_id_and_iid_jira_title ON merge_requests USING btree (target_project_id, iid) WHERE ((title)::text ~ '[A-Z][A-Z_0-9]+-\d+'::text); + CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true)); +CREATE INDEX index_merge_requests_on_target_project_id_iid_jira_description ON merge_requests USING btree (target_project_id, iid) WHERE (description ~ '[A-Z][A-Z_0-9]+-\d+'::text); + CREATE INDEX index_merge_requests_on_title ON merge_requests USING btree (title); CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops); @@ -20896,14 +21275,16 @@ CREATE INDEX index_milestones_on_title ON milestones USING btree (title); CREATE INDEX index_milestones_on_title_trigram ON milestones USING gin (title gin_trgm_ops); -CREATE UNIQUE INDEX index_miletone_releases_on_milestone_and_release ON milestone_releases USING btree (milestone_id, release_id); - CREATE INDEX index_mirror_data_on_next_execution_and_retry_count ON project_mirror_data USING btree (next_execution_timestamp, retry_count); CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id); +CREATE INDEX index_mr_cleanup_schedules_timestamps ON merge_request_cleanup_schedules USING btree (scheduled_at) WHERE (completed_at IS NULL); + CREATE UNIQUE INDEX index_mr_context_commits_on_merge_request_id_and_sha ON merge_request_context_commits USING btree (merge_request_id, sha); +CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_nulls_last ON merge_request_metrics USING btree (target_project_id, merged_at DESC NULLS LAST, id DESC); + CREATE UNIQUE INDEX index_namespace_aggregation_schedules_on_namespace_id ON namespace_aggregation_schedules USING btree (namespace_id); CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON namespace_root_storage_statistics USING btree (namespace_id); @@ -20974,6 +21355,8 @@ CREATE INDEX index_notification_settings_on_user_id ON notification_settings USI CREATE UNIQUE INDEX index_notifications_on_user_id_and_source_id_and_source_type ON notification_settings USING btree (user_id, source_id, source_type); +CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON oauth_access_grants USING btree (resource_owner_id, application_id, created_at); + CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON oauth_access_grants USING btree (token); CREATE INDEX index_oauth_access_tokens_on_application_id ON oauth_access_tokens USING btree (application_id); @@ -21000,6 +21383,24 @@ CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON a CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type); +CREATE INDEX index_on_namespaces_lower_name ON namespaces USING btree (lower((name)::text)); + +CREATE INDEX index_on_namespaces_lower_path ON namespaces USING btree (lower((path)::text)); + +CREATE INDEX index_on_projects_lower_path ON projects USING btree (lower((path)::text)); + +CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text)); + +CREATE UNIQUE INDEX index_on_segment_selections_group_id_segment_id ON analytics_devops_adoption_segment_selections USING btree (group_id, segment_id); + +CREATE UNIQUE INDEX index_on_segment_selections_project_id_segment_id ON analytics_devops_adoption_segment_selections USING btree (project_id, segment_id); + +CREATE INDEX index_on_segment_selections_segment_id ON analytics_devops_adoption_segment_selections USING btree (segment_id); + +CREATE INDEX index_on_users_lower_email ON users USING btree (lower((email)::text)); + +CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username)::text)); + CREATE INDEX index_on_users_name_lower ON users USING btree (lower((name)::text)); CREATE INDEX index_open_project_tracker_data_on_service_id ON open_project_tracker_data USING btree (service_id); @@ -21024,8 +21425,6 @@ CREATE UNIQUE INDEX index_ops_feature_flags_issues_on_feature_flag_id_and_issue_ CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list_id ON operations_strategies_user_lists USING btree (strategy_id, user_list_id); -CREATE UNIQUE INDEX index_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); - CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id); CREATE UNIQUE INDEX index_packages_composer_metadata_on_package_id_and_target_sha ON packages_composer_metadata USING btree (package_id, target_sha); @@ -21046,6 +21445,10 @@ CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_ CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 7); +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); + CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store); CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name); @@ -21140,8 +21543,6 @@ CREATE INDEX index_project_aliases_on_project_id ON project_aliases USING btree CREATE INDEX index_project_authorizations_on_project_id ON project_authorizations USING btree (project_id); -CREATE UNIQUE INDEX index_project_authorizations_on_user_id_project_id_access_level ON project_authorizations USING btree (user_id, project_id, access_level); - CREATE UNIQUE INDEX index_project_auto_devops_on_project_id ON project_auto_devops USING btree (project_id); CREATE UNIQUE INDEX index_project_ci_cd_settings_on_project_id ON project_ci_cd_settings USING btree (project_id); @@ -21194,8 +21595,6 @@ CREATE INDEX index_project_pages_metadata_on_artifacts_archive_id ON project_pag CREATE INDEX index_project_pages_metadata_on_pages_deployment_id ON project_pages_metadata USING btree (pages_deployment_id); -CREATE UNIQUE INDEX index_project_pages_metadata_on_project_id ON project_pages_metadata USING btree (project_id); - CREATE INDEX index_project_pages_metadata_on_project_id_and_deployed_is_true ON project_pages_metadata USING btree (project_id) WHERE (deployed = true); CREATE UNIQUE INDEX index_project_repositories_on_disk_path ON project_repositories USING btree (disk_path); @@ -21208,6 +21607,8 @@ CREATE UNIQUE INDEX index_project_repository_states_on_project_id ON project_rep CREATE INDEX index_project_repository_storage_moves_on_project_id ON project_repository_storage_moves USING btree (project_id); +CREATE INDEX index_project_settings_on_project_id_partially ON project_settings USING btree (project_id) WHERE (has_vulnerabilities IS TRUE); + CREATE UNIQUE INDEX index_project_settings_on_push_rule_id ON project_settings USING btree (push_rule_id); CREATE INDEX index_project_statistics_on_namespace_id ON project_statistics USING btree (namespace_id); @@ -21368,8 +21769,6 @@ CREATE INDEX index_protected_tags_on_project_id ON protected_tags USING btree (p CREATE UNIQUE INDEX index_protected_tags_on_project_id_and_name ON protected_tags USING btree (project_id, name); -CREATE UNIQUE INDEX index_push_event_payloads_on_event_id ON push_event_payloads USING btree (event_id); - CREATE INDEX index_push_rules_on_is_sample ON push_rules USING btree (is_sample) WHERE is_sample; CREATE INDEX index_push_rules_on_project_id ON push_rules USING btree (project_id); @@ -21394,8 +21793,6 @@ CREATE INDEX index_remote_mirrors_on_last_successful_update_at ON remote_mirrors CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (project_id); -CREATE UNIQUE INDEX index_repository_languages_on_project_and_languages_id ON repository_languages USING btree (project_id, programming_language_id); - CREATE INDEX index_required_code_owners_sections_on_protected_branch_id ON required_code_owners_sections USING btree (protected_branch_id); CREATE INDEX index_requirements_management_test_reports_on_author_id ON requirements_management_test_reports USING btree (author_id); @@ -21472,6 +21869,8 @@ CREATE INDEX index_reviews_on_merge_request_id ON reviews USING btree (merge_req CREATE INDEX index_reviews_on_project_id ON reviews USING btree (project_id); +CREATE INDEX index_route_on_name_trigram ON routes USING gin (name gin_trgm_ops); + CREATE UNIQUE INDEX index_routes_on_path ON routes USING btree (path); CREATE INDEX index_routes_on_path_text_pattern_ops ON routes USING btree (path varchar_pattern_ops); @@ -21502,6 +21901,8 @@ CREATE INDEX index_security_findings_on_project_fingerprint ON security_findings CREATE INDEX index_security_findings_on_scan_id_and_deduplicated ON security_findings USING btree (scan_id, deduplicated); +CREATE UNIQUE INDEX index_security_findings_on_scan_id_and_position ON security_findings USING btree (scan_id, "position"); + CREATE INDEX index_security_findings_on_scanner_id ON security_findings USING btree (scanner_id); CREATE INDEX index_security_findings_on_severity ON security_findings USING btree (severity); @@ -21536,8 +21937,6 @@ CREATE UNIQUE INDEX index_services_on_type_and_template_partial ON services USIN CREATE INDEX index_services_on_type_id_when_active_and_project_id_not_null ON services USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL)); -CREATE INDEX index_services_on_type_id_when_active_not_instance_not_template ON services USING btree (type, id) WHERE ((active = true) AND (instance = false) AND (template = false)); - CREATE UNIQUE INDEX index_services_on_unique_group_id_and_type ON services USING btree (group_id, type); CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name); @@ -21554,6 +21953,8 @@ CREATE UNIQUE INDEX index_snippet_repositories_on_disk_path ON snippet_repositor CREATE INDEX index_snippet_repositories_on_shard_id ON snippet_repositories USING btree (shard_id); +CREATE INDEX index_snippet_repository_storage_moves_on_snippet_id ON snippet_repository_storage_moves USING btree (snippet_id); + CREATE UNIQUE INDEX index_snippet_user_mentions_on_note_id ON snippet_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); CREATE INDEX index_snippets_on_author_id ON snippets USING btree (author_id); @@ -21632,6 +22033,8 @@ CREATE INDEX index_term_agreements_on_term_id ON term_agreements USING btree (te CREATE INDEX index_term_agreements_on_user_id ON term_agreements USING btree (user_id); +CREATE INDEX index_terraform_state_versions_on_ci_build_id ON terraform_state_versions USING btree (ci_build_id); + CREATE INDEX index_terraform_state_versions_on_created_by_user_id ON terraform_state_versions USING btree (created_by_user_id); CREATE UNIQUE INDEX index_terraform_state_versions_on_state_id_and_version ON terraform_state_versions USING btree (terraform_state_id, version); @@ -21644,6 +22047,8 @@ CREATE UNIQUE INDEX index_terraform_states_on_project_id_and_name ON terraform_s CREATE UNIQUE INDEX index_terraform_states_on_uuid ON terraform_states USING btree (uuid); +CREATE UNIQUE INDEX index_test_case_failures_unique_columns ON ci_test_case_failures USING btree (test_case_id, failed_at DESC, build_id); + CREATE INDEX index_timelogs_on_issue_id ON timelogs USING btree (issue_id); CREATE INDEX index_timelogs_on_merge_request_id ON timelogs USING btree (merge_request_id); @@ -21708,8 +22113,6 @@ CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (u CREATE INDEX index_user_highest_roles_on_user_id_and_highest_access_level ON user_highest_roles USING btree (user_id, highest_access_level); -CREATE UNIQUE INDEX index_user_interacted_projects_on_project_id_and_user_id ON user_interacted_projects USING btree (project_id, user_id); - CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id); CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled); @@ -21838,6 +22241,8 @@ CREATE INDEX index_vulnerability_occurrences_for_issue_links_migration ON vulner CREATE INDEX index_vulnerability_occurrences_on_primary_identifier_id ON vulnerability_occurrences USING btree (primary_identifier_id); +CREATE INDEX index_vulnerability_occurrences_on_project_fingerprint ON vulnerability_occurrences USING btree (project_fingerprint); + CREATE INDEX index_vulnerability_occurrences_on_scanner_id ON vulnerability_occurrences USING btree (scanner_id); CREATE UNIQUE INDEX index_vulnerability_occurrences_on_unique_keys ON vulnerability_occurrences USING btree (project_id, primary_identifier_id, location_fingerprint, scanner_id); @@ -21904,10 +22309,6 @@ CREATE INDEX issue_id_issues_prometheus_alert_events_index ON issues_prometheus_ CREATE INDEX issue_id_issues_self_managed_rometheus_alert_events_index ON issues_self_managed_prometheus_alert_events USING btree (self_managed_prometheus_alert_event_id); -CREATE UNIQUE INDEX issue_id_prometheus_alert_event_id_index ON issues_prometheus_alert_events USING btree (issue_id, prometheus_alert_event_id); - -CREATE UNIQUE INDEX issue_id_self_managed_prometheus_alert_event_id_index ON issues_self_managed_prometheus_alert_events USING btree (issue_id, self_managed_prometheus_alert_event_id); - CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_and_note_id_index ON issue_user_mentions USING btree (issue_id, note_id); CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_index ON issue_user_mentions USING btree (issue_id) WHERE (note_id IS NULL); @@ -21920,6 +22321,8 @@ CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_and_note_id_index ON me CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_index ON merge_request_user_mentions USING btree (merge_request_id) WHERE (note_id IS NULL); +CREATE INDEX merge_requests_state_id_temp_index ON merge_requests USING btree (id) WHERE (state_id = ANY (ARRAY[2, 3])); + CREATE INDEX note_mentions_temp_index ON notes USING btree (id, noteable_type) WHERE (note ~~ '%@%'::text); CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON wiki_page_slugs USING btree (wiki_page_meta_id) WHERE (canonical = true); @@ -21946,6 +22349,8 @@ CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_index ON snippet_user_me CREATE UNIQUE INDEX taggings_idx ON taggings USING btree (tag_id, taggable_id, taggable_type, context, tagger_id, tagger_type); +CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btree (id) WHERE ((state = 2) AND ((dismissed_at IS NULL) OR (dismissed_by_id IS NULL))); + CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id); CREATE INDEX terraform_state_versions_verification_checksum_partial ON terraform_state_versions USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL); @@ -21964,8 +22369,6 @@ CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); -CREATE UNIQUE INDEX users_security_dashboard_projects_unique_index ON users_security_dashboard_projects USING btree (project_id, user_id); - CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnerability_occurrence_pipelines USING btree (occurrence_id, pipeline_id); @@ -22240,6 +22643,12 @@ ALTER TABLE ONLY clusters_applications_runners ALTER TABLE ONLY design_management_designs_versions ADD CONSTRAINT fk_03c671965c FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE; +ALTER TABLE ONLY terraform_state_versions + ADD CONSTRAINT fk_04b91e4a9f FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE SET NULL; + +ALTER TABLE ONLY ci_test_cases + ADD CONSTRAINT fk_0526c30ded FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues ADD CONSTRAINT fk_05f1e72feb FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL; @@ -22423,6 +22832,9 @@ ALTER TABLE ONLY deploy_keys_projects ALTER TABLE ONLY issue_assignees ADD CONSTRAINT fk_5e0c8d9154 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY csv_issue_imports + ADD CONSTRAINT fk_5e1572387c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_access_tokens ADD CONSTRAINT fk_5f7e8450e1 FOREIGN KEY (personal_access_token_id) REFERENCES personal_access_tokens(id) ON DELETE CASCADE; @@ -22750,6 +23162,9 @@ ALTER TABLE ONLY ci_sources_pipelines ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_d5af95fcd9 FOREIGN KEY (lfs_object_deleted_event_id) REFERENCES geo_lfs_object_deleted_events(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_test_case_failures + ADD CONSTRAINT fk_d69404d827 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; + ALTER TABLE ONLY lists ADD CONSTRAINT fk_d6cf4279f7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -22774,6 +23189,9 @@ ALTER TABLE ONLY project_group_links ALTER TABLE ONLY epics ADD CONSTRAINT fk_dccd3f98fc FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT fk_ded7fe0344 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues ADD CONSTRAINT fk_df75a7c8b8 FOREIGN KEY (promoted_to_epic_id) REFERENCES epics(id) ON DELETE SET NULL; @@ -22795,6 +23213,9 @@ ALTER TABLE ONLY merge_requests ALTER TABLE ONLY issue_links ADD CONSTRAINT fk_e71bb44f1f FOREIGN KEY (target_id) REFERENCES issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY csv_issue_imports + ADD CONSTRAINT fk_e71c0ae362 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY namespaces ADD CONSTRAINT fk_e7a0b20a6b FOREIGN KEY (custom_project_templates_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; @@ -22834,6 +23255,9 @@ ALTER TABLE ONLY clusters ALTER TABLE ONLY epics ADD CONSTRAINT fk_f081aa4489 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT fk_f1472b95f3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY boards ADD CONSTRAINT fk_f15266b5f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -22903,6 +23327,9 @@ ALTER TABLE ONLY ip_restrictions ALTER TABLE ONLY terraform_state_versions ADD CONSTRAINT fk_rails_04f176e239 FOREIGN KEY (terraform_state_id) REFERENCES terraform_states(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT fk_rails_053f00a9da FOREIGN KEY (segment_id) REFERENCES analytics_devops_adoption_segments(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_build_report_results ADD CONSTRAINT fk_rails_056d298d48 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23182,6 +23609,9 @@ ALTER TABLE ONLY snippet_user_mentions ALTER TABLE ONLY clusters_applications_helm ADD CONSTRAINT fk_rails_3e2b1c06bc FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_package_file_build_infos + ADD CONSTRAINT fk_rails_3e3f630188 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL; + ALTER TABLE ONLY epic_user_mentions ADD CONSTRAINT fk_rails_3eaf4d88cc FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE; @@ -23251,6 +23681,9 @@ ALTER TABLE ONLY ci_pipeline_artifacts ALTER TABLE ONLY group_deletion_schedules ADD CONSTRAINT fk_rails_4b8c694a6c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY snippet_repository_storage_moves + ADD CONSTRAINT fk_rails_4b950f5b94 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE; + ALTER TABLE ONLY design_management_designs ADD CONSTRAINT fk_rails_4bb1073360 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23563,6 +23996,9 @@ ALTER TABLE ONLY merge_request_diff_details ALTER TABLE ONLY clusters_applications_crossplane ADD CONSTRAINT fk_rails_87186702df FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_package_file_build_infos + ADD CONSTRAINT fk_rails_871ca3ae21 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_runner_namespaces ADD CONSTRAINT fk_rails_8767676b7a FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE CASCADE; @@ -23632,6 +24068,9 @@ ALTER TABLE ONLY project_error_tracking_settings ALTER TABLE ONLY list_user_preferences ADD CONSTRAINT fk_rails_916d72cafd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY merge_request_cleanup_schedules + ADD CONSTRAINT fk_rails_92dd0e705c FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; + ALTER TABLE ONLY board_labels ADD CONSTRAINT fk_rails_9374a16edd FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE; @@ -23764,6 +24203,9 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_stages ALTER TABLE ONLY metrics_dashboard_annotations ADD CONSTRAINT fk_rails_aeb11a7643 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE; +ALTER TABLE ONLY bulk_import_trackers + ADD CONSTRAINT fk_rails_aed566d3f3 FOREIGN KEY (bulk_import_entity_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE; + ALTER TABLE ONLY pool_repositories ADD CONSTRAINT fk_rails_af3f8c5d62 FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT; @@ -23914,6 +24356,9 @@ ALTER TABLE ONLY gpg_signatures ALTER TABLE ONLY board_group_recent_visits ADD CONSTRAINT fk_rails_ca04c38720 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_finding_links + ADD CONSTRAINT fk_rails_cbdfde27ce FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues_self_managed_prometheus_alert_events ADD CONSTRAINT fk_rails_cc5d88bbb0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -24040,6 +24485,9 @@ ALTER TABLE ONLY merge_request_blocks ALTER TABLE ONLY protected_branch_unprotect_access_levels ADD CONSTRAINT fk_rails_e9eb8dc025 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_test_case_failures + ADD CONSTRAINT fk_rails_eab6349715 FOREIGN KEY (test_case_id) REFERENCES ci_test_cases(id) ON DELETE CASCADE; + ALTER TABLE ONLY alert_management_alert_user_mentions ADD CONSTRAINT fk_rails_eb2de0cdef FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE; |