diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /db | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'db')
331 files changed, 2597 insertions, 330 deletions
diff --git a/db/docs/agent_activity_events.yml b/db/docs/agent_activity_events.yml index 82e6481be42..3be300e1852 100644 --- a/db/docs/agent_activity_events.yml +++ b/db/docs/agent_activity_events.yml @@ -4,6 +4,6 @@ classes: - Clusters::Agents::ActivityEvent feature_categories: - kubernetes_management -description: TODO +description: Historical timeline events belonging to a cluster agent introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74577 milestone: '14.6' diff --git a/db/docs/agent_group_authorizations.yml b/db/docs/agent_group_authorizations.yml index 1c250b90b6d..3592c93ed83 100644 --- a/db/docs/agent_group_authorizations.yml +++ b/db/docs/agent_group_authorizations.yml @@ -4,6 +4,6 @@ classes: - Clusters::Agents::GroupAuthorization feature_categories: - kubernetes_management -description: TODO +description: Configuration for a group that is authorized to use a particular cluster agent introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68023 milestone: '14.3' diff --git a/db/docs/agent_project_authorizations.yml b/db/docs/agent_project_authorizations.yml index 3ac48b0d35b..c4e101f754f 100644 --- a/db/docs/agent_project_authorizations.yml +++ b/db/docs/agent_project_authorizations.yml @@ -4,6 +4,6 @@ classes: - Clusters::Agents::ProjectAuthorization feature_categories: - kubernetes_management -description: TODO +description: Configuration for a project that is authorized to use a particular cluster agent introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67295 milestone: '14.3' diff --git a/db/docs/audit_events_streaming_headers.yml b/db/docs/audit_events_streaming_headers.yml new file mode 100644 index 00000000000..034ed2c6644 --- /dev/null +++ b/db/docs/audit_events_streaming_headers.yml @@ -0,0 +1,9 @@ +--- +table_name: audit_events_streaming_headers +classes: + - AuditEvents::Streaming::Header +feature_categories: + - audit_events +description: Represents a HTTP header sent with streaming audit events +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88063 +milestone: '15.1' diff --git a/db/docs/aws_roles.yml b/db/docs/aws_roles.yml index c278809e5fd..df308acc423 100644 --- a/db/docs/aws_roles.yml +++ b/db/docs/aws_roles.yml @@ -4,6 +4,6 @@ classes: - Aws::Role feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) AWS IAM role for creating EKS clusters via GitLab introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17057 milestone: '12.4' diff --git a/db/docs/ci_builds_runner_session.yml b/db/docs/ci_builds_runner_session.yml index 790a976a47a..0e46442da3f 100644 --- a/db/docs/ci_builds_runner_session.yml +++ b/db/docs/ci_builds_runner_session.yml @@ -3,7 +3,7 @@ table_name: ci_builds_runner_session classes: - Ci::BuildRunnerSession feature_categories: -- continuous_integration -description: TODO +- runner +description: Store build-related runner session. Data is removed after the respective job transitions from running to any state. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6208 milestone: '11.1' diff --git a/db/docs/ci_freeze_periods.yml b/db/docs/ci_freeze_periods.yml index 877e18acd9d..5c6e25ecc32 100644 --- a/db/docs/ci_freeze_periods.yml +++ b/db/docs/ci_freeze_periods.yml @@ -3,7 +3,7 @@ table_name: ci_freeze_periods classes: - Ci::FreezePeriod feature_categories: -- continuous_integration -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/ci/environments/deployment_safety.html#prevent-deployments-during-deploy-freeze-windows introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29162 milestone: '13.0' diff --git a/db/docs/ci_instance_variables.yml b/db/docs/ci_instance_variables.yml index aaac23556d6..94d7c08a0fa 100644 --- a/db/docs/ci_instance_variables.yml +++ b/db/docs/ci_instance_variables.yml @@ -4,6 +4,6 @@ classes: - Ci::InstanceVariable feature_categories: - pipeline_authoring -description: TODO +description: CI/CD variables available to all projects and groups in an instance. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30156 milestone: '13.0' diff --git a/db/docs/ci_job_variables.yml b/db/docs/ci_job_variables.yml index b9143eab20d..f913ee4f800 100644 --- a/db/docs/ci_job_variables.yml +++ b/db/docs/ci_job_variables.yml @@ -4,6 +4,6 @@ classes: - Ci::JobVariable feature_categories: - pipeline_authoring -description: TODO +description: CI/CD variables set to a job when running it manually. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/14784 milestone: '12.2' diff --git a/db/docs/ci_pipeline_chat_data.yml b/db/docs/ci_pipeline_chat_data.yml index 4f7152d0b56..1edd3c923f2 100644 --- a/db/docs/ci_pipeline_chat_data.yml +++ b/db/docs/ci_pipeline_chat_data.yml @@ -4,6 +4,6 @@ classes: - Ci::PipelineChatData feature_categories: - chatops -description: TODO +description: Stores information about a CI pipeline created via chatops introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4466 milestone: '10.6' diff --git a/db/docs/ci_platform_metrics.yml b/db/docs/ci_platform_metrics.yml index 26039b8a7c8..b96f613f3ac 100644 --- a/db/docs/ci_platform_metrics.yml +++ b/db/docs/ci_platform_metrics.yml @@ -4,6 +4,6 @@ classes: - CiPlatformMetric feature_categories: - continuous_integration -description: TODO +description: Instrumentation for https://docs.gitlab.com/ee/ci/cloud_deployment/ecs/quick_start_guide.html introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40036 milestone: '13.4' diff --git a/db/docs/ci_resource_groups.yml b/db/docs/ci_resource_groups.yml index b64929a074c..716dea0b182 100644 --- a/db/docs/ci_resource_groups.yml +++ b/db/docs/ci_resource_groups.yml @@ -4,6 +4,6 @@ classes: - Ci::ResourceGroup feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/ci/resource_groups/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20950 milestone: '12.7' diff --git a/db/docs/cluster_agent_tokens.yml b/db/docs/cluster_agent_tokens.yml index 0d6265789f1..a08684e4e84 100644 --- a/db/docs/cluster_agent_tokens.yml +++ b/db/docs/cluster_agent_tokens.yml @@ -4,6 +4,6 @@ classes: - Clusters::AgentToken feature_categories: - kubernetes_management -description: TODO +description: Tokens used by cluster agents to connect to GitLab introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33228 milestone: '13.3' diff --git a/db/docs/cluster_agents.yml b/db/docs/cluster_agents.yml index 6593542dad6..59090f2ff75 100644 --- a/db/docs/cluster_agents.yml +++ b/db/docs/cluster_agents.yml @@ -4,6 +4,6 @@ classes: - Clusters::Agent feature_categories: - kubernetes_management -description: TODO +description: Represents a GitLab Agent for Kubernetes installed in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33228 milestone: '13.3' diff --git a/db/docs/cluster_enabled_grants.yml b/db/docs/cluster_enabled_grants.yml new file mode 100644 index 00000000000..7a8faba26d6 --- /dev/null +++ b/db/docs/cluster_enabled_grants.yml @@ -0,0 +1,9 @@ +--- +table_name: cluster_enabled_grants +classes: +- Clusters::ClusterEnabledGrant +feature_categories: +- kubernetes_management +description: Persists information about namespaces which got an extended life for certificate based clusters +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87149 +milestone: '15.1' diff --git a/db/docs/cluster_groups.yml b/db/docs/cluster_groups.yml index 0df250586a7..8a20ad3d562 100644 --- a/db/docs/cluster_groups.yml +++ b/db/docs/cluster_groups.yml @@ -4,6 +4,6 @@ classes: - Clusters::Group feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) Join table between 'clusters' and 'namespaces' introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/0e15eec86d83cbdfefe17966bf5c02e4d419a34d milestone: '11.5' diff --git a/db/docs/cluster_platforms_kubernetes.yml b/db/docs/cluster_platforms_kubernetes.yml index 7571ef7d546..ab1b53e36b4 100644 --- a/db/docs/cluster_platforms_kubernetes.yml +++ b/db/docs/cluster_platforms_kubernetes.yml @@ -4,6 +4,6 @@ classes: - Clusters::Platforms::Kubernetes feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) Kubernetes specific details for a cluster integration introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/d0cff7f5855f91b5479f9fdaa39d8d95ec691a9e milestone: '10.2' diff --git a/db/docs/cluster_projects.yml b/db/docs/cluster_projects.yml index ecc7680a205..51f996c0d5c 100644 --- a/db/docs/cluster_projects.yml +++ b/db/docs/cluster_projects.yml @@ -4,6 +4,6 @@ classes: - Clusters::Project feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) Join table between 'clusters' and 'projects' introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/d0cff7f5855f91b5479f9fdaa39d8d95ec691a9e milestone: '10.2' diff --git a/db/docs/cluster_providers_aws.yml b/db/docs/cluster_providers_aws.yml index 21a698c882a..1af9a814685 100644 --- a/db/docs/cluster_providers_aws.yml +++ b/db/docs/cluster_providers_aws.yml @@ -4,6 +4,6 @@ classes: - Clusters::Providers::Aws feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) AWS specific details for an EKS cluster integration introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17057 milestone: '12.4' diff --git a/db/docs/cluster_providers_gcp.yml b/db/docs/cluster_providers_gcp.yml index 7aa02089e6c..3ef9ebb995c 100644 --- a/db/docs/cluster_providers_gcp.yml +++ b/db/docs/cluster_providers_gcp.yml @@ -4,6 +4,6 @@ classes: - Clusters::Providers::Gcp feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) GCP specific details for a GKE cluster integration introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/d0cff7f5855f91b5479f9fdaa39d8d95ec691a9e milestone: '10.2' diff --git a/db/docs/clusters_applications_cert_managers.yml b/db/docs/clusters_applications_cert_managers.yml index 5b75dceb08e..bf85400c3ae 100644 --- a/db/docs/clusters_applications_cert_managers.yml +++ b/db/docs/clusters_applications_cert_managers.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::CertManager feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed cert-manager installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/8837519445c319a699e0f3ced1c6912c839f3389 milestone: '11.6' diff --git a/db/docs/clusters_applications_crossplane.yml b/db/docs/clusters_applications_crossplane.yml index 8bc2dde17f3..ef9bbed9415 100644 --- a/db/docs/clusters_applications_crossplane.yml +++ b/db/docs/clusters_applications_crossplane.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::Crossplane feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed Crossplane installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/18797 milestone: '12.5' diff --git a/db/docs/clusters_applications_elastic_stacks.yml b/db/docs/clusters_applications_elastic_stacks.yml index 1b1aa716afe..97943a9516b 100644 --- a/db/docs/clusters_applications_elastic_stacks.yml +++ b/db/docs/clusters_applications_elastic_stacks.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::ElasticStack feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed Elastic Stack installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/18015 milestone: '12.5' diff --git a/db/docs/clusters_applications_helm.yml b/db/docs/clusters_applications_helm.yml index 18bc1fa82b4..83014ab9221 100644 --- a/db/docs/clusters_applications_helm.yml +++ b/db/docs/clusters_applications_helm.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::Helm feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed Helm installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/64be8d70ae20928df351e495a3442bb6036bc3e7 milestone: '10.2' diff --git a/db/docs/clusters_applications_ingress.yml b/db/docs/clusters_applications_ingress.yml index 686b01e9bdb..73c0d8d7cb4 100644 --- a/db/docs/clusters_applications_ingress.yml +++ b/db/docs/clusters_applications_ingress.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::Ingress feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed Ingress installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/d8223468ae2ae061020cc26336c51dc93cc75571 milestone: '10.2' diff --git a/db/docs/clusters_applications_jupyter.yml b/db/docs/clusters_applications_jupyter.yml index bf793d9411e..faff294bf6b 100644 --- a/db/docs/clusters_applications_jupyter.yml +++ b/db/docs/clusters_applications_jupyter.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::Jupyter feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed Jupyter installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/db9f765852d9fef464e69c0bf47a382f2ab7219d milestone: '11.0' diff --git a/db/docs/clusters_applications_knative.yml b/db/docs/clusters_applications_knative.yml index a30df20c5cf..4d8d3a30ad5 100644 --- a/db/docs/clusters_applications_knative.yml +++ b/db/docs/clusters_applications_knative.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::Knative feature_categories: - kubernetes_management -description: TODO +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' diff --git a/db/docs/clusters_applications_runners.yml b/db/docs/clusters_applications_runners.yml index f26302c2d3c..06c43337b83 100644 --- a/db/docs/clusters_applications_runners.yml +++ b/db/docs/clusters_applications_runners.yml @@ -4,6 +4,6 @@ classes: - Clusters::Applications::Runner feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A GitLab managed Runner installation in a Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/c607008ee55e35465e04a938a341f2f24cb6761f milestone: '10.6' diff --git a/db/docs/clusters_kubernetes_namespaces.yml b/db/docs/clusters_kubernetes_namespaces.yml index 5027b6f27b4..0772f9ce877 100644 --- a/db/docs/clusters_kubernetes_namespaces.yml +++ b/db/docs/clusters_kubernetes_namespaces.yml @@ -4,6 +4,6 @@ classes: - Clusters::KubernetesNamespace feature_categories: - kubernetes_management -description: TODO +description: (Deprecated) A Kubernetes namespace in a GitLab managed Kubernetes cluster introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/e3ca493876ab71ed29817a0af436fc563f564bbe milestone: '11.5' diff --git a/db/docs/dast_profile_schedules.yml b/db/docs/dast_profile_schedules.yml index 088fba68cf4..820251d2e16 100644 --- a/db/docs/dast_profile_schedules.yml +++ b/db/docs/dast_profile_schedules.yml @@ -4,6 +4,6 @@ classes: - Dast::ProfileSchedule feature_categories: - dynamic_application_security_testing -description: TODO +description: Scheduling for scans using DAST Profiles introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65327 milestone: '14.2' diff --git a/db/docs/dast_profiles.yml b/db/docs/dast_profiles.yml index bc0791d2a43..bd909be59f1 100644 --- a/db/docs/dast_profiles.yml +++ b/db/docs/dast_profiles.yml @@ -4,6 +4,6 @@ classes: - Dast::Profile feature_categories: - dynamic_application_security_testing -description: TODO +description: Profile used to run a DAST on-demand scan introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51296 milestone: '13.9' diff --git a/db/docs/dast_profiles_pipelines.yml b/db/docs/dast_profiles_pipelines.yml index a457d0df726..3b972423083 100644 --- a/db/docs/dast_profiles_pipelines.yml +++ b/db/docs/dast_profiles_pipelines.yml @@ -4,6 +4,6 @@ classes: - Dast::ProfilesPipeline feature_categories: - dynamic_application_security_testing -description: TODO +description: Join table between DAST Profiles and CI Pipelines introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56821 milestone: '13.11' diff --git a/db/docs/dast_scanner_profiles.yml b/db/docs/dast_scanner_profiles.yml index f71e969e3c9..bb5850abbd2 100644 --- a/db/docs/dast_scanner_profiles.yml +++ b/db/docs/dast_scanner_profiles.yml @@ -4,6 +4,6 @@ classes: - DastScannerProfile feature_categories: - dynamic_application_security_testing -description: TODO +description: A scanner profile defines the scanner settings used to run an on-demand scan introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37404 milestone: '13.3' diff --git a/db/docs/dast_scanner_profiles_builds.yml b/db/docs/dast_scanner_profiles_builds.yml index f1edbb0df26..8beed026a0b 100644 --- a/db/docs/dast_scanner_profiles_builds.yml +++ b/db/docs/dast_scanner_profiles_builds.yml @@ -4,6 +4,6 @@ classes: - Dast::ScannerProfilesBuild feature_categories: - dynamic_application_security_testing -description: TODO +description: Join table between DAST Scanner Profiles and CI Builds introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63362 milestone: '14.1' diff --git a/db/docs/dast_site_profile_secret_variables.yml b/db/docs/dast_site_profile_secret_variables.yml index 6f99739e9ae..d1711d5f6e7 100644 --- a/db/docs/dast_site_profile_secret_variables.yml +++ b/db/docs/dast_site_profile_secret_variables.yml @@ -4,6 +4,6 @@ classes: - Dast::SiteProfileSecretVariable feature_categories: - dynamic_application_security_testing -description: TODO +description: Secret variables used in DAST on-demand scans introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56067 milestone: '13.11' diff --git a/db/docs/dast_site_profiles.yml b/db/docs/dast_site_profiles.yml index b68f5cd2368..a584a8eaf22 100644 --- a/db/docs/dast_site_profiles.yml +++ b/db/docs/dast_site_profiles.yml @@ -4,6 +4,6 @@ classes: - DastSiteProfile feature_categories: - dynamic_application_security_testing -description: TODO +description: A site profile describes the attributes of a web site to scan on demand with DAST introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36659 milestone: '13.2' diff --git a/db/docs/dast_site_profiles_builds.yml b/db/docs/dast_site_profiles_builds.yml index 31ec6e37c89..71bfea2e122 100644 --- a/db/docs/dast_site_profiles_builds.yml +++ b/db/docs/dast_site_profiles_builds.yml @@ -4,6 +4,6 @@ classes: - Dast::SiteProfilesBuild feature_categories: - dynamic_application_security_testing -description: TODO +description: Join table between DAST Site Profiles and CI Builds introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63362 milestone: '14.1' diff --git a/db/docs/dast_site_profiles_pipelines.yml b/db/docs/dast_site_profiles_pipelines.yml index ed5c0b78f6c..022b241934e 100644 --- a/db/docs/dast_site_profiles_pipelines.yml +++ b/db/docs/dast_site_profiles_pipelines.yml @@ -3,6 +3,6 @@ table_name: dast_site_profiles_pipelines classes: [] feature_categories: - dynamic_application_security_testing -description: TODO +description: Join table between DAST Site Profiles and CI Pipelines introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60090 milestone: '13.12' diff --git a/db/docs/dast_site_tokens.yml b/db/docs/dast_site_tokens.yml index 9891c9742a4..1d92bcd6981 100644 --- a/db/docs/dast_site_tokens.yml +++ b/db/docs/dast_site_tokens.yml @@ -4,6 +4,6 @@ classes: - DastSiteToken feature_categories: - dynamic_application_security_testing -description: TODO +description: Token for the site to be validated introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41639 milestone: '13.4' diff --git a/db/docs/dast_site_validations.yml b/db/docs/dast_site_validations.yml index 9e14ba276e4..cb42895bc6a 100644 --- a/db/docs/dast_site_validations.yml +++ b/db/docs/dast_site_validations.yml @@ -4,6 +4,6 @@ classes: - DastSiteValidation feature_categories: - dynamic_application_security_testing -description: TODO +description: The site to be validated with a dast_site_token introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41639 milestone: '13.4' diff --git a/db/docs/dast_sites.yml b/db/docs/dast_sites.yml index 8b739997022..63dcad7b35f 100644 --- a/db/docs/dast_sites.yml +++ b/db/docs/dast_sites.yml @@ -4,6 +4,6 @@ classes: - DastSite feature_categories: - dynamic_application_security_testing -description: TODO +description: Site to run dast scan on introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36659 milestone: '13.2' diff --git a/db/docs/deploy_keys_projects.yml b/db/docs/deploy_keys_projects.yml index 42d5c520db2..d308af56712 100644 --- a/db/docs/deploy_keys_projects.yml +++ b/db/docs/deploy_keys_projects.yml @@ -4,6 +4,6 @@ classes: - DeployKeysProject feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/user/project/deploy_keys/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/a735ce2aa7da72242629a4452c33e7a1900fdd62 milestone: "<6.0" diff --git a/db/docs/deploy_tokens.yml b/db/docs/deploy_tokens.yml index b39ccdef9e8..320fc9e2ba8 100644 --- a/db/docs/deploy_tokens.yml +++ b/db/docs/deploy_tokens.yml @@ -4,6 +4,6 @@ classes: - DeployToken feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/user/project/deploy_tokens/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/db18993f652425b72c4b854e18a002e0ec44b196 milestone: '10.7' diff --git a/db/docs/deployment_approvals.yml b/db/docs/deployment_approvals.yml index 3c04bff052a..1defeb8dbb5 100644 --- a/db/docs/deployment_approvals.yml +++ b/db/docs/deployment_approvals.yml @@ -3,7 +3,7 @@ table_name: deployment_approvals classes: - Deployments::Approval feature_categories: -- advanced_deployments -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/ci/environments/deployment_approvals.html introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74932 milestone: '14.6' diff --git a/db/docs/deployment_clusters.yml b/db/docs/deployment_clusters.yml index 454c93b34a1..e23278d0e00 100644 --- a/db/docs/deployment_clusters.yml +++ b/db/docs/deployment_clusters.yml @@ -3,7 +3,7 @@ table_name: deployment_clusters classes: - DeploymentCluster feature_categories: -- deployment_management -description: TODO +- kubernetes_management +description: (Deprecated) Join table between `deployments` and `clusters` introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24235 milestone: '12.8' diff --git a/db/docs/deployment_merge_requests.yml b/db/docs/deployment_merge_requests.yml index 33bce15b5c8..9af247a03d8 100644 --- a/db/docs/deployment_merge_requests.yml +++ b/db/docs/deployment_merge_requests.yml @@ -3,7 +3,7 @@ table_name: deployment_merge_requests classes: - DeploymentMergeRequest feature_categories: -- advanced_deployments -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/ci/environments/index.html#track-newly-included-merge-requests-per-deployment introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/18755 milestone: '12.5' diff --git a/db/docs/deployments.yml b/db/docs/deployments.yml index c5e402fb15f..960e2c67a1e 100644 --- a/db/docs/deployments.yml +++ b/db/docs/deployments.yml @@ -4,6 +4,6 @@ classes: - Deployment feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/ci/environments/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/907c0e6796b69f9577c147dd489cf55748c749ac milestone: '8.9' diff --git a/db/docs/dingtalk_tracker_data.yml b/db/docs/dingtalk_tracker_data.yml new file mode 100644 index 00000000000..b7335584271 --- /dev/null +++ b/db/docs/dingtalk_tracker_data.yml @@ -0,0 +1,8 @@ +--- +table_name: dingtalk_tracker_data +classes: +- Integrations::DingtalkTrackerData +feature_categories: +- integrations +description: Data related to the Dingtalk integration (JiHu-specific, see https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/417). +milestone: '15.0' diff --git a/db/docs/environments.yml b/db/docs/environments.yml index eb27637f1d5..08165712766 100644 --- a/db/docs/environments.yml +++ b/db/docs/environments.yml @@ -4,6 +4,6 @@ classes: - Environment feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/ci/environments/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/907c0e6796b69f9577c147dd489cf55748c749ac milestone: '8.9' diff --git a/db/docs/evidences.yml b/db/docs/evidences.yml index 6440681feec..ddfb42dd5a1 100644 --- a/db/docs/evidences.yml +++ b/db/docs/evidences.yml @@ -4,6 +4,6 @@ classes: - Releases::Evidence feature_categories: - release_evidence -description: TODO +description: https://docs.gitlab.com/ee/user/project/releases/#release-evidence introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17217 milestone: '12.4' diff --git a/db/docs/feature_gates.yml b/db/docs/feature_gates.yml index 5f405ed0f1a..19d74975c6e 100644 --- a/db/docs/feature_gates.yml +++ b/db/docs/feature_gates.yml @@ -5,6 +5,6 @@ classes: - Flipper::Adapters::ActiveRecord::Gate feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/development/feature_flags/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/671284ba375109becbfa2a288032cdc7301b157b milestone: '9.3' diff --git a/db/docs/features.yml b/db/docs/features.yml index 82598999b9e..f5628a17c19 100644 --- a/db/docs/features.yml +++ b/db/docs/features.yml @@ -5,6 +5,6 @@ classes: - Flipper::Adapters::ActiveRecord::Feature feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/development/feature_flags/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/ee2d3de1a634611a1c660516c955be0d3000904b milestone: '8.12' diff --git a/db/docs/geo_lfs_object_deleted_events.yml b/db/docs/geo_lfs_object_deleted_events.yml deleted file mode 100644 index 05cafd6d806..00000000000 --- a/db/docs/geo_lfs_object_deleted_events.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -table_name: geo_lfs_object_deleted_events -classes: [] -feature_categories: -- geo_replication -description: Geo event for when an LFS object gets deleted, belongs to geo_event_log. -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3481 -milestone: '10.2' diff --git a/db/docs/group_deploy_keys.yml b/db/docs/group_deploy_keys.yml index c96b6fd0470..0e85102dbb9 100644 --- a/db/docs/group_deploy_keys.yml +++ b/db/docs/group_deploy_keys.yml @@ -3,7 +3,7 @@ table_name: group_deploy_keys classes: - GroupDeployKey feature_categories: -- secrets_management -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/user/project/deploy_keys/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30886 milestone: '13.1' diff --git a/db/docs/group_deploy_keys_groups.yml b/db/docs/group_deploy_keys_groups.yml index c8c36cc16b4..3db288647f9 100644 --- a/db/docs/group_deploy_keys_groups.yml +++ b/db/docs/group_deploy_keys_groups.yml @@ -3,7 +3,7 @@ table_name: group_deploy_keys_groups classes: - GroupDeployKeysGroup feature_categories: -- advanced_deployments -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/user/project/deploy_keys/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32901 milestone: '13.2' diff --git a/db/docs/group_deploy_tokens.yml b/db/docs/group_deploy_tokens.yml index 4b8a4d4598f..6b497f59285 100644 --- a/db/docs/group_deploy_tokens.yml +++ b/db/docs/group_deploy_tokens.yml @@ -3,7 +3,7 @@ table_name: group_deploy_tokens classes: - GroupDeployToken feature_categories: -- secrets_management -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/user/project/deploy_tokens/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23460 milestone: '12.8' diff --git a/db/docs/issuable_resource_links.yml b/db/docs/issuable_resource_links.yml new file mode 100644 index 00000000000..e58355cadd6 --- /dev/null +++ b/db/docs/issuable_resource_links.yml @@ -0,0 +1,9 @@ +--- +table_name: issuable_resource_links +classes: +- IncidentManagement::IssuableResourceLink +feature_categories: +- incident_management +description: Persists resources links for an issuable, particularly incident. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88417 +milestone: '15.1' diff --git a/db/docs/milestone_releases.yml b/db/docs/milestone_releases.yml index a5c95b086dd..de2b6a9cfbc 100644 --- a/db/docs/milestone_releases.yml +++ b/db/docs/milestone_releases.yml @@ -4,6 +4,6 @@ classes: - MilestoneRelease feature_categories: - release_orchestration -description: TODO +description: https://docs.gitlab.com/ee/user/project/releases/#associate-milestones-with-a-release introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/a43ab8d6a430014e875deb3bff3fd8d8da256747 milestone: '12.3' diff --git a/db/docs/operations_feature_flag_scopes.yml b/db/docs/operations_feature_flag_scopes.yml index 05ff4882394..ac1665fb3a6 100644 --- a/db/docs/operations_feature_flag_scopes.yml +++ b/db/docs/operations_feature_flag_scopes.yml @@ -3,6 +3,6 @@ table_name: operations_feature_flag_scopes classes: [] feature_categories: - feature_flags -description: TODO +description: Deprecated in favor of `operations_scopes`. To be dropped. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/9110 milestone: '11.8' diff --git a/db/docs/operations_feature_flags_clients.yml b/db/docs/operations_feature_flags_clients.yml index ab5f8e5597b..f8f04cadbb7 100644 --- a/db/docs/operations_feature_flags_clients.yml +++ b/db/docs/operations_feature_flags_clients.yml @@ -4,6 +4,6 @@ classes: - Operations::FeatureFlagsClient feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/operations/feature_flags.html introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/7433 milestone: '11.4' diff --git a/db/docs/operations_feature_flags_issues.yml b/db/docs/operations_feature_flags_issues.yml index 660c8161a08..6b62629a38d 100644 --- a/db/docs/operations_feature_flags_issues.yml +++ b/db/docs/operations_feature_flags_issues.yml @@ -4,6 +4,6 @@ classes: - FeatureFlagIssue feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/operations/feature_flags.html#feature-flag-related-issues introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32876 milestone: '13.1' diff --git a/db/docs/operations_scopes.yml b/db/docs/operations_scopes.yml index 12b8f5b740b..781b0a459ab 100644 --- a/db/docs/operations_scopes.yml +++ b/db/docs/operations_scopes.yml @@ -4,6 +4,6 @@ classes: - Operations::FeatureFlags::Scope feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/operations/feature_flags.html#feature-flag-strategies introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24819 milestone: '12.8' diff --git a/db/docs/operations_strategies.yml b/db/docs/operations_strategies.yml index 8eb16d28e46..c21859e2de6 100644 --- a/db/docs/operations_strategies.yml +++ b/db/docs/operations_strategies.yml @@ -4,6 +4,6 @@ classes: - Operations::FeatureFlags::Strategy feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/operations/feature_flags.html#feature-flag-strategies introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24819 milestone: '12.8' diff --git a/db/docs/operations_strategies_user_lists.yml b/db/docs/operations_strategies_user_lists.yml index d56950b877c..ec8062ab57c 100644 --- a/db/docs/operations_strategies_user_lists.yml +++ b/db/docs/operations_strategies_user_lists.yml @@ -4,6 +4,6 @@ classes: - Operations::FeatureFlags::StrategyUserList feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/operations/feature_flags.html#user-list introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30243 milestone: '13.0' diff --git a/db/docs/operations_user_lists.yml b/db/docs/operations_user_lists.yml index 68af1fae839..af1e091ee45 100644 --- a/db/docs/operations_user_lists.yml +++ b/db/docs/operations_user_lists.yml @@ -4,6 +4,6 @@ classes: - Operations::FeatureFlags::UserList feature_categories: - feature_flags -description: TODO +description: https://docs.gitlab.com/ee/operations/feature_flags.html#user-list introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28822 milestone: '13.0' diff --git a/db/docs/project_auto_devops.yml b/db/docs/project_auto_devops.yml index 86841b585c3..dd960ecc4eb 100644 --- a/db/docs/project_auto_devops.yml +++ b/db/docs/project_auto_devops.yml @@ -4,6 +4,6 @@ classes: - ProjectAutoDevops feature_categories: - auto_devops -description: TODO +description: Auto DevOps settings for a project introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/6ed490401f49a8941dc7a9e3757ec4012f14ef0b milestone: '10.0' diff --git a/db/docs/project_ci_cd_settings.yml b/db/docs/project_ci_cd_settings.yml index 48c1ab42e73..a736cf6a8dc 100644 --- a/db/docs/project_ci_cd_settings.yml +++ b/db/docs/project_ci_cd_settings.yml @@ -4,6 +4,8 @@ classes: - ProjectCiCdSetting feature_categories: - continuous_integration -description: TODO +- continuous_delivery +- runner_fleet +description: Project-scoped settings related to the CI/CD domain introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/392c411bdc16386ef42c86afaf8c4d8e4cddb955 milestone: '10.8' diff --git a/db/docs/project_deploy_tokens.yml b/db/docs/project_deploy_tokens.yml index 6f46af5d2e9..12e565bf4de 100644 --- a/db/docs/project_deploy_tokens.yml +++ b/db/docs/project_deploy_tokens.yml @@ -3,7 +3,7 @@ table_name: project_deploy_tokens classes: - ProjectDeployToken feature_categories: -- advanced_deployments -description: TODO +- continuous_delivery +description: https://docs.gitlab.com/ee/user/project/deploy_tokens/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/8315861c9a50675b4f4f4ca536f0da90f27994f3 milestone: '10.7' diff --git a/db/docs/protected_environment_approval_rules.yml b/db/docs/protected_environment_approval_rules.yml index ea7f0e1d05d..fe3d9d7ad08 100644 --- a/db/docs/protected_environment_approval_rules.yml +++ b/db/docs/protected_environment_approval_rules.yml @@ -4,6 +4,6 @@ classes: - ProtectedEnvironments::ApprovalRule feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/ci/environments/deployment_approvals.html#multiple-approval-rules introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82800 milestone: '14.10' diff --git a/db/docs/protected_environment_deploy_access_levels.yml b/db/docs/protected_environment_deploy_access_levels.yml index e8b10ba099e..cd3bba9171f 100644 --- a/db/docs/protected_environment_deploy_access_levels.yml +++ b/db/docs/protected_environment_deploy_access_levels.yml @@ -4,6 +4,6 @@ classes: - ProtectedEnvironment::DeployAccessLevel feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/ci/environments/protected_environments.html introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6672 milestone: '11.3' diff --git a/db/docs/protected_environments.yml b/db/docs/protected_environments.yml index 92b6cdcc1f7..6a0d18ee4b5 100644 --- a/db/docs/protected_environments.yml +++ b/db/docs/protected_environments.yml @@ -4,6 +4,6 @@ classes: - ProtectedEnvironment feature_categories: - continuous_delivery -description: TODO +description: https://docs.gitlab.com/ee/ci/environments/protected_environments.html introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6672 milestone: '11.3' diff --git a/db/docs/release_links.yml b/db/docs/release_links.yml index b4fc4f4b043..03fa9e2bbbb 100644 --- a/db/docs/release_links.yml +++ b/db/docs/release_links.yml @@ -4,6 +4,6 @@ classes: - Releases::Link feature_categories: - release_orchestration -description: TODO +description: https://docs.gitlab.com/ee/user/project/releases/#links introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/66755c9ed506af9f51022a678ed26e5d31ee87ac milestone: '11.7' diff --git a/db/docs/releases.yml b/db/docs/releases.yml index 0c496b7355f..da4fbfe830f 100644 --- a/db/docs/releases.yml +++ b/db/docs/releases.yml @@ -4,6 +4,6 @@ classes: - Release feature_categories: - release_orchestration -description: TODO +description: https://docs.gitlab.com/ee/user/project/releases introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1c4d1c3bd69a6f9ec43cce4ab59de4ba47f73229 milestone: '8.2' diff --git a/db/docs/serverless_domain_cluster.yml b/db/docs/serverless_domain_cluster.yml index d41f8b45c27..2692eb22096 100644 --- a/db/docs/serverless_domain_cluster.yml +++ b/db/docs/serverless_domain_cluster.yml @@ -3,7 +3,7 @@ table_name: serverless_domain_cluster classes: - Serverless::DomainCluster feature_categories: -- deployment_management -description: TODO +- kubernetes_management +description: (Deprecated) A custom domain for a GitLab managed Knative installation introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/19835 milestone: '12.6' diff --git a/db/docs/ssh_signatures.yml b/db/docs/ssh_signatures.yml new file mode 100644 index 00000000000..7907f335585 --- /dev/null +++ b/db/docs/ssh_signatures.yml @@ -0,0 +1,11 @@ +--- +table_name: ssh_signatures +classes: +- CommitSignatures::SshSignature +feature_categories: +- source_code_management +description: > + The verification status for commits which are signed by SSH keys. The actual signature + is part of the commit body and is stored in Gitaly. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87962 +milestone: '15.1' diff --git a/db/docs/subscriptions.yml b/db/docs/subscriptions.yml index 524ca06f34f..0f20343bb5e 100644 --- a/db/docs/subscriptions.yml +++ b/db/docs/subscriptions.yml @@ -3,7 +3,7 @@ table_name: subscriptions classes: - Subscription feature_categories: -- continuous_integration -description: TODO +- team_planning +description: Subscriptions between users and subscribable objects; such as issues, epics and MRs. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/410d25c8ca8afabb25e5f89b36e3cfd09ffe6f87 milestone: '7.9' diff --git a/db/docs/terraform_state_versions.yml b/db/docs/terraform_state_versions.yml index a812d2a209e..1d98b049f45 100644 --- a/db/docs/terraform_state_versions.yml +++ b/db/docs/terraform_state_versions.yml @@ -4,6 +4,6 @@ classes: - Terraform::StateVersion feature_categories: - infrastructure_as_code -description: TODO +description: Represents a Terraform state file at a point in time, with a corresponding file stored in object storage introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35211 milestone: '13.4' diff --git a/db/docs/terraform_states.yml b/db/docs/terraform_states.yml index 78a277cafd6..dc2bc799582 100644 --- a/db/docs/terraform_states.yml +++ b/db/docs/terraform_states.yml @@ -4,6 +4,6 @@ classes: - Terraform::State feature_categories: - infrastructure_as_code -description: TODO +description: Represents a Terraform state backend introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26619 milestone: '13.0' diff --git a/db/docs/timelog_categories.yml b/db/docs/timelog_categories.yml new file mode 100644 index 00000000000..7be6c588f0e --- /dev/null +++ b/db/docs/timelog_categories.yml @@ -0,0 +1,9 @@ +--- +table_name: timelog_categories +classes: +- TimelogCategory +feature_categories: +- team_planning +description: Categories that can be associated to a timelog to categorize them +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87529 +milestone: '15.1' diff --git a/db/docs/uploads.yml b/db/docs/uploads.yml index 8cc557280e8..53cfd49839a 100644 --- a/db/docs/uploads.yml +++ b/db/docs/uploads.yml @@ -3,7 +3,13 @@ table_name: uploads classes: - Upload feature_categories: -- backup_restore -description: TODO +- code_review +- design_management +- importers +- portfolio_management +- projects +- snippets +- team_planning +description: For tracking blob metadata. Single table inheritance is used to relate this table to many other tables. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/4c622b71fd284058deee483bf0009f8179b792bc milestone: '9.0' diff --git a/db/docs/users_ops_dashboard_projects.yml b/db/docs/users_ops_dashboard_projects.yml index ba3f07609e2..d8854d1db45 100644 --- a/db/docs/users_ops_dashboard_projects.yml +++ b/db/docs/users_ops_dashboard_projects.yml @@ -3,7 +3,7 @@ table_name: users_ops_dashboard_projects classes: - UsersOpsDashboardProject feature_categories: -- release_orchestration -description: TODO +- environment_management +description: https://docs.gitlab.com/ee/user/operations_dashboard/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/7341 milestone: '11.5' diff --git a/db/docs/vulnerability_state_transitions.yml b/db/docs/vulnerability_state_transitions.yml new file mode 100644 index 00000000000..908b4120b47 --- /dev/null +++ b/db/docs/vulnerability_state_transitions.yml @@ -0,0 +1,9 @@ +--- +table_name: vulnerability_state_transitions +classes: + - Vulnerabilities::VulnerabilityStateTransition +feature_categories: + - vulnerability_management +description: Stores state transitions of a Vulnerability +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87957 +milestone: '15.1' diff --git a/db/docs/work_item_parent_links.yml b/db/docs/work_item_parent_links.yml new file mode 100644 index 00000000000..f4b5cd20abb --- /dev/null +++ b/db/docs/work_item_parent_links.yml @@ -0,0 +1,10 @@ +--- +table_name: work_item_parent_links +classes: +- WorkItem +- WorkItems::ParentLink +feature_categories: +- team_planning +description: Persists link between work item and its parent. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87283 +milestone: '15.1' diff --git a/db/fixtures/development/04_labels.rb b/db/fixtures/development/04_labels.rb index 5f0d7f2d8be..0a09e8684e3 100644 --- a/db/fixtures/development/04_labels.rb +++ b/db/fixtures/development/04_labels.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'digest/md5' - class Gitlab::Seeder::GroupLabels def initialize(group, label_per_group: 10) @group = group diff --git a/db/fixtures/development/12_snippets.rb b/db/fixtures/development/12_snippets.rb index 6d31007b320..24500aa3e7d 100644 --- a/db/fixtures/development/12_snippets.rb +++ b/db/fixtures/development/12_snippets.rb @@ -35,6 +35,8 @@ Gitlab::Seeder.quiet do visibility_level: Gitlab::VisibilityLevel.values.sample, content: 'foo' }).tap do |snippet| + snippet.repository.expire_exists_cache + unless snippet.repository_exists? Gitlab::Seeder::SnippetRepository.new(snippet).import end @@ -48,4 +50,3 @@ Gitlab::Seeder.quiet do Gitlab::Seeder::SnippetRepository.cleanup end - diff --git a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb index 63ac308e4be..778e186eb9c 100644 --- a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb +++ b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillTaggingsForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :taggings COLUMNS = %i(id taggable_id) diff --git a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb index 6de89cadef8..0795abf19d4 100644 --- a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb +++ b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillDeploymentsForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :deployments COLUMNS = %i(deployable_id) diff --git a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb index eab79a33006..c2845760b5c 100644 --- a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb +++ b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillGeoJobArtifactDeletedEventsForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :geo_job_artifact_deleted_events COLUMNS = %i(job_artifact_id) diff --git a/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb b/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb index 6376305c784..4a52600d4c7 100644 --- a/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb +++ b/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiStagesForBigintConversion < ActiveRecord::Migration[6.1] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :ci_stages COLUMNS = %i(id) diff --git a/db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb b/db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb new file mode 100644 index 00000000000..a3d71a060b8 --- /dev/null +++ b/db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class ChangeMaintainerNoteLimitInCiRunner < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_text_limit( + :ci_runners, + :maintainer_note, + 1024, + constraint_name: check_constraint_name(:ci_runners, :maintainer_note, 'max_length_1MB') + ) + + remove_text_limit( + :ci_runners, + :maintainer_note, + constraint_name: check_constraint_name(:ci_runners, :maintainer_note, 'max_length') + ) + end + + def down + # no-op: Danger of failing if there are records with length(maintainer_note) > 255 + end +end diff --git a/db/migrate/20220221102333_change_maintenance_note_limit_in_ci_runner.rb db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb b/db/migrate/20220221102333_change_maintenance_note_limit_in_ci_runner.rb db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb deleted file mode 100644 index 98930691b3b..00000000000 --- a/db/migrate/20220221102333_change_maintenance_note_limit_in_ci_runner.rb db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class ChangeMaintainerNoteLimitInCiRunner < Gitlab::Database::Migration[1.0] - disable_ddl_transaction! - - def up - add_text_limit :ci_runners, :maintainer_note, 1024, constraint_name: check_constraint_name(:ci_runners, :maintainer_note, 'max_length_1MB') - remove_text_limit :ci_runners, :maintainer_note, constraint_name: check_constraint_name(:ci_runners, :maintainer_note, 'max_length') - end - - def down - # no-op: Danger of failing if there are records with length(maintainer_note) > 255 - end -end diff --git a/db/migrate/20220314094841_add_package_registry_access_level_into_project_features.rb b/db/migrate/20220314094841_add_package_registry_access_level_into_project_features.rb new file mode 100644 index 00000000000..4effdfa6a5e --- /dev/null +++ b/db/migrate/20220314094841_add_package_registry_access_level_into_project_features.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddPackageRegistryAccessLevelIntoProjectFeatures < Gitlab::Database::Migration[1.0] + DISABLED = 0 # ProjectFeature::DISABLED + + def up + add_column :project_features, :package_registry_access_level, :integer, default: DISABLED, null: false + end + + def down + remove_column :project_features, :package_registry_access_level + end +end diff --git a/db/migrate/20220329092245_add_password_chars_requirement_to_application_settings.rb b/db/migrate/20220329092245_add_password_chars_requirement_to_application_settings.rb new file mode 100644 index 00000000000..152ee10df74 --- /dev/null +++ b/db/migrate/20220329092245_add_password_chars_requirement_to_application_settings.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddPasswordCharsRequirementToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + add_column :application_settings, :password_uppercase_required, :boolean, default: false, null: false + add_column :application_settings, :password_lowercase_required, :boolean, default: false, null: false + add_column :application_settings, :password_number_required, :boolean, default: false, null: false + add_column :application_settings, :password_symbol_required, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20220503035221_add_gitlab_schema_to_batched_background_migrations.rb b/db/migrate/20220503035221_add_gitlab_schema_to_batched_background_migrations.rb new file mode 100644 index 00000000000..eaebe979ff3 --- /dev/null +++ b/db/migrate/20220503035221_add_gitlab_schema_to_batched_background_migrations.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddGitlabSchemaToBatchedBackgroundMigrations < Gitlab::Database::Migration[2.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20220503035437_add_text_limit_to_batched_background_migrations_gitlab_schema + def change + add_column :batched_background_migrations, :gitlab_schema, :text, null: false, default: :gitlab_main + change_column_default(:batched_background_migrations, :gitlab_schema, from: :gitlab_main, to: nil) + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20220503035437_add_text_limit_to_batched_background_migrations_gitlab_schema.rb b/db/migrate/20220503035437_add_text_limit_to_batched_background_migrations_gitlab_schema.rb new file mode 100644 index 00000000000..d5629cd1b8d --- /dev/null +++ b/db/migrate/20220503035437_add_text_limit_to_batched_background_migrations_gitlab_schema.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToBatchedBackgroundMigrationsGitlabSchema < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :batched_background_migrations, :gitlab_schema, 255 + end + + def down + remove_text_limit :batched_background_migrations, :gitlab_schema + end +end diff --git a/db/migrate/20220511144946_add_work_item_parent_child_table.rb b/db/migrate/20220511144946_add_work_item_parent_child_table.rb new file mode 100644 index 00000000000..160dac78160 --- /dev/null +++ b/db/migrate/20220511144946_add_work_item_parent_child_table.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddWorkItemParentChildTable < Gitlab::Database::Migration[2.0] + def up + create_table :work_item_parent_links do |t| + t.references :work_item, + index: false, + unique: true, + foreign_key: { to_table: :issues, on_delete: :cascade }, + null: false + t.references :work_item_parent, + index: true, + foreign_key: { to_table: :issues, on_delete: :cascade }, + null: false + t.integer :relative_position + t.timestamps_with_timezone null: false + + t.index [:work_item_id, :work_item_parent_id], + unique: true, + name: :index_parent_links_on_work_item_id_and_work_item_parent_id + end + end + + def down + drop_table :work_item_parent_links + end +end diff --git a/db/migrate/20220512020500_index_batched_migrations_on_gitlab_schema_and_configuration.rb b/db/migrate/20220512020500_index_batched_migrations_on_gitlab_schema_and_configuration.rb new file mode 100644 index 00000000000..077a60856cd --- /dev/null +++ b/db/migrate/20220512020500_index_batched_migrations_on_gitlab_schema_and_configuration.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class IndexBatchedMigrationsOnGitlabSchemaAndConfiguration < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = :batched_background_migrations + INDEX_NAME = 'index_batched_migrations_on_gl_schema_and_unique_configuration' + + def up + add_concurrent_index TABLE_NAME, + %i[gitlab_schema job_class_name table_name column_name job_arguments], + unique: true, + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/migrate/20220513093614_add_ding_talk_into_application_settings.rb b/db/migrate/20220513093614_add_ding_talk_into_application_settings.rb new file mode 100644 index 00000000000..5a34200a3c8 --- /dev/null +++ b/db/migrate/20220513093614_add_ding_talk_into_application_settings.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddDingTalkIntoApplicationSettings < Gitlab::Database::Migration[2.0] + def change + add_column :application_settings, :dingtalk_integration_enabled, :boolean, null: false, + default: false, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_dingtalk_corpid, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_dingtalk_corpid_iv, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_dingtalk_app_key, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_dingtalk_app_key_iv, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_dingtalk_app_secret, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_dingtalk_app_secret_iv, :binary, comment: 'JiHu-specific column' + end +end diff --git a/db/migrate/20220513093615_add_ding_talk_tracker_data.rb b/db/migrate/20220513093615_add_ding_talk_tracker_data.rb new file mode 100644 index 00000000000..0a9c340fbf0 --- /dev/null +++ b/db/migrate/20220513093615_add_ding_talk_tracker_data.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddDingTalkTrackerData < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_on_dingtalk_tracker_data_corpid' + + def change + create_table :dingtalk_tracker_data, comment: 'JiHu-specific table' do |t| + t.references :integration, foreign_key: { on_delete: :cascade }, + type: :bigint, index: true, null: false, comment: 'JiHu-specific column' + t.timestamps_with_timezone + t.text :corpid, comment: 'JiHu-specific column', limit: 255 + t.index :corpid, where: "(corpid IS NOT NULL)", name: INDEX_NAME, comment: 'JiHu-specific index' + end + end +end diff --git a/db/migrate/20220513095545_create_timelog_categories.rb b/db/migrate/20220513095545_create_timelog_categories.rb new file mode 100644 index 00000000000..aaf4a833ce0 --- /dev/null +++ b/db/migrate/20220513095545_create_timelog_categories.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class CreateTimelogCategories < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + create_table :timelog_categories do |t| + t.references :namespace, + index: false, + null: false, + foreign_key: { on_delete: :cascade } + t.timestamps_with_timezone null: false + t.decimal :billing_rate, precision: 18, scale: 4, default: 0 + t.boolean :billable, default: false, null: false + t.text :name, null: false, limit: 255 + t.text :description, limit: 1024 + t.text :color, limit: 7, default: '#6699cc', null: false + + t.index 'namespace_id, LOWER(name)', + unique: true, + name: :index_timelog_categories_on_unique_name_per_namespace + end + end + + def down + drop_table :timelog_categories + end +end diff --git a/db/migrate/20220513114706_add_jira_connect_application_id_application_setting.rb b/db/migrate/20220513114706_add_jira_connect_application_id_application_setting.rb new file mode 100644 index 00000000000..2557ec94167 --- /dev/null +++ b/db/migrate/20220513114706_add_jira_connect_application_id_application_setting.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddJiraConnectApplicationIdApplicationSetting < Gitlab::Database::Migration[2.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20220513114850_add_text_limit_to_jira_connect_application_id_application_setting.rb + def change + add_column :application_settings, :jira_connect_application_key, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20220513114850_add_text_limit_to_jira_connect_application_id_application_setting.rb b/db/migrate/20220513114850_add_text_limit_to_jira_connect_application_id_application_setting.rb new file mode 100644 index 00000000000..a379a273bb6 --- /dev/null +++ b/db/migrate/20220513114850_add_text_limit_to_jira_connect_application_id_application_setting.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToJiraConnectApplicationIdApplicationSetting < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :jira_connect_application_key, 255 + end + + def down + remove_text_limit :application_settings, :jira_connect_application_key + end +end diff --git a/db/migrate/20220516054002_temp_index_for_project_namespace_member_backfill.rb b/db/migrate/20220516054002_temp_index_for_project_namespace_member_backfill.rb new file mode 100644 index 00000000000..fc2fef582f5 --- /dev/null +++ b/db/migrate/20220516054002_temp_index_for_project_namespace_member_backfill.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class TempIndexForProjectNamespaceMemberBackfill < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_for_namespace_id_migration_on_project_members' + + disable_ddl_transaction! + + def up + # Temporary index to be removed in future + # https://gitlab.com/gitlab-org/gitlab/-/issues/356509 + add_concurrent_index :members, :id, + where: "members.member_namespace_id IS NULL and members.type = 'ProjectMember'", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :members, INDEX_NAME + end +end diff --git a/db/migrate/20220516092207_add_globally_allowed_ips_to_application_setting.rb b/db/migrate/20220516092207_add_globally_allowed_ips_to_application_setting.rb new file mode 100644 index 00000000000..895400aedc4 --- /dev/null +++ b/db/migrate/20220516092207_add_globally_allowed_ips_to_application_setting.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +class AddGloballyAllowedIpsToApplicationSetting < Gitlab::Database::Migration[2.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings + def change + add_column :application_settings, :globally_allowed_ips, :text, null: false, default: "" + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings.rb b/db/migrate/20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings.rb new file mode 100644 index 00000000000..887a7da0a74 --- /dev/null +++ b/db/migrate/20220516123101_add_text_limit_to_globally_allowed_ips_on_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToGloballyAllowedIpsOnApplicationSettings < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :globally_allowed_ips, 255 + end + + def down + remove_text_limit :application_settings, :globally_allowed_ips + end +end diff --git a/db/migrate/20220516201245_add_security_policy_scan_execution_schedules_to_plan_limits.rb b/db/migrate/20220516201245_add_security_policy_scan_execution_schedules_to_plan_limits.rb new file mode 100644 index 00000000000..733ac971b98 --- /dev/null +++ b/db/migrate/20220516201245_add_security_policy_scan_execution_schedules_to_plan_limits.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddSecurityPolicyScanExecutionSchedulesToPlanLimits < Gitlab::Database::Migration[2.0] + def up + add_column(:plan_limits, :security_policy_scan_execution_schedules, :integer, default: 0, null: false) + end + + def down + remove_column(:plan_limits, :security_policy_scan_execution_schedules) + end +end diff --git a/db/migrate/20220517182529_create_vulnerability_state_transition.rb b/db/migrate/20220517182529_create_vulnerability_state_transition.rb new file mode 100644 index 00000000000..6ffa10ae597 --- /dev/null +++ b/db/migrate/20220517182529_create_vulnerability_state_transition.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateVulnerabilityStateTransition < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + create_table :vulnerability_state_transitions do |t| + t.references :vulnerability, index: true, null: false, foreign_key: { on_delete: :cascade } + t.integer :to_state, limit: 2, null: false + t.integer :from_state, limit: 2, null: false + t.timestamps_with_timezone null: false + end + end + + def down + drop_table :vulnerability_state_transitions + end +end diff --git a/db/migrate/20220518183504_create_ssh_signatures.rb b/db/migrate/20220518183504_create_ssh_signatures.rb new file mode 100644 index 00000000000..6708d3f295c --- /dev/null +++ b/db/migrate/20220518183504_create_ssh_signatures.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class CreateSshSignatures < Gitlab::Database::Migration[2.0] + def change + create_table :ssh_signatures do |t| + t.timestamps_with_timezone null: false + t.bigint :project_id, null: false, index: true + t.bigint :key_id, null: false, index: true + t.integer :verification_status, default: 0, null: false, limit: 2 + t.binary :commit_sha, null: false, index: { unique: true } + end + end +end diff --git a/db/migrate/20220518183548_add_projects_relation_to_ssh_signatures.rb b/db/migrate/20220518183548_add_projects_relation_to_ssh_signatures.rb new file mode 100644 index 00000000000..459d1bc4bf9 --- /dev/null +++ b/db/migrate/20220518183548_add_projects_relation_to_ssh_signatures.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddProjectsRelationToSshSignatures < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :ssh_signatures, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :ssh_signatures, column: :project_id + end + end +end diff --git a/db/migrate/20220519013213_create_cluster_enabled_grants.rb b/db/migrate/20220519013213_create_cluster_enabled_grants.rb new file mode 100644 index 00000000000..45c18ecca45 --- /dev/null +++ b/db/migrate/20220519013213_create_cluster_enabled_grants.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class CreateClusterEnabledGrants < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + create_table :cluster_enabled_grants do |t| + t.references :namespace, index: { unique: true }, null: false, foreign_key: { on_delete: :cascade } + t.datetime_with_timezone :created_at, null: false + end + end +end diff --git a/db/migrate/20220519141345_add_job_artifact_id_on_refresh_start_to_build_artifacts_size_refresh.rb b/db/migrate/20220519141345_add_job_artifact_id_on_refresh_start_to_build_artifacts_size_refresh.rb new file mode 100644 index 00000000000..ee19fd9da23 --- /dev/null +++ b/db/migrate/20220519141345_add_job_artifact_id_on_refresh_start_to_build_artifacts_size_refresh.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddJobArtifactIdOnRefreshStartToBuildArtifactsSizeRefresh < Gitlab::Database::Migration[2.0] + def change + add_column :project_build_artifacts_size_refreshes, :last_job_artifact_id_on_refresh_start, :bigint, default: 0 + end +end diff --git a/db/migrate/20220520030504_drop_index_namespaces_on_name.rb b/db/migrate/20220520030504_drop_index_namespaces_on_name.rb new file mode 100644 index 00000000000..74019f726aa --- /dev/null +++ b/db/migrate/20220520030504_drop_index_namespaces_on_name.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropIndexNamespacesOnName < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_namespaces_on_name' + + def up + remove_concurrent_index_by_name :namespaces, INDEX_NAME, if_exists: true + end + + def down + # no-op + end +end diff --git a/db/migrate/20220520122755_unlock_delayed_project_removal.rb b/db/migrate/20220520122755_unlock_delayed_project_removal.rb new file mode 100644 index 00000000000..aaecf601e2b --- /dev/null +++ b/db/migrate/20220520122755_unlock_delayed_project_removal.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class UnlockDelayedProjectRemoval < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class ApplicationSetting < MigrationRecord + self.table_name = 'application_settings' + end + + # As part of https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86568 the + # lock_delayed_project_removal setting is updated for the first time. No up + # migration is needed because the column existsted. However a down migration + # is needed to disable the settting because users would have no way to edit it + # and would have the cascading setting permanently locked on groups. + + def up + # no-op + end + + def down + ApplicationSetting.reset_column_information + + ApplicationSetting.update_all(lock_delayed_project_removal: false) + end +end diff --git a/db/migrate/20220520143105_add_keys_relation_to_ssh_signatures.rb b/db/migrate/20220520143105_add_keys_relation_to_ssh_signatures.rb new file mode 100644 index 00000000000..15fc3e19439 --- /dev/null +++ b/db/migrate/20220520143105_add_keys_relation_to_ssh_signatures.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddKeysRelationToSshSignatures < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :ssh_signatures, :keys, column: :key_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :ssh_signatures, column: :key_id + end + end +end diff --git a/db/migrate/20220520144821_add_registry_migration_pre_import_tags_rate_to_application_settings.rb b/db/migrate/20220520144821_add_registry_migration_pre_import_tags_rate_to_application_settings.rb new file mode 100644 index 00000000000..f9451b38b82 --- /dev/null +++ b/db/migrate/20220520144821_add_registry_migration_pre_import_tags_rate_to_application_settings.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddRegistryMigrationPreImportTagsRateToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + add_column :application_settings, :container_registry_pre_import_tags_rate, + :decimal, + precision: 6, + scale: 2, + default: 0.5, + null: false + end +end diff --git a/db/migrate/20220523030804_add_web_hook_calls_med_and_max_to_plan_limits.rb b/db/migrate/20220523030804_add_web_hook_calls_med_and_max_to_plan_limits.rb new file mode 100644 index 00000000000..c1ed306551f --- /dev/null +++ b/db/migrate/20220523030804_add_web_hook_calls_med_and_max_to_plan_limits.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddWebHookCallsMedAndMaxToPlanLimits < Gitlab::Database::Migration[2.0] + def change + add_column :plan_limits, :web_hook_calls_mid, :integer, null: false, default: 0 + add_column :plan_limits, :web_hook_calls_low, :integer, null: false, default: 0 + end +end diff --git a/db/migrate/20220523030805_add_web_hook_calls_to_plan_limits_paid_tiers.rb b/db/migrate/20220523030805_add_web_hook_calls_to_plan_limits_paid_tiers.rb new file mode 100644 index 00000000000..842bb297803 --- /dev/null +++ b/db/migrate/20220523030805_add_web_hook_calls_to_plan_limits_paid_tiers.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +class AddWebHookCallsToPlanLimitsPaidTiers < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MAX_RATE_LIMIT_NAME = 'web_hook_calls' + MID_RATE_LIMIT_NAME = 'web_hook_calls_mid' + MIN_RATE_LIMIT_NAME = 'web_hook_calls_low' + + UP_FREE_LIMITS = { + MAX_RATE_LIMIT_NAME => 500, + MID_RATE_LIMIT_NAME => 500, + MIN_RATE_LIMIT_NAME => 500 + }.freeze + + UP_PREMIUM_LIMITS = { + MAX_RATE_LIMIT_NAME => 4_000, + MID_RATE_LIMIT_NAME => 2_800, + MIN_RATE_LIMIT_NAME => 1_600 + }.freeze + + UP_ULTIMATE_LIMITS = { + MAX_RATE_LIMIT_NAME => 13_000, + MID_RATE_LIMIT_NAME => 9_000, + MIN_RATE_LIMIT_NAME => 6_000 + }.freeze + + DOWN_FREE_LIMITS = { + # 120 is the value for 'free' migrated in `db/migrate/20210601131742_update_web_hook_calls_limit.rb` + MAX_RATE_LIMIT_NAME => 120, + MID_RATE_LIMIT_NAME => 0, + MIN_RATE_LIMIT_NAME => 0 + }.freeze + + DOWN_PAID_LIMITS = { + MAX_RATE_LIMIT_NAME => 0, + MID_RATE_LIMIT_NAME => 0, + MIN_RATE_LIMIT_NAME => 0 + }.freeze + + def up + return unless Gitlab.com? + + apply_limits('free', UP_FREE_LIMITS) + + # Apply Premium limits + apply_limits('bronze', UP_PREMIUM_LIMITS) + apply_limits('silver', UP_PREMIUM_LIMITS) + apply_limits('premium', UP_PREMIUM_LIMITS) + apply_limits('premium_trial', UP_PREMIUM_LIMITS) + + # Apply Ultimate limits + apply_limits('gold', UP_ULTIMATE_LIMITS) + apply_limits('ultimate', UP_ULTIMATE_LIMITS) + apply_limits('ultimate_trial', UP_ULTIMATE_LIMITS) + apply_limits('opensource', UP_ULTIMATE_LIMITS) + end + + def down + return unless Gitlab.com? + + apply_limits('free', DOWN_FREE_LIMITS) + + apply_limits('bronze', DOWN_PAID_LIMITS) + apply_limits('silver', DOWN_PAID_LIMITS) + apply_limits('premium', DOWN_PAID_LIMITS) + apply_limits('premium_trial', DOWN_PAID_LIMITS) + apply_limits('gold', DOWN_PAID_LIMITS) + apply_limits('ultimate', DOWN_PAID_LIMITS) + apply_limits('ultimate_trial', DOWN_PAID_LIMITS) + apply_limits('opensource', DOWN_PAID_LIMITS) + end + + private + + def apply_limits(plan_name, limits) + limits.each_pair do |limit_name, limit| + create_or_update_plan_limit(limit_name, plan_name, limit) + end + end +end diff --git a/db/migrate/20220524021855_add_deleted_at_to_terraform_states.rb b/db/migrate/20220524021855_add_deleted_at_to_terraform_states.rb new file mode 100644 index 00000000000..01bbeb17db7 --- /dev/null +++ b/db/migrate/20220524021855_add_deleted_at_to_terraform_states.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddDeletedAtToTerraformStates < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :terraform_states, :deleted_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20220524141800_create_audit_events_streaming_headers.rb b/db/migrate/20220524141800_create_audit_events_streaming_headers.rb new file mode 100644 index 00000000000..2bd0362874c --- /dev/null +++ b/db/migrate/20220524141800_create_audit_events_streaming_headers.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreateAuditEventsStreamingHeaders < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'idx_streaming_headers_on_external_audit_event_destination_id' + UNIQ_INDEX_NAME = 'idx_external_audit_event_destination_id_key_uniq' + + def change + create_table :audit_events_streaming_headers do |t| + t.timestamps_with_timezone null: false + t.references :external_audit_event_destination, + null: false, + index: { name: INDEX_NAME }, + foreign_key: { to_table: 'audit_events_external_audit_event_destinations', on_delete: :cascade } + t.text :key, null: false, limit: 255 + t.text :value, null: false, limit: 255 + + t.index [:key, :external_audit_event_destination_id], unique: true, name: UNIQ_INDEX_NAME + end + end +end diff --git a/db/migrate/20220524191259_add_application_settings_container_registry_pre_import_tags_rate_constraint.rb b/db/migrate/20220524191259_add_application_settings_container_registry_pre_import_tags_rate_constraint.rb new file mode 100644 index 00000000000..020db30d529 --- /dev/null +++ b/db/migrate/20220524191259_add_application_settings_container_registry_pre_import_tags_rate_constraint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddApplicationSettingsContainerRegistryPreImportTagsRateConstraint < Gitlab::Database::Migration[2.0] + CONSTRAINT_NAME = 'app_settings_container_registry_pre_import_tags_rate_positive' + + disable_ddl_transaction! + + def up + add_check_constraint :application_settings, 'container_registry_pre_import_tags_rate >= 0', CONSTRAINT_NAME + end + + def down + remove_check_constraint :application_settings, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20220525082303_create_issuable_resource_links.rb b/db/migrate/20220525082303_create_issuable_resource_links.rb new file mode 100644 index 00000000000..d6cf3057821 --- /dev/null +++ b/db/migrate/20220525082303_create_issuable_resource_links.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CreateIssuableResourceLinks < Gitlab::Database::Migration[2.0] + def change + create_table :issuable_resource_links do |t| + t.references :issue, null: false, foreign_key: { on_delete: :cascade }, index: true + t.text :link_text, null: true, limit: 255 + t.text :link, null: false, limit: 2200 + t.integer :link_type, null: false, limit: 2, default: 0 # general resource link + + t.timestamps_with_timezone null: false + end + end +end diff --git a/db/migrate/20220525123825_add_raw_to_ci_pipeline_variables.rb b/db/migrate/20220525123825_add_raw_to_ci_pipeline_variables.rb new file mode 100644 index 00000000000..258b4631643 --- /dev/null +++ b/db/migrate/20220525123825_add_raw_to_ci_pipeline_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRawToCiPipelineVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_pipeline_variables, :raw, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20220525123851_add_raw_to_ci_group_variables.rb b/db/migrate/20220525123851_add_raw_to_ci_group_variables.rb new file mode 100644 index 00000000000..9eae210d8c3 --- /dev/null +++ b/db/migrate/20220525123851_add_raw_to_ci_group_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRawToCiGroupVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_group_variables, :raw, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20220525123914_add_raw_to_ci_instance_variables.rb b/db/migrate/20220525123914_add_raw_to_ci_instance_variables.rb new file mode 100644 index 00000000000..71674b48e39 --- /dev/null +++ b/db/migrate/20220525123914_add_raw_to_ci_instance_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRawToCiInstanceVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_instance_variables, :raw, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20220525123940_add_raw_to_ci_job_variables.rb b/db/migrate/20220525123940_add_raw_to_ci_job_variables.rb new file mode 100644 index 00000000000..abd1f1eb211 --- /dev/null +++ b/db/migrate/20220525123940_add_raw_to_ci_job_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRawToCiJobVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_job_variables, :raw, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20220525124104_add_raw_to_ci_pipeline_schedule_variables.rb b/db/migrate/20220525124104_add_raw_to_ci_pipeline_schedule_variables.rb new file mode 100644 index 00000000000..c7a3b832552 --- /dev/null +++ b/db/migrate/20220525124104_add_raw_to_ci_pipeline_schedule_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRawToCiPipelineScheduleVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_pipeline_schedule_variables, :raw, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20220525124125_add_raw_to_ci_variables.rb b/db/migrate/20220525124125_add_raw_to_ci_variables.rb new file mode 100644 index 00000000000..168cd107d1c --- /dev/null +++ b/db/migrate/20220525124125_add_raw_to_ci_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRawToCiVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_variables, :raw, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20220530103023_add_created_at_and_id_index_to_deployment_approvals.rb b/db/migrate/20220530103023_add_created_at_and_id_index_to_deployment_approvals.rb new file mode 100644 index 00000000000..88117b310c9 --- /dev/null +++ b/db/migrate/20220530103023_add_created_at_and_id_index_to_deployment_approvals.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddCreatedAtAndIdIndexToDeploymentApprovals < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_deployment_approvals_on_created_at_and_id' + + def up + add_concurrent_index :deployment_approvals, %i[created_at id], name: INDEX_NAME + end + + def down + remove_concurrent_index :deployment_approvals, %i[created_at id], name: INDEX_NAME + end +end diff --git a/db/migrate/20220530104431_add_timestamps_to_compliance_frameworks.rb b/db/migrate/20220530104431_add_timestamps_to_compliance_frameworks.rb new file mode 100644 index 00000000000..88013fddc81 --- /dev/null +++ b/db/migrate/20220530104431_add_timestamps_to_compliance_frameworks.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTimestampsToComplianceFrameworks < Gitlab::Database::Migration[2.0] + def up + add_column :compliance_management_frameworks, :created_at, :datetime_with_timezone, null: true + add_column :compliance_management_frameworks, :updated_at, :datetime_with_timezone, null: true + end + + def down + remove_column :compliance_management_frameworks, :created_at + remove_column :compliance_management_frameworks, :updated_at + end +end diff --git a/db/migrate/20220531100920_add_license_usage_data_exported_to_application_settings.rb b/db/migrate/20220531100920_add_license_usage_data_exported_to_application_settings.rb new file mode 100644 index 00000000000..825697d5387 --- /dev/null +++ b/db/migrate/20220531100920_add_license_usage_data_exported_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddLicenseUsageDataExportedToApplicationSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :application_settings, :license_usage_data_exported, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20220601091804_add_semver_column_to_ci_runners.rb b/db/migrate/20220601091804_add_semver_column_to_ci_runners.rb new file mode 100644 index 00000000000..4d4739a03e0 --- /dev/null +++ b/db/migrate/20220601091804_add_semver_column_to_ci_runners.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddSemverColumnToCiRunners < Gitlab::Database::Migration[2.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20220601091805_add_text_limit_to_ci_runners_semver + def up + add_column :ci_runners, :semver, :text, null: true + end + # rubocop:enable Migration/AddLimitToTextColumns + + def down + remove_column :ci_runners, :semver + end +end diff --git a/db/migrate/20220601091805_add_text_limit_to_ci_runners_semver.rb b/db/migrate/20220601091805_add_text_limit_to_ci_runners_semver.rb new file mode 100644 index 00000000000..dac067add90 --- /dev/null +++ b/db/migrate/20220601091805_add_text_limit_to_ci_runners_semver.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToCiRunnersSemver < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :ci_runners, :semver, 16 + end + + def down + remove_text_limit :ci_runners, :semver + end +end diff --git a/db/migrate/20220601101800_add_index_on_runner_id_and_semver_columns.rb b/db/migrate/20220601101800_add_index_on_runner_id_and_semver_columns.rb new file mode 100644 index 00000000000..1b5aa6237f6 --- /dev/null +++ b/db/migrate/20220601101800_add_index_on_runner_id_and_semver_columns.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnRunnerIdAndSemverColumns < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_ci_runners_on_id_and_semver_cidr' + + def up + add_concurrent_index :ci_runners, + 'id, (semver::cidr)', + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :ci_runners, INDEX_NAME + end +end diff --git a/db/migrate/20220601223501_add_vulnerability_related_columns.rb b/db/migrate/20220601223501_add_vulnerability_related_columns.rb new file mode 100644 index 00000000000..be310b02467 --- /dev/null +++ b/db/migrate/20220601223501_add_vulnerability_related_columns.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class AddVulnerabilityRelatedColumns < Gitlab::Database::Migration[2.0] + def change + add_column :approval_merge_request_rules, + :vulnerabilities_allowed, + :integer, + limit: 2, + null: false, + default: 0 + add_column :approval_merge_request_rules, + :scanners, + :text, + array: true, + null: false, + default: [] + add_column :approval_merge_request_rules, + :severity_levels, + :text, + array: true, + null: false, + default: [] + add_column :approval_merge_request_rules, + :vulnerability_states, + :text, + array: true, + null: false, + default: ['newly_detected'] + end +end diff --git a/db/migrate/20220602130306_add_namespace_type_index.rb b/db/migrate/20220602130306_add_namespace_type_index.rb new file mode 100644 index 00000000000..b20f36b3278 --- /dev/null +++ b/db/migrate/20220602130306_add_namespace_type_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddNamespaceTypeIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_groups_on_parent_id_id' + + def up + add_concurrent_index :namespaces, [:parent_id, :id], where: "type = 'Group'", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:namespaces, INDEX_NAME) + end +end diff --git a/db/migrate/20220603095158_drop_ci_build_report_results_build_id_sequence.rb b/db/migrate/20220603095158_drop_ci_build_report_results_build_id_sequence.rb new file mode 100644 index 00000000000..370eddf4390 --- /dev/null +++ b/db/migrate/20220603095158_drop_ci_build_report_results_build_id_sequence.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class DropCiBuildReportResultsBuildIdSequence < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + drop_sequence(:ci_build_report_results, :build_id, :ci_build_report_results_build_id_seq) + end + + def down + add_sequence(:ci_build_report_results, :build_id, :ci_build_report_results_build_id_seq, 1) + end +end diff --git a/db/migrate/20220605170009_add_url_vars_to_web_hook.rb b/db/migrate/20220605170009_add_url_vars_to_web_hook.rb new file mode 100644 index 00000000000..207b0fc10c2 --- /dev/null +++ b/db/migrate/20220605170009_add_url_vars_to_web_hook.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddUrlVarsToWebHook < Gitlab::Database::Migration[2.0] + def change + add_column :web_hooks, :encrypted_url_variables, :binary + add_column :web_hooks, :encrypted_url_variables_iv, :binary + end +end diff --git a/db/migrate/20220607011733_add_phone_verification_code_enabled_to_application_settings.rb b/db/migrate/20220607011733_add_phone_verification_code_enabled_to_application_settings.rb new file mode 100644 index 00000000000..321e55a2abf --- /dev/null +++ b/db/migrate/20220607011733_add_phone_verification_code_enabled_to_application_settings.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddPhoneVerificationCodeEnabledToApplicationSettings < Gitlab::Database::Migration[2.0] + def up + add_column :application_settings, + :phone_verification_code_enabled, + :boolean, + null: false, + default: false, + comment: 'JiHu-specific column' + end + + def down + remove_column :application_settings, :phone_verification_code_enabled + end +end diff --git a/db/migrate/20220607095219_drop_ci_pipelines_config_pipeline_id_sequence.rb b/db/migrate/20220607095219_drop_ci_pipelines_config_pipeline_id_sequence.rb new file mode 100644 index 00000000000..fb7e14330cd --- /dev/null +++ b/db/migrate/20220607095219_drop_ci_pipelines_config_pipeline_id_sequence.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class DropCiPipelinesConfigPipelineIdSequence < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + drop_sequence(:ci_pipelines_config, :pipeline_id, :ci_pipelines_config_pipeline_id_seq) + end + + def down + add_sequence(:ci_pipelines_config, :pipeline_id, :ci_pipelines_config_pipeline_id_seq, 1) + end +end diff --git a/db/migrate/20220607115703_drop_ci_job_artifact_states_job_artifact_id_sequence.rb b/db/migrate/20220607115703_drop_ci_job_artifact_states_job_artifact_id_sequence.rb new file mode 100644 index 00000000000..d3d56f72cee --- /dev/null +++ b/db/migrate/20220607115703_drop_ci_job_artifact_states_job_artifact_id_sequence.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class DropCiJobArtifactStatesJobArtifactIdSequence < Gitlab::Database::Migration[2.0] + def up + drop_sequence(:ci_job_artifact_states, :job_artifact_id, :ci_job_artifact_states_job_artifact_id_seq) + end + + def down + add_sequence(:ci_job_artifact_states, :job_artifact_id, :ci_job_artifact_states_job_artifact_id_seq, 1) + end +end diff --git a/db/migrate/20220608114734_prepare_confidential_note_index_on_id.rb b/db/migrate/20220608114734_prepare_confidential_note_index_on_id.rb new file mode 100644 index 00000000000..7c23029283c --- /dev/null +++ b/db/migrate/20220608114734_prepare_confidential_note_index_on_id.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class PrepareConfidentialNoteIndexOnId < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_notes_on_id_where_confidential' + + def up + prepare_async_index :notes, :id, where: 'confidential = true', name: INDEX_NAME + end + + def down + unprepare_async_index :notes, :id, name: INDEX_NAME + end +end diff --git a/db/migrate/20220609150626_add_partial_index_on_slack_integrations_with_bot_user_id.rb b/db/migrate/20220609150626_add_partial_index_on_slack_integrations_with_bot_user_id.rb new file mode 100644 index 00000000000..498c1da9e19 --- /dev/null +++ b/db/migrate/20220609150626_add_partial_index_on_slack_integrations_with_bot_user_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddPartialIndexOnSlackIntegrationsWithBotUserId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'partial_index_slack_integrations_with_bot_user_id' + + def up + add_concurrent_index :slack_integrations, :id, name: INDEX_NAME, where: 'bot_user_id IS NOT NULL' + end + + def down + remove_concurrent_index :slack_integrations, :id, name: INDEX_NAME + end +end diff --git a/db/migrate/20220610074326_add_epic_issue_weight.rb b/db/migrate/20220610074326_add_epic_issue_weight.rb new file mode 100644 index 00000000000..b1c1f1c56c7 --- /dev/null +++ b/db/migrate/20220610074326_add_epic_issue_weight.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddEpicIssueWeight < Gitlab::Database::Migration[2.0] + def change + add_column :epics, :total_opened_issue_weight, :integer, default: 0, null: false + add_column :epics, :total_closed_issue_weight, :integer, default: 0, null: false + add_column :epics, :total_opened_issue_count, :integer, default: 0, null: false + add_column :epics, :total_closed_issue_count, :integer, default: 0, null: false + end +end diff --git a/db/migrate/20220610125248_add_enabled_git_access_protocol_to_namespace_settings.rb b/db/migrate/20220610125248_add_enabled_git_access_protocol_to_namespace_settings.rb new file mode 100644 index 00000000000..2f16467acd1 --- /dev/null +++ b/db/migrate/20220610125248_add_enabled_git_access_protocol_to_namespace_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddEnabledGitAccessProtocolToNamespaceSettings < Gitlab::Database::Migration[2.0] + def change + add_column :namespace_settings, :enabled_git_access_protocol, :integer, default: 0, null: false, limit: 2 + end +end diff --git a/db/migrate/20220614095912_add_has_vulnerabilities_to_cluster_agents.rb b/db/migrate/20220614095912_add_has_vulnerabilities_to_cluster_agents.rb new file mode 100644 index 00000000000..e4e4e3ab7ae --- /dev/null +++ b/db/migrate/20220614095912_add_has_vulnerabilities_to_cluster_agents.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddHasVulnerabilitiesToClusterAgents < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :cluster_agents, :has_vulnerabilities, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20220615091059_add_created_at_index_to_compliance_management_frameworks.rb b/db/migrate/20220615091059_add_created_at_index_to_compliance_management_frameworks.rb new file mode 100644 index 00000000000..a930dde9a83 --- /dev/null +++ b/db/migrate/20220615091059_add_created_at_index_to_compliance_management_frameworks.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddCreatedAtIndexToComplianceManagementFrameworks < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = "i_compliance_frameworks_on_id_and_created_at" + + def up + add_concurrent_index :compliance_management_frameworks, + [:id, :created_at, :pipeline_configuration_full_path], + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :compliance_management_frameworks, INDEX_NAME + end +end diff --git a/db/migrate/20220615105811_add_index_on_clusters_agent_project_id_and_has_vulnerabilities_columns.rb b/db/migrate/20220615105811_add_index_on_clusters_agent_project_id_and_has_vulnerabilities_columns.rb new file mode 100644 index 00000000000..007f36c26ed --- /dev/null +++ b/db/migrate/20220615105811_add_index_on_clusters_agent_project_id_and_has_vulnerabilities_columns.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnClustersAgentProjectIdAndHasVulnerabilitiesColumns < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_cluster_agents_on_project_id_and_has_vulnerabilities' + + def up + add_concurrent_index :cluster_agents, + [:project_id, :has_vulnerabilities], + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :cluster_agents, INDEX_NAME + end +end diff --git a/db/optional_migrations/composite_primary_keys.rb b/db/optional_migrations/composite_primary_keys.rb deleted file mode 100644 index 13bc58b8692..00000000000 --- a/db/optional_migrations/composite_primary_keys.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -# This migration adds a primary key constraint to tables -# that only have a composite unique key. -# -# This is not strictly relevant to Rails (v4 does not -# support composite primary keys). However this becomes -# useful for e.g. PostgreSQL's logical replication (pglogical) -# which requires all tables to have a primary key constraint. -# -# In that sense, the migration is optional and not strictly needed. -class CompositePrimaryKeysMigration < ActiveRecord::Migration[4.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - Index = Struct.new(:table, :name, :columns) - - TABLES = [ - Index.new(:issue_assignees, 'index_issue_assignees_on_issue_id_and_user_id', %i(issue_id user_id)), - Index.new(:user_interacted_projects, 'index_user_interacted_projects_on_project_id_and_user_id', %i(project_id user_id)), - Index.new(:merge_request_diff_files, 'index_merge_request_diff_files_on_mr_diff_id_and_order', %i(merge_request_diff_id relative_order)), - Index.new(:merge_request_diff_commits, 'index_merge_request_diff_commits_on_mr_diff_id_and_order', %i(merge_request_diff_id relative_order)), - Index.new(:project_authorizations, 'index_project_authorizations_on_user_id_project_id_access_level', %i(user_id project_id access_level)), - Index.new(:push_event_payloads, 'index_push_event_payloads_on_event_id', %i(event_id)), - Index.new(:schema_migrations, 'unique_schema_migrations', %(version)) - ].freeze - - disable_ddl_transaction! - - def up - disable_statement_timeout do - TABLES.each do |index| - add_primary_key(index) - end - end - end - - def down - disable_statement_timeout do - TABLES.each do |index| - remove_primary_key(index) - end - end - end - - private - - def add_primary_key(index) - execute "ALTER TABLE #{index.table} ADD PRIMARY KEY USING INDEX #{index.name}" - end - - def remove_primary_key(index) - temp_index_name = "#{index.name[0..58]}_old" - rename_index index.table, index.name, temp_index_name if index_exists_by_name?(index.table, index.name) - - # re-create unique key index - add_concurrent_index index.table, index.columns, unique: true, name: index.name - - # This also drops the `temp_index_name` as this is owned by the constraint - execute "ALTER TABLE #{index.table} DROP CONSTRAINT IF EXISTS #{temp_index_name}" - end -end diff --git a/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb b/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb index 7f6d7ffe9b7..87c7d373329 100644 --- a/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb +++ b/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb @@ -11,26 +11,7 @@ class ScheduleMigratePagesToZipStorage < ActiveRecord::Migration[6.0] disable_ddl_transaction! - class ProjectPagesMetadatum < ActiveRecord::Base - extend SuppressCompositePrimaryKeyWarning - - include EachBatch - - self.primary_key = :project_id - self.table_name = 'project_pages_metadata' - self.inheritance_column = :_type_disabled - - scope :deployed, -> { where(deployed: true) } - scope :only_on_legacy_storage, -> { deployed.where(pages_deployment_id: nil) } - end - def up - queue_background_migration_jobs_by_range_at_intervals( - ProjectPagesMetadatum.only_on_legacy_storage, - MIGRATION, - BATCH_TIME, - batch_size: BATCH_SIZE, - primary_column_name: :project_id - ) + # no-op end end diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb index 37546a793f7..b9427f7cc93 100644 --- a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + DOWNTIME = false def up diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb index 87250c82244..bb444f5b407 100644 --- a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + include Gitlab::Database::MigrationHelpers DOWNTIME = false diff --git a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb index 3e4f1450632..1ee67cd9dda 100644 --- a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb +++ b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiBuildNeedsForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + DOWNTIME = false def up diff --git a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb index b6b37acab3b..67076cc647a 100644 --- a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb +++ b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb @@ -5,6 +5,8 @@ class BackfillConversionOfCiJobArtifacts < ActiveRecord::Migration[6.0] DOWNTIME = false + disable_ddl_transaction! + def up return unless should_run? diff --git a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb index 0aea924c982..bde91473ee3 100644 --- a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiSourcesPipelinesSourceJobIdForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + def up return unless should_run? diff --git a/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb index 972df41f678..fd071ec9a1a 100644 --- a/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb +++ b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiBuildsForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + DOWNTIME = false TABLE = :ci_builds diff --git a/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb b/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb index 4c656f56a32..7e11d38868b 100644 --- a/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb +++ b/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiBuildTraceChunksForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :ci_build_trace_chunks COLUMNS = %i(build_id) diff --git a/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb b/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb index b548309cdb7..fa0420fe426 100644 --- a/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb +++ b/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiBuildsRunnerSessionForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :ci_builds_runner_session COLUMNS = %i(build_id) diff --git a/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb b/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb index 979ce5edfeb..340dceda254 100644 --- a/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb +++ b/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiBuildTraceSectionsForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :ci_build_trace_sections COLUMN = :build_id diff --git a/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb b/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb index 3aeabbcc0ad..39dd78975da 100644 --- a/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb +++ b/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class BackfillCiBuildsMetadataForBigintConversion < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :ci_builds_metadata COLUMN = :build_id diff --git a/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb b/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb index d554b412420..68bc82059bc 100644 --- a/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb +++ b/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb @@ -3,6 +3,8 @@ class BackfillPkConversionForSelfManaged < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + CONVERSIONS = [ { table: :events, columns: %i(id), sub_batch_size: 500 }, { table: :push_event_payloads, columns: %i(event_id), sub_batch_size: 2500, primary_key: :event_id }, diff --git a/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb b/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb index ecf9040eb46..a9f6d4ea2d9 100644 --- a/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class BackfillCiBuildsMetadataIdForBigintConversion < ActiveRecord::Migration[6.1] + disable_ddl_transaction! + include Gitlab::Database::MigrationHelpers TABLE = :ci_builds_metadata diff --git a/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb b/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb index 840540bb0d4..78ae4f23286 100644 --- a/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb +++ b/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb @@ -3,6 +3,8 @@ class RevertBackfillCiBuildTraceSectionsForBigintConversion < ActiveRecord::Migration[6.1] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + TABLE = :ci_build_trace_sections COLUMN = :build_id diff --git a/db/post_migrate/20210727113447_backfill_integrations_type_new.rb b/db/post_migrate/20210727113447_backfill_integrations_type_new.rb index 8544c236fd7..47238bae4d5 100644 --- a/db/post_migrate/20210727113447_backfill_integrations_type_new.rb +++ b/db/post_migrate/20210727113447_backfill_integrations_type_new.rb @@ -3,6 +3,8 @@ class BackfillIntegrationsTypeNew < ActiveRecord::Migration[6.1] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + MIGRATION = 'BackfillIntegrationsTypeNew' INTERVAL = 2.minutes @@ -16,8 +18,6 @@ class BackfillIntegrationsTypeNew < ActiveRecord::Migration[6.1] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :integrations, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :integrations, :id, []) end end diff --git a/db/post_migrate/20210930211936_backfill_user_namespace.rb b/db/post_migrate/20210930211936_backfill_user_namespace.rb index c5dd170f18e..6d71b09ad63 100644 --- a/db/post_migrate/20210930211936_backfill_user_namespace.rb +++ b/db/post_migrate/20210930211936_backfill_user_namespace.rb @@ -7,6 +7,8 @@ class BackfillUserNamespace < Gitlab::Database::Migration[1.0] SUB_BATCH_SIZE = 200 DOWNTIME = false + disable_ddl_transaction! + def up queue_batched_background_migration( MIGRATION, @@ -19,8 +21,6 @@ class BackfillUserNamespace < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :namespaces, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :namespaces, :id, []) end end diff --git a/db/post_migrate/20211026070408_backfill_issue_search_data.rb b/db/post_migrate/20211026070408_backfill_issue_search_data.rb index a840adcb991..a2cf7b36a59 100644 --- a/db/post_migrate/20211026070408_backfill_issue_search_data.rb +++ b/db/post_migrate/20211026070408_backfill_issue_search_data.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class BackfillIssueSearchData < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + MIGRATION = 'BackfillIssueSearchData' def up @@ -15,8 +17,6 @@ class BackfillIssueSearchData < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :issues, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :issues, :id, []) end end diff --git a/db/post_migrate/20211209103048_backfill_project_namespaces_for_group.rb b/db/post_migrate/20211209103048_backfill_project_namespaces_for_group.rb index 0b65db7aab4..44dffc798d3 100644 --- a/db/post_migrate/20211209103048_backfill_project_namespaces_for_group.rb +++ b/db/post_migrate/20211209103048_backfill_project_namespaces_for_group.rb @@ -36,7 +36,6 @@ class BackfillProjectNamespacesForGroup < Gitlab::Database::Migration[1.0] def down return unless Gitlab.com? || Gitlab.staging? - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :projects, :id, [GROUP_ID, 'up']).delete_all + delete_batched_background_migration(MIGRATION, :projects, :id, [GROUP_ID, 'up']) end end diff --git a/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb b/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb index 4aac0903502..68279456ddd 100644 --- a/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb +++ b/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class BackfillNamespaceIdForNamespaceRoutes < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + MIGRATION = 'BackfillNamespaceIdForNamespaceRoute' INTERVAL = 2.minutes BATCH_SIZE = 1_000 @@ -20,8 +22,6 @@ class BackfillNamespaceIdForNamespaceRoutes < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :routes, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :routes, :id, []) end end diff --git a/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb b/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb index 947c0a1edd0..279084e0fc5 100644 --- a/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb +++ b/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb @@ -7,6 +7,8 @@ class BackfillMemberNamespaceIdForGroupMembers < Gitlab::Database::Migration[1.0 MAX_BATCH_SIZE = 2_000 SUB_BATCH_SIZE = 100 + disable_ddl_transaction! + def up queue_batched_background_migration( MIGRATION, @@ -20,8 +22,6 @@ class BackfillMemberNamespaceIdForGroupMembers < Gitlab::Database::Migration[1.0 end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :members, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :members, :id, []) end end diff --git a/db/post_migrate/20220128103042_schedule_delete_invalid_epic_issues_revised.rb b/db/post_migrate/20220128103042_schedule_delete_invalid_epic_issues_revised.rb new file mode 100644 index 00000000000..642bf012ce0 --- /dev/null +++ b/db/post_migrate/20220128103042_schedule_delete_invalid_epic_issues_revised.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class ScheduleDeleteInvalidEpicIssuesRevised < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + MIGRATION = 'DeleteInvalidEpicIssues' + INTERVAL = 2.minutes + BATCH_SIZE = 1_000 + MAX_BATCH_SIZE = 2_000 + SUB_BATCH_SIZE = 50 + + def up + queue_batched_background_migration( + MIGRATION, + :epics, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :epics, :id, []) + end +end diff --git a/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb index e4005885c3b..10b6ab8204d 100644 --- a/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb +++ b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class ScheduleNullifyOrphanRunnerIdOnCiBuilds < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + MIGRATION = 'NullifyOrphanRunnerIdOnCiBuilds' INTERVAL = 2.minutes BATCH_SIZE = 50_000 @@ -20,8 +22,6 @@ class ScheduleNullifyOrphanRunnerIdOnCiBuilds < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :ci_builds, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :ci_builds, :id, []) end end diff --git a/db/post_migrate/20220301093434_backfill_all_project_namespaces.rb b/db/post_migrate/20220301093434_backfill_all_project_namespaces.rb index 7071e6241ce..607161004cf 100644 --- a/db/post_migrate/20220301093434_backfill_all_project_namespaces.rb +++ b/db/post_migrate/20220301093434_backfill_all_project_namespaces.rb @@ -24,7 +24,6 @@ class BackfillAllProjectNamespaces < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :projects, :id, [nil, 'up']).delete_all + delete_batched_background_migration(MIGRATION, :projects, :id, [nil, 'up']) end end diff --git a/db/post_migrate/20220302114046_backfill_group_features.rb b/db/post_migrate/20220302114046_backfill_group_features.rb index dd8961b8bee..5e0ff9095a3 100644 --- a/db/post_migrate/20220302114046_backfill_group_features.rb +++ b/db/post_migrate/20220302114046_backfill_group_features.rb @@ -22,8 +22,6 @@ class BackfillGroupFeatures < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :namespaces, :id, [BATCH_SIZE]) - .delete_all + delete_batched_background_migration(MIGRATION, :namespaces, :id, [BATCH_SIZE]) end end diff --git a/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb b/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb index 5a4d14dcfb7..21b8dc78f7d 100644 --- a/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb +++ b/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb @@ -4,6 +4,8 @@ # so that other migrations that depend on project namespace back-filling cannot be run unless project namespace # back-filling has finalized successfully. class FinalizeProjectNamespacesBackfill < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + MIGRATION = 'ProjectNamespaces::BackfillProjectNamespaces' def up diff --git a/db/post_migrate/20220323023800_backfill_namespace_id_for_project_routes.rb b/db/post_migrate/20220323023800_backfill_namespace_id_for_project_routes.rb index b938688be2c..0b2c7318887 100644 --- a/db/post_migrate/20220323023800_backfill_namespace_id_for_project_routes.rb +++ b/db/post_migrate/20220323023800_backfill_namespace_id_for_project_routes.rb @@ -22,8 +22,6 @@ class BackfillNamespaceIdForProjectRoutes < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :routes, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :routes, :id, []) end end diff --git a/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb b/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb index c1aaea44bfd..07a7b8b8989 100644 --- a/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb +++ b/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb @@ -6,6 +6,8 @@ class ScheduleBackfillProjectSettings < Gitlab::Database::Migration[1.0] BATCH_SIZE = 5_000 SUB_BATCH_SIZE = 200 + disable_ddl_transaction! + def up queue_batched_background_migration( MIGRATION, @@ -18,8 +20,6 @@ class ScheduleBackfillProjectSettings < Gitlab::Database::Migration[1.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :projects, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :projects, :id, []) end end diff --git a/db/post_migrate/20220407163559_schedule_purging_stale_security_scans.rb b/db/post_migrate/20220407163559_schedule_purging_stale_security_scans.rb new file mode 100644 index 00000000000..fdceb2f2594 --- /dev/null +++ b/db/post_migrate/20220407163559_schedule_purging_stale_security_scans.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class SchedulePurgingStaleSecurityScans < Gitlab::Database::Migration[2.0] + MIGRATION = 'PurgeStaleSecurityScans' + BATCH_SIZE = 10_000 + DELAY_INTERVAL = 2.minutes + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + return unless should_run? + + queue_background_migration_jobs_by_range_at_intervals( + Gitlab::BackgroundMigration::PurgeStaleSecurityScans::SecurityScan.to_purge, + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + track_jobs: true + ) + end + + def down + # no-op + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20220418180958_remove_integrations_properties.rb b/db/post_migrate/20220418180958_remove_integrations_properties.rb new file mode 100644 index 00000000000..781b8c8ac72 --- /dev/null +++ b/db/post_migrate/20220418180958_remove_integrations_properties.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RemoveIntegrationsProperties < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def change + remove_column :integrations, :properties, :text + end +end diff --git a/db/post_migrate/20220502015011_clean_up_fix_merge_request_diff_commit_users.rb b/db/post_migrate/20220502015011_clean_up_fix_merge_request_diff_commit_users.rb index 582a0f5cf37..a3e59b38975 100644 --- a/db/post_migrate/20220502015011_clean_up_fix_merge_request_diff_commit_users.rb +++ b/db/post_migrate/20220502015011_clean_up_fix_merge_request_diff_commit_users.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CleanUpFixMergeRequestDiffCommitUsers < Gitlab::Database::Migration[1.0] +class CleanUpFixMergeRequestDiffCommitUsers < Gitlab::Database::Migration[2.0] disable_ddl_transaction! MIGRATION_CLASS = 'FixMergeRequestDiffCommitUsers' diff --git a/db/post_migrate/20220506123922_add_not_null_constraint_without_validation_to_requirements_issue_id.rb b/db/post_migrate/20220506123922_add_not_null_constraint_without_validation_to_requirements_issue_id.rb new file mode 100644 index 00000000000..1484a96d27b --- /dev/null +++ b/db/post_migrate/20220506123922_add_not_null_constraint_without_validation_to_requirements_issue_id.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddNotNullConstraintWithoutValidationToRequirementsIssueId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + CONSTRAINT_NAME = 'check_requirement_issue_not_null' + + def up + add_not_null_constraint( + :requirements, + :issue_id, + constraint_name: CONSTRAINT_NAME, + validate: false + ) + end + + def down + remove_not_null_constraint :requirements, :issue_id, constraint_name: CONSTRAINT_NAME + end +end diff --git a/db/post_migrate/20220506124021_schedule_populate_requirements_issue_id.rb b/db/post_migrate/20220506124021_schedule_populate_requirements_issue_id.rb new file mode 100644 index 00000000000..8f22324bf8d --- /dev/null +++ b/db/post_migrate/20220506124021_schedule_populate_requirements_issue_id.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class SchedulePopulateRequirementsIssueId < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + # 2022-05-06 There are no requirements with nil issue_id on .com + # this migration is supposed to fix records that could have nil issue_id + # on self managed instances. + BATCH_SIZE = 100 + + MIGRATION = 'MigrateRequirementsToWorkItems' + + disable_ddl_transaction! + + class Requirement < MigrationRecord + include EachBatch + + self.table_name = 'requirements' + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + Requirement.where(issue_id: nil), + MIGRATION, + 2.minutes, + batch_size: BATCH_SIZE, + track_jobs: true + ) + end + + def down + # NO OP + end +end diff --git a/db/post_migrate/20220510121338_remove_threat_monitoring_alerts.rb b/db/post_migrate/20220510121338_remove_threat_monitoring_alerts.rb new file mode 100644 index 00000000000..ff171ee516c --- /dev/null +++ b/db/post_migrate/20220510121338_remove_threat_monitoring_alerts.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveThreatMonitoringAlerts < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + execute("DELETE FROM alert_management_alerts WHERE domain = 1") + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220510192117_index_expirable_unknown_artifacts_for_removal.rb b/db/post_migrate/20220510192117_index_expirable_unknown_artifacts_for_removal.rb new file mode 100644 index 00000000000..3e25ca6c7b9 --- /dev/null +++ b/db/post_migrate/20220510192117_index_expirable_unknown_artifacts_for_removal.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class IndexExpirableUnknownArtifactsForRemoval < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = 'ci_job_artifacts' + INDEX_NAME = 'tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown' + CONDITIONS = 'locked = 2 AND expire_at IS NOT NULL' + + def up + prepare_async_index TABLE_NAME, [:expire_at, :job_id], name: INDEX_NAME, where: CONDITIONS + end + + def down + unprepare_async_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb b/db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb new file mode 100644 index 00000000000..fc9912d714e --- /dev/null +++ b/db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnExpirableUnknownArtifactsForRemoval < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = 'ci_job_artifacts' + INDEX_NAME = 'tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown' + CONDITIONS = 'locked = 2 AND expire_at IS NOT NULL' + + def up + add_concurrent_index TABLE_NAME, [:expire_at, :job_id], name: INDEX_NAME, where: CONDITIONS + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/post_migrate/20220512190659_remove_web_hooks_web_hook_logs_web_hook_id_fk.rb b/db/post_migrate/20220512190659_remove_web_hooks_web_hook_logs_web_hook_id_fk.rb new file mode 100644 index 00000000000..b73d3a7f102 --- /dev/null +++ b/db/post_migrate/20220512190659_remove_web_hooks_web_hook_logs_web_hook_id_fk.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +class RemoveWebHooksWebHookLogsWebHookIdFk < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + PARENT_TABLE_NAME = :web_hook_logs + FK_NAME = "fk_rails_bb3355782d" + + def up + with_lock_retries do + execute('LOCK web_hooks, web_hook_logs IN ACCESS EXCLUSIVE MODE') if transaction_open? + + remove_foreign_key_if_exists(:web_hook_logs, :web_hooks, name: FK_NAME) + end + end + + def down + fk_attrs = { + name: FK_NAME, # Note we need the same name for every partition + column: :web_hook_id, + target_column: :id, + on_delete: :cascade + } + + # Must add child FK's first, then to the partitioned table. + child_tables.each do |tbl| + add_concurrent_foreign_key( + tbl, :web_hooks, + # This embeds the lock table statement in the with_lock_retries inside add_concurrent_foreign_key + reverse_lock_order: true, + **fk_attrs) + end + + with_lock_retries do + execute("LOCK web_hooks, #{PARENT_TABLE_NAME} IN ACCESS EXCLUSIVE MODE") if transaction_open? + add_foreign_key(:web_hook_logs, :web_hooks, **fk_attrs) + end + end + + # This table is partitioned: we need to apply the index changes to each + # partition separately. + def child_tables + @child_tables ||= execute(<<~SQL.squish).pluck("child") + SELECT inhrelid::regclass AS child + FROM pg_catalog.pg_inherits + WHERE inhparent = '#{PARENT_TABLE_NAME}'::regclass + ORDER BY inhrelid ASC + SQL + end +end diff --git a/db/post_migrate/20220513043344_reschedule_expire_o_auth_tokens.rb b/db/post_migrate/20220513043344_reschedule_expire_o_auth_tokens.rb index 0c8a2386583..4b24b1cf65a 100644 --- a/db/post_migrate/20220513043344_reschedule_expire_o_auth_tokens.rb +++ b/db/post_migrate/20220513043344_reschedule_expire_o_auth_tokens.rb @@ -10,9 +10,7 @@ class RescheduleExpireOAuthTokens < Gitlab::Database::Migration[2.0] def up # remove the original migration from db/post_migrate/20220428133724_schedule_expire_o_auth_tokens.rb - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :oauth_access_tokens, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :oauth_access_tokens, :id, []) # reschedule queue_batched_background_migration( @@ -24,8 +22,6 @@ class RescheduleExpireOAuthTokens < Gitlab::Database::Migration[2.0] end def down - Gitlab::Database::BackgroundMigration::BatchedMigration - .for_configuration(MIGRATION, :oauth_access_tokens, :id, []) - .delete_all + delete_batched_background_migration(MIGRATION, :oauth_access_tokens, :id, []) end end diff --git a/db/post_migrate/20220516054011_schedule_backfill_project_member_namespace_id.rb b/db/post_migrate/20220516054011_schedule_backfill_project_member_namespace_id.rb new file mode 100644 index 00000000000..e721fdf8c44 --- /dev/null +++ b/db/post_migrate/20220516054011_schedule_backfill_project_member_namespace_id.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class ScheduleBackfillProjectMemberNamespaceId < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = 'BackfillProjectMemberNamespaceId' + INTERVAL = 2.minutes + BATCH_SIZE = 1_000 + MAX_BATCH_SIZE = 2_000 + SUB_BATCH_SIZE = 200 + + disable_ddl_transaction! + + def up + queue_batched_background_migration( + MIGRATION, + :members, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :members, :id, []) + end +end diff --git a/db/post_migrate/20220516100652_drop_compliance_management_frameworks_regulated.rb b/db/post_migrate/20220516100652_drop_compliance_management_frameworks_regulated.rb new file mode 100644 index 00000000000..f9d3405d486 --- /dev/null +++ b/db/post_migrate/20220516100652_drop_compliance_management_frameworks_regulated.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class DropComplianceManagementFrameworksRegulated < Gitlab::Database::Migration[2.0] + def up + remove_column :compliance_management_frameworks, :regulated + end + + def down + add_column :compliance_management_frameworks, :regulated, :boolean, default: true + end +end diff --git a/db/post_migrate/20220516103353_finalize_routes_backfilling_for_projects.rb b/db/post_migrate/20220516103353_finalize_routes_backfilling_for_projects.rb new file mode 100644 index 00000000000..f65003b5da9 --- /dev/null +++ b/db/post_migrate/20220516103353_finalize_routes_backfilling_for_projects.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class FinalizeRoutesBackfillingForProjects < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = 'BackfillNamespaceIdForProjectRoute' + + def up + ensure_batched_background_migration_is_finished( + job_class_name: MIGRATION, + table_name: :routes, + column_name: :id, + job_arguments: [] + ) + end + + def down + # noop + end +end diff --git a/db/post_migrate/20220517101119_create_confidential_notes_index_synchronously.rb b/db/post_migrate/20220517101119_create_confidential_notes_index_synchronously.rb new file mode 100644 index 00000000000..25b7fe7f7bb --- /dev/null +++ b/db/post_migrate/20220517101119_create_confidential_notes_index_synchronously.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateConfidentialNotesIndexSynchronously < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_notes_on_confidential' + + disable_ddl_transaction! + + def up + add_concurrent_index :notes, :confidential, where: 'confidential = true', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :notes, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220517133753_migrate_free_user_cap_remediation.rb b/db/post_migrate/20220517133753_migrate_free_user_cap_remediation.rb new file mode 100644 index 00000000000..44f30134c94 --- /dev/null +++ b/db/post_migrate/20220517133753_migrate_free_user_cap_remediation.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class MigrateFreeUserCapRemediation < Gitlab::Database::Migration[2.0] + def up + sidekiq_queue_migrate 'cronjob:namespaces_free_user_cap', to: 'cronjob:namespaces_free_user_cap_remediation' + end + + def down + sidekiq_queue_migrate 'cronjob:namespaces_free_user_cap_remediation', to: 'cronjob:namespaces_free_user_cap' + end +end diff --git a/db/post_migrate/20220518102414_add_index_to_error_tracking_client_keys.rb b/db/post_migrate/20220518102414_add_index_to_error_tracking_client_keys.rb new file mode 100644 index 00000000000..25923bf00f6 --- /dev/null +++ b/db/post_migrate/20220518102414_add_index_to_error_tracking_client_keys.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddIndexToErrorTrackingClientKeys < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_error_tracking_client_for_enabled_check' + + def up + add_concurrent_index( + :error_tracking_client_keys, + [:project_id, :public_key], + where: 'active = true', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name(:error_tracking_client_keys, INDEX_NAME) + end +end diff --git a/db/post_migrate/20220519045133_bulk_insert_cluster_enabled_grants.rb b/db/post_migrate/20220519045133_bulk_insert_cluster_enabled_grants.rb new file mode 100644 index 00000000000..6c1d9058673 --- /dev/null +++ b/db/post_migrate/20220519045133_bulk_insert_cluster_enabled_grants.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +class BulkInsertClusterEnabledGrants < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + disable_ddl_transaction! + + def up + return unless Gitlab.dev_or_test_env? || Gitlab.com? + + define_batchable_model('cluster_groups').each_batch do |batch| + min, max = batch.pick('MIN(id), MAX(id)') + + bulk_insert = <<-SQL + INSERT INTO cluster_enabled_grants (namespace_id, created_at) + SELECT DISTINCT(traversal_ids[1]), NOW() + FROM cluster_groups + INNER JOIN namespaces ON cluster_groups.group_id = namespaces.id + WHERE cluster_groups.id BETWEEN #{min} AND #{max} + ON CONFLICT (namespace_id) DO NOTHING + SQL + + connection.execute(bulk_insert) + end + + define_batchable_model('cluster_projects').each_batch do |batch| + min, max = batch.pick('MIN(id), MAX(id)') + + bulk_insert = <<-SQL + INSERT INTO cluster_enabled_grants (namespace_id, created_at) + SELECT DISTINCT(traversal_ids[1]), NOW() + FROM cluster_projects + INNER JOIN projects ON cluster_projects.project_id = projects.id + INNER JOIN namespaces on projects.namespace_id = namespaces.id + WHERE cluster_projects.id BETWEEN #{min} AND #{max} + ON CONFLICT (namespace_id) DO NOTHING + SQL + + connection.execute(bulk_insert) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220520040416_schedule_set_legacy_open_source_license_available_for_non_public_projects.rb b/db/post_migrate/20220520040416_schedule_set_legacy_open_source_license_available_for_non_public_projects.rb new file mode 100644 index 00000000000..47b1c169d74 --- /dev/null +++ b/db/post_migrate/20220520040416_schedule_set_legacy_open_source_license_available_for_non_public_projects.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class ScheduleSetLegacyOpenSourceLicenseAvailableForNonPublicProjects < Gitlab::Database::Migration[2.0] + MIGRATION = 'SetLegacyOpenSourceLicenseAvailableForNonPublicProjects' + INTERVAL = 2.minutes + BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 200 + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + return unless Gitlab.com? + + queue_batched_background_migration( + MIGRATION, + :projects, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + return unless Gitlab.com? + + delete_batched_background_migration(MIGRATION, :projects, :id, []) + end +end diff --git a/db/post_migrate/20220523171107_drop_deploy_tokens_token_column.rb b/db/post_migrate/20220523171107_drop_deploy_tokens_token_column.rb new file mode 100644 index 00000000000..79a145bc466 --- /dev/null +++ b/db/post_migrate/20220523171107_drop_deploy_tokens_token_column.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class DropDeployTokensTokenColumn < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + COMPOSITE_INDEX_NAME = 'index_deploy_tokens_on_token_and_expires_at_and_id' + + def up + remove_column :deploy_tokens, :token + end + + def down + unless column_exists?(:deploy_tokens, :token) + add_column :deploy_tokens, :token, :string + end + + add_concurrent_index(:deploy_tokens, :token, unique: true) + add_concurrent_index(:deploy_tokens, %i[token expires_at id], where: 'revoked IS FALSE', name: COMPOSITE_INDEX_NAME) + end +end diff --git a/db/post_migrate/20220524074947_finalize_backfill_null_note_discussion_ids.rb b/db/post_migrate/20220524074947_finalize_backfill_null_note_discussion_ids.rb new file mode 100644 index 00000000000..f11846ebe1d --- /dev/null +++ b/db/post_migrate/20220524074947_finalize_backfill_null_note_discussion_ids.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class FinalizeBackfillNullNoteDiscussionIds < Gitlab::Database::Migration[2.0] + MIGRATION = 'BackfillNoteDiscussionId' + BATCH_SIZE = 10_000 + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration.steal(MIGRATION) + + define_batchable_model('notes').where(discussion_id: nil).each_batch(of: BATCH_SIZE) do |batch| + range = batch.pluck('MIN(id)', 'MAX(id)').first + + Gitlab::BackgroundMigration::BackfillNoteDiscussionId.new.perform(*range) + end + end + + def down + end +end diff --git a/db/post_migrate/20220524080944_cleanup_orphaned_routes.rb b/db/post_migrate/20220524080944_cleanup_orphaned_routes.rb new file mode 100644 index 00000000000..a5ce0ba4646 --- /dev/null +++ b/db/post_migrate/20220524080944_cleanup_orphaned_routes.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CleanupOrphanedRoutes < Gitlab::Database::Migration[2.0] + MIGRATION = 'CleanupOrphanedRoutes' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 100_000 + MAX_BATCH_SIZE = 100_000 + SUB_BATCH_SIZE = 100 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :routes, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE, + gitlab_schema: :gitlab_main + ) + end + + def down + delete_batched_background_migration(MIGRATION, :routes, :id, []) + end +end diff --git a/db/post_migrate/20220524081955_remove_notes_null_discussion_id_temp_index.rb b/db/post_migrate/20220524081955_remove_notes_null_discussion_id_temp_index.rb new file mode 100644 index 00000000000..caca7b0b092 --- /dev/null +++ b/db/post_migrate/20220524081955_remove_notes_null_discussion_id_temp_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveNotesNullDiscussionIdTempIndex < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_notes_on_id_where_discussion_id_is_null' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :notes, INDEX_NAME + end + + def down + add_concurrent_index :notes, :id, where: 'discussion_id IS NULL', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220524132416_prepare_job_artifact_project_id_index.rb b/db/post_migrate/20220524132416_prepare_job_artifact_project_id_index.rb new file mode 100644 index 00000000000..4e27e7f0624 --- /dev/null +++ b/db/post_migrate/20220524132416_prepare_job_artifact_project_id_index.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class PrepareJobArtifactProjectIdIndex < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_ci_job_artifacts_on_project_id_and_id' + + def up + prepare_async_index :ci_job_artifacts, [:project_id, :id], name: INDEX_NAME + end + + def down + unprepare_async_index :notes, [:project_id, :id], name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220524202158_drop_index_on_deployments_on_created_at_cluster_id_and_project_id.rb b/db/post_migrate/20220524202158_drop_index_on_deployments_on_created_at_cluster_id_and_project_id.rb new file mode 100644 index 00000000000..91b1e5f8ce3 --- /dev/null +++ b/db/post_migrate/20220524202158_drop_index_on_deployments_on_created_at_cluster_id_and_project_id.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropIndexOnDeploymentsOnCreatedAtClusterIdAndProjectId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'tp_index_created_at_cluster_id_project_id_on_deployments' + + def up + remove_concurrent_index_by_name :deployments, INDEX_NAME + end + + def down + # no-op + # + # There's no need to re-add this index as it's purpose was temporary, served only + # for a specific CR query which is now closed, and should not be re-opened. + end +end diff --git a/db/post_migrate/20220525131557_cleanup_backfill_integrations_enable_ssl_verification.rb b/db/post_migrate/20220525131557_cleanup_backfill_integrations_enable_ssl_verification.rb new file mode 100644 index 00000000000..3bd4b21c6fd --- /dev/null +++ b/db/post_migrate/20220525131557_cleanup_backfill_integrations_enable_ssl_verification.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CleanupBackfillIntegrationsEnableSslVerification < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + MIGRATION = 'BackfillIntegrationsEnableSslVerification' + + def up + finalize_background_migration(MIGRATION) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220525131624_drop_temporary_index_for_backfill_integrations_enable_ssl_verification.rb b/db/post_migrate/20220525131624_drop_temporary_index_for_backfill_integrations_enable_ssl_verification.rb new file mode 100644 index 00000000000..95abac4b7ac --- /dev/null +++ b/db/post_migrate/20220525131624_drop_temporary_index_for_backfill_integrations_enable_ssl_verification.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropTemporaryIndexForBackfillIntegrationsEnableSslVerification < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'tmp_index_integrations_on_id_where_type_droneci_or_teamcity' + INDEX_CONDITION = "type_new IN ('Integrations::DroneCi', 'Integrations::Teamcity') " \ + "AND encrypted_properties IS NOT NULL" + + def up + remove_concurrent_index_by_name :integrations, INDEX_NAME + end + + def down + # this index is used in 20220209121435_backfill_integrations_enable_ssl_verification + add_concurrent_index :integrations, :id, where: INDEX_CONDITION, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220525141540_migrate_project_service_worker_queue.rb b/db/post_migrate/20220525141540_migrate_project_service_worker_queue.rb new file mode 100644 index 00000000000..acfb8b227fe --- /dev/null +++ b/db/post_migrate/20220525141540_migrate_project_service_worker_queue.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class MigrateProjectServiceWorkerQueue < Gitlab::Database::Migration[2.0] + def up + sidekiq_queue_migrate 'project_service', to: 'integrations_execute' + end + + def down + sidekiq_queue_migrate 'integrations_execute', to: 'project_service' + end +end diff --git a/db/post_migrate/20220525165334_migrate_irker_worker_queue.rb b/db/post_migrate/20220525165334_migrate_irker_worker_queue.rb new file mode 100644 index 00000000000..19454c007c8 --- /dev/null +++ b/db/post_migrate/20220525165334_migrate_irker_worker_queue.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class MigrateIrkerWorkerQueue < Gitlab::Database::Migration[2.0] + def up + sidekiq_queue_migrate 'irker', to: 'integrations_irker' + end + + def down + sidekiq_queue_migrate 'integrations_irker', to: 'irker' + end +end diff --git a/db/post_migrate/20220525172001_migrate_cluster_integration_worker_queues.rb b/db/post_migrate/20220525172001_migrate_cluster_integration_worker_queues.rb new file mode 100644 index 00000000000..4372ca9f965 --- /dev/null +++ b/db/post_migrate/20220525172001_migrate_cluster_integration_worker_queues.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class MigrateClusterIntegrationWorkerQueues < Gitlab::Database::Migration[2.0] + def up + sidekiq_queue_migrate 'gcp_cluster:clusters_applications_activate_service', + to: 'gcp_cluster:clusters_applications_activate_integration' + sidekiq_queue_migrate 'gcp_cluster:clusters_applications_deactivate_service', + to: 'gcp_cluster:clusters_applications_deactivate_integration' + end + + def down + sidekiq_queue_migrate 'gcp_cluster:clusters_applications_activate_integration', + to: 'gcp_cluster:clusters_applications_activate_service' + sidekiq_queue_migrate 'gcp_cluster:clusters_applications_deactivate_integration', + to: 'gcp_cluster:clusters_applications_deactivate_service' + end +end diff --git a/db/post_migrate/20220526042017_remove_geo_lfs_object_deleted_event_references.rb b/db/post_migrate/20220526042017_remove_geo_lfs_object_deleted_event_references.rb new file mode 100644 index 00000000000..4569424dca0 --- /dev/null +++ b/db/post_migrate/20220526042017_remove_geo_lfs_object_deleted_event_references.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class RemoveGeoLfsObjectDeletedEventReferences < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + with_lock_retries do + remove_column :geo_event_log, :lfs_object_deleted_event_id, :bigint + end + end + + def down + with_lock_retries do + unless column_exists?(:geo_event_log, :lfs_object_deleted_event_id) + add_column(:geo_event_log, :lfs_object_deleted_event_id, :bigint) + end + end + + add_concurrent_foreign_key :geo_event_log, :geo_lfs_object_deleted_events, + column: :lfs_object_deleted_event_id, + name: 'fk_d5af95fcd9', + on_delete: :cascade + + add_concurrent_index :geo_event_log, + :lfs_object_deleted_event_id, + name: 'index_geo_event_log_on_lfs_object_deleted_event_id', + where: "(lfs_object_deleted_event_id IS NOT NULL)" + end +end diff --git a/db/post_migrate/20220526044516_remove_geo_lfs_object_deleted_events_table.rb b/db/post_migrate/20220526044516_remove_geo_lfs_object_deleted_events_table.rb new file mode 100644 index 00000000000..29a2e34aefa --- /dev/null +++ b/db/post_migrate/20220526044516_remove_geo_lfs_object_deleted_events_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveGeoLfsObjectDeletedEventsTable < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + drop_table :geo_lfs_object_deleted_events + end + + def down + create_table :geo_lfs_object_deleted_events, id: :bigserial do |t| + t.integer :lfs_object_id, null: false, index: true + t.string :oid, null: false + t.string :file_path, null: false + end + end +end diff --git a/db/post_migrate/20220530044712_add_index_for_vulnerability_reads_location_image.rb b/db/post_migrate/20220530044712_add_index_for_vulnerability_reads_location_image.rb new file mode 100644 index 00000000000..384924941c1 --- /dev/null +++ b/db/post_migrate/20220530044712_add_index_for_vulnerability_reads_location_image.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddIndexForVulnerabilityReadsLocationImage < Gitlab::Database::Migration[2.0] + INDEX = :index_vulnerability_reads_on_location_image_partial + + disable_ddl_transaction! + + REPORT_TYPES = { + container_scanning: 2, + cluster_image_scanning: 7 + } + + QUERY = <<~SQL + report_type in (#{REPORT_TYPES[:container_scanning]}, #{REPORT_TYPES[:cluster_image_scanning]}) AND + location_image IS NOT NULL + SQL + + def up + add_concurrent_index :vulnerability_reads, [:project_id, :location_image], + where: QUERY, + name: INDEX + end + + def down + remove_concurrent_index_by_name :vulnerability_reads, INDEX + end +end diff --git a/db/post_migrate/20220530074027_add_project_id_index_to_job_artifacts.rb b/db/post_migrate/20220530074027_add_project_id_index_to_job_artifacts.rb new file mode 100644 index 00000000000..fb75f368835 --- /dev/null +++ b/db/post_migrate/20220530074027_add_project_id_index_to_job_artifacts.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddProjectIdIndexToJobArtifacts < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_ci_job_artifacts_on_project_id_and_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_job_artifacts, [:project_id, :id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME + end +end diff --git a/db/post_migrate/20220530082653_add_traversal_id_type_group_index.rb b/db/post_migrate/20220530082653_add_traversal_id_type_group_index.rb new file mode 100644 index 00000000000..00d997e1f52 --- /dev/null +++ b/db/post_migrate/20220530082653_add_traversal_id_type_group_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddTraversalIdTypeGroupIndex < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_namespaces_on_traversal_ids_for_groups_btree' + + disable_ddl_transaction! + + def up + add_concurrent_index :namespaces, :traversal_ids, using: :btree, where: "type='Group'", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :namespaces, INDEX_NAME + end +end diff --git a/db/post_migrate/20220530170915_add_index_for_vulnerability_state_transition.rb b/db/post_migrate/20220530170915_add_index_for_vulnerability_state_transition.rb new file mode 100644 index 00000000000..46ff79c2441 --- /dev/null +++ b/db/post_migrate/20220530170915_add_index_for_vulnerability_state_transition.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexForVulnerabilityStateTransition < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + NEW_INDEX_NAME = 'index_vulnerability_state_transitions_id_and_vulnerability_id' + OLD_INDEX_NAME = 'index_vulnerability_state_transitions_on_vulnerability_id' + + def up + add_concurrent_index(:vulnerability_state_transitions, [:vulnerability_id, :id], name: NEW_INDEX_NAME) + + remove_concurrent_index_by_name(:vulnerability_state_transitions, OLD_INDEX_NAME) + end + + def down + remove_concurrent_index_by_name(:vulnerability_state_transitions, NEW_INDEX_NAME) + + add_concurrent_index(:vulnerability_state_transitions, [:vulnerability_id], name: OLD_INDEX_NAME) + end +end diff --git a/db/post_migrate/20220531024142_track_clusters_deletions.rb b/db/post_migrate/20220531024142_track_clusters_deletions.rb new file mode 100644 index 00000000000..a9c4e50f7dc --- /dev/null +++ b/db/post_migrate/20220531024142_track_clusters_deletions.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class TrackClustersDeletions < Gitlab::Database::Migration[2.0] + include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers + + enable_lock_retries! + + def up + track_record_deletions(:clusters) + end + + def down + untrack_record_deletions(:clusters) + end +end diff --git a/db/post_migrate/20220531024143_remove_clusters_deployments_cluster_id_fk.rb b/db/post_migrate/20220531024143_remove_clusters_deployments_cluster_id_fk.rb new file mode 100644 index 00000000000..261a06a9b9c --- /dev/null +++ b/db/post_migrate/20220531024143_remove_clusters_deployments_cluster_id_fk.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class RemoveClustersDeploymentsClusterIdFk < Gitlab::Database::Migration[2.0] + FK_NAME = 'fk_289bba3222' + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_foreign_key_if_exists( + :deployments, + :clusters, + name: FK_NAME, + reverse_lock_order: true + ) + end + end + + def down + add_concurrent_foreign_key( + :deployments, + :clusters, + name: FK_NAME, + column: :cluster_id, + target_column: :id, + on_delete: :nullify + ) + end +end diff --git a/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb b/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb new file mode 100644 index 00000000000..b7b02e483df --- /dev/null +++ b/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveSseUsageDataFromRedis < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + Gitlab::Redis::SharedState.with { |r| r.del("USAGE_STATIC_SITE_EDITOR_VIEWS") } + Gitlab::Redis::SharedState.with { |r| r.del("USAGE_STATIC_SITE_EDITOR_COMMITS") } + Gitlab::Redis::SharedState.with { |r| r.del("USAGE_STATIC_SITE_EDITOR_MERGE_REQUESTS") } + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220601040233_finalize_backfill_issue_search_data.rb b/db/post_migrate/20220601040233_finalize_backfill_issue_search_data.rb new file mode 100644 index 00000000000..7b5cd405fa8 --- /dev/null +++ b/db/post_migrate/20220601040233_finalize_backfill_issue_search_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class FinalizeBackfillIssueSearchData < Gitlab::Database::Migration[2.0] + MIGRATION = 'BackfillIssueSearchData' + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + ensure_batched_background_migration_is_finished( + job_class_name: MIGRATION, + table_name: :issues, + column_name: :id, + job_arguments: [], + finalize: true + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220602070502_queue_backfill_project_feature_package_registry_access_level.rb b/db/post_migrate/20220602070502_queue_backfill_project_feature_package_registry_access_level.rb new file mode 100644 index 00000000000..2c772a79327 --- /dev/null +++ b/db/post_migrate/20220602070502_queue_backfill_project_feature_package_registry_access_level.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class QueueBackfillProjectFeaturePackageRegistryAccessLevel < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + MIGRATION = 'BackfillProjectFeaturePackageRegistryAccessLevel' + DELAY_INTERVAL = 2.minutes + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :projects, + :id, + job_interval: DELAY_INTERVAL + ) + end + + def down + delete_batched_background_migration(MIGRATION, :projects, :id, []) + end +end diff --git a/db/post_migrate/20220602111923_prepare_index_for_open_issues_count.rb b/db/post_migrate/20220602111923_prepare_index_for_open_issues_count.rb new file mode 100644 index 00000000000..e90524df1ba --- /dev/null +++ b/db/post_migrate/20220602111923_prepare_index_for_open_issues_count.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class PrepareIndexForOpenIssuesCount < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'idx_open_issues_on_project_id_and_confidential' + + def up + prepare_async_index :issues, [:project_id, :confidential], where: 'state_id = 1', name: INDEX_NAME + end + + def down + unprepare_async_index_by_name :issues, INDEX_NAME + end +end diff --git a/db/post_migrate/20220606060825_set_on_delete_cascade_on_namespace_id_on_routes_table.rb b/db/post_migrate/20220606060825_set_on_delete_cascade_on_namespace_id_on_routes_table.rb new file mode 100644 index 00000000000..74660d1474c --- /dev/null +++ b/db/post_migrate/20220606060825_set_on_delete_cascade_on_namespace_id_on_routes_table.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class SetOnDeleteCascadeOnNamespaceIdOnRoutesTable < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TARGET_COLUMN = :namespace_id + + def up + # add the new FK before removing the old one + add_concurrent_foreign_key( + :routes, + :namespaces, + column: TARGET_COLUMN, + name: fk_name("#{TARGET_COLUMN}_new"), + on_delete: :cascade + ) + + with_lock_retries do + remove_foreign_key_if_exists(:routes, column: TARGET_COLUMN, name: fk_name(TARGET_COLUMN)) + end + end + + def down + add_concurrent_foreign_key( + :routes, + :namespaces, + column: TARGET_COLUMN, + name: fk_name(TARGET_COLUMN), + on_delete: :nullify + ) + + with_lock_retries do + remove_foreign_key_if_exists(:routes, column: TARGET_COLUMN, name: fk_name("#{TARGET_COLUMN}_new")) + end + end + + def fk_name(column_name) + # generate a FK name + concurrent_foreign_key_name(:routes, column_name) + end +end diff --git a/db/post_migrate/20220606060850_add_not_null_constraint_on_routes_namespace_id.rb b/db/post_migrate/20220606060850_add_not_null_constraint_on_routes_namespace_id.rb new file mode 100644 index 00000000000..4c9f087f62d --- /dev/null +++ b/db/post_migrate/20220606060850_add_not_null_constraint_on_routes_namespace_id.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddNotNullConstraintOnRoutesNamespaceId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_not_null_constraint :routes, :namespace_id, validate: false + end + + def down + remove_not_null_constraint :routes, :namespace_id + end +end diff --git a/db/post_migrate/20220607140222_remove_invalid_integrations.rb b/db/post_migrate/20220607140222_remove_invalid_integrations.rb new file mode 100644 index 00000000000..49834d7b120 --- /dev/null +++ b/db/post_migrate/20220607140222_remove_invalid_integrations.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class RemoveInvalidIntegrations < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + BATCH_SIZE = 100 + + def up + loop do + deleted = Integration.where(type_new: nil).limit(BATCH_SIZE).delete_all + + break if deleted < BATCH_SIZE + end + end + + # Isolated version of the Integration model + class Integration < MigrationRecord + self.table_name = 'integrations' + self.inheritance_column = :_type_disabled + end +end diff --git a/db/post_migrate/20220609195803_remove_deployment_clusters_cluster_id_fk.rb b/db/post_migrate/20220609195803_remove_deployment_clusters_cluster_id_fk.rb new file mode 100644 index 00000000000..2d81816fcfd --- /dev/null +++ b/db/post_migrate/20220609195803_remove_deployment_clusters_cluster_id_fk.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class RemoveDeploymentClustersClusterIdFk < Gitlab::Database::Migration[2.0] + FK_NAME = 'fk_rails_4e6243e120' + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_foreign_key_if_exists( + :deployment_clusters, + :clusters, + name: FK_NAME, + reverse_lock_order: true + ) + end + end + + def down + add_concurrent_foreign_key( + :deployment_clusters, + :clusters, + name: FK_NAME, + column: :cluster_id, + target_column: :id, + on_delete: :cascade + ) + end +end diff --git a/db/post_migrate/20220610223040_add_index_on_available_pypi_packages.rb b/db/post_migrate/20220610223040_add_index_on_available_pypi_packages.rb new file mode 100644 index 00000000000..891272c8a51 --- /dev/null +++ b/db/post_migrate/20220610223040_add_index_on_available_pypi_packages.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnAvailablePypiPackages < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_packages_on_available_pypi_packages' + + def up + add_concurrent_index :packages_packages, + [:project_id, :id], + where: "status IN (0,1) AND package_type = 5 AND version IS NOT NULL", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_packages, INDEX_NAME + end +end diff --git a/db/post_migrate/20220613095911_create_confidential_notes_index_on_id.rb b/db/post_migrate/20220613095911_create_confidential_notes_index_on_id.rb new file mode 100644 index 00000000000..80c26c3ea8a --- /dev/null +++ b/db/post_migrate/20220613095911_create_confidential_notes_index_on_id.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreateConfidentialNotesIndexOnId < Gitlab::Database::Migration[2.0] + OLD_INDEX_NAME = 'index_notes_on_confidential' + INDEX_NAME = 'index_notes_on_id_where_confidential' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :notes, name: OLD_INDEX_NAME + add_concurrent_index :notes, :id, where: 'confidential = true', name: INDEX_NAME + end + + def down + # we don't have to re-create OLD_INDEX_NAME index + # because it wasn't used yet, also its creation might be expensive + remove_concurrent_index_by_name :notes, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220616092541_prepare_index_issues_on_project_id_and_closed_at.rb b/db/post_migrate/20220616092541_prepare_index_issues_on_project_id_and_closed_at.rb new file mode 100644 index 00000000000..084cdb6166d --- /dev/null +++ b/db/post_migrate/20220616092541_prepare_index_issues_on_project_id_and_closed_at.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class PrepareIndexIssuesOnProjectIdAndClosedAt < Gitlab::Database::Migration[2.0] + NEW_INDEX_NAME_1 = 'index_issues_on_project_id_closed_at_desc_state_id_and_id' + NEW_INDEX_NAME_2 = 'index_issues_on_project_id_closed_at_state_id_and_id' + + def up + # Index to improve performance when sorting issues by closed_at desc + prepare_async_index :issues, 'project_id, closed_at DESC NULLS LAST, state_id, id', name: NEW_INDEX_NAME_1 + + # Index to improve performance when sorting issues by closed_at asc + # This replaces the old index which didn't account for state_id and id + prepare_async_index :issues, [:project_id, :closed_at, :state_id, :id], name: NEW_INDEX_NAME_2 + end + + def down + unprepare_async_index_by_name :issues, NEW_INDEX_NAME_1 + unprepare_async_index_by_name :issues, NEW_INDEX_NAME_2 + end +end diff --git a/db/post_migrate/20220616222253_remove_ci_secure_files_permissions_column.rb b/db/post_migrate/20220616222253_remove_ci_secure_files_permissions_column.rb new file mode 100644 index 00000000000..31c559a9d44 --- /dev/null +++ b/db/post_migrate/20220616222253_remove_ci_secure_files_permissions_column.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveCiSecureFilesPermissionsColumn < Gitlab::Database::Migration[2.0] + def up + remove_column :ci_secure_files, :permissions + end + + def down + add_column :ci_secure_files, :permissions, :integer, null: false, default: 0, limit: 2 + end +end diff --git a/db/post_migrate/20220617073407_add_index_for_open_issues_count.rb b/db/post_migrate/20220617073407_add_index_for_open_issues_count.rb new file mode 100644 index 00000000000..5c11e7b1b9a --- /dev/null +++ b/db/post_migrate/20220617073407_add_index_for_open_issues_count.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIndexForOpenIssuesCount < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'idx_open_issues_on_project_id_and_confidential' + + def up + add_concurrent_index :issues, [:project_id, :confidential], where: 'state_id = 1', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :issues, INDEX_NAME + end +end diff --git a/db/schema_migrations/20220128103042 b/db/schema_migrations/20220128103042 new file mode 100644 index 00000000000..de1e50b66bf --- /dev/null +++ b/db/schema_migrations/20220128103042 @@ -0,0 +1 @@ +57813d4c107938d8e58d6223719c2c67206172342b52655ca4a068c845edeb3a
\ No newline at end of file diff --git a/db/schema_migrations/20220314094841 b/db/schema_migrations/20220314094841 new file mode 100644 index 00000000000..f214ecaa9b3 --- /dev/null +++ b/db/schema_migrations/20220314094841 @@ -0,0 +1 @@ +eabdb1e45a67947401963a971f24ae1b19068c72f5d4dd61d7fd47b8e61f1ed2
\ No newline at end of file diff --git a/db/schema_migrations/20220329092245 b/db/schema_migrations/20220329092245 new file mode 100644 index 00000000000..5d7ceab6d6d --- /dev/null +++ b/db/schema_migrations/20220329092245 @@ -0,0 +1 @@ +79643fafa7ebc5374980fc1ef34b3f5ee5a231172420192895b227a31c552e6a
\ No newline at end of file diff --git a/db/schema_migrations/20220407163559 b/db/schema_migrations/20220407163559 new file mode 100644 index 00000000000..e0517db3672 --- /dev/null +++ b/db/schema_migrations/20220407163559 @@ -0,0 +1 @@ +dabbd8b95ec49b4267d53768013b4e62ae1219a4575dc8b0fccb0e117e725885
\ No newline at end of file diff --git a/db/schema_migrations/20220418180958 b/db/schema_migrations/20220418180958 new file mode 100644 index 00000000000..74aaa9c2f46 --- /dev/null +++ b/db/schema_migrations/20220418180958 @@ -0,0 +1 @@ +0108fa3b92704107f712552b51eb3addd53f1482db4866a3b8ccaba2a52239ba
\ No newline at end of file diff --git a/db/schema_migrations/20220503035221 b/db/schema_migrations/20220503035221 new file mode 100644 index 00000000000..40b89d95db8 --- /dev/null +++ b/db/schema_migrations/20220503035221 @@ -0,0 +1 @@ +0eeb96f26d8f8372c70f9aef59e976c4d403ec6aec01ad8784d31a7594bbaee2
\ No newline at end of file diff --git a/db/schema_migrations/20220503035437 b/db/schema_migrations/20220503035437 new file mode 100644 index 00000000000..964d0bb4944 --- /dev/null +++ b/db/schema_migrations/20220503035437 @@ -0,0 +1 @@ +78306ca94e5f8e595d496efff983ed4749ee841ca8e2633afdb0cc5cb077e96a
\ No newline at end of file diff --git a/db/schema_migrations/20220506123922 b/db/schema_migrations/20220506123922 new file mode 100644 index 00000000000..b905016fab3 --- /dev/null +++ b/db/schema_migrations/20220506123922 @@ -0,0 +1 @@ +df23d0cae2b318de6f1426f21cf895ba6118f3e5397ac28ad6c95c709648614c
\ No newline at end of file diff --git a/db/schema_migrations/20220506124021 b/db/schema_migrations/20220506124021 new file mode 100644 index 00000000000..b435705c554 --- /dev/null +++ b/db/schema_migrations/20220506124021 @@ -0,0 +1 @@ +07b19935546757b89800ef681eefd8de915caaa709bed038347a262e1da49553
\ No newline at end of file diff --git a/db/schema_migrations/20220510121338 b/db/schema_migrations/20220510121338 new file mode 100644 index 00000000000..8d41973afd1 --- /dev/null +++ b/db/schema_migrations/20220510121338 @@ -0,0 +1 @@ +6f77ac586d48274a8f88384808b56ecad33a8ce00488595c0f82a074b45d5634
\ No newline at end of file diff --git a/db/schema_migrations/20220510192117 b/db/schema_migrations/20220510192117 new file mode 100644 index 00000000000..949b14b83e5 --- /dev/null +++ b/db/schema_migrations/20220510192117 @@ -0,0 +1 @@ +bb3c52967d818984d1f5350c8fefa6e83e38f2c105e89ebd7ceb39f59587f2b2
\ No newline at end of file diff --git a/db/schema_migrations/20220511144946 b/db/schema_migrations/20220511144946 new file mode 100644 index 00000000000..c443848a5fb --- /dev/null +++ b/db/schema_migrations/20220511144946 @@ -0,0 +1 @@ +a11b32eeb9269e70ab0457eea3fbd42520e15fa6c089b349e4f9655190678cff
\ No newline at end of file diff --git a/db/schema_migrations/20220511212620 b/db/schema_migrations/20220511212620 new file mode 100644 index 00000000000..6d86b6701c1 --- /dev/null +++ b/db/schema_migrations/20220511212620 @@ -0,0 +1 @@ +6f8ddb4ba8931d00caa05e193a238add12176e82e25692186595ab0d847c74ea
\ No newline at end of file diff --git a/db/schema_migrations/20220512020500 b/db/schema_migrations/20220512020500 new file mode 100644 index 00000000000..86830de0c9d --- /dev/null +++ b/db/schema_migrations/20220512020500 @@ -0,0 +1 @@ +16071cd85b772d86242ced867ba2f8c5e317222f6c3297e15dd456de13b4926e
\ No newline at end of file diff --git a/db/schema_migrations/20220512190659 b/db/schema_migrations/20220512190659 new file mode 100644 index 00000000000..a3ea4c1b46e --- /dev/null +++ b/db/schema_migrations/20220512190659 @@ -0,0 +1 @@ +bbd6be6772f4fc5aecf393d6c043c1fdc38fdde6efd1586ba4be08ddbb5886dd
\ No newline at end of file diff --git a/db/schema_migrations/20220513093614 b/db/schema_migrations/20220513093614 new file mode 100644 index 00000000000..2fd5b217597 --- /dev/null +++ b/db/schema_migrations/20220513093614 @@ -0,0 +1 @@ +a10b3c81942eacdd4d378e8f1d1e28b974e973ef163ddfbe0cdea1f63b275dd1
\ No newline at end of file diff --git a/db/schema_migrations/20220513093615 b/db/schema_migrations/20220513093615 new file mode 100644 index 00000000000..3b306069feb --- /dev/null +++ b/db/schema_migrations/20220513093615 @@ -0,0 +1 @@ +a070aa428ef721bccfc1499dae04d0796877796339380370c3f32f7e12c029df
\ No newline at end of file diff --git a/db/schema_migrations/20220513095545 b/db/schema_migrations/20220513095545 new file mode 100644 index 00000000000..4fcca18a7ee --- /dev/null +++ b/db/schema_migrations/20220513095545 @@ -0,0 +1 @@ +0afca448dc191db604d35f1e675f4342390f77542851c2ff716fd9225a9fa5a0
\ No newline at end of file diff --git a/db/schema_migrations/20220513114706 b/db/schema_migrations/20220513114706 new file mode 100644 index 00000000000..da89cabb56c --- /dev/null +++ b/db/schema_migrations/20220513114706 @@ -0,0 +1 @@ +b7b0de56866be5e598ba18c4e94ebc9e7deae3c8d62e789f83db34729e080c7b
\ No newline at end of file diff --git a/db/schema_migrations/20220513114850 b/db/schema_migrations/20220513114850 new file mode 100644 index 00000000000..2e78bcd93a2 --- /dev/null +++ b/db/schema_migrations/20220513114850 @@ -0,0 +1 @@ +3519e7552ea0e7f76c5ce3e853072afdfa5485387398565a9c222e4761b4fa9b
\ No newline at end of file diff --git a/db/schema_migrations/20220516054002 b/db/schema_migrations/20220516054002 new file mode 100644 index 00000000000..3a9f63f2122 --- /dev/null +++ b/db/schema_migrations/20220516054002 @@ -0,0 +1 @@ +72412b4e47f69737ecc50f234d182b2bb9c7d0a03426baffec137651613468c6
\ No newline at end of file diff --git a/db/schema_migrations/20220516054011 b/db/schema_migrations/20220516054011 new file mode 100644 index 00000000000..0a1dff834ce --- /dev/null +++ b/db/schema_migrations/20220516054011 @@ -0,0 +1 @@ +23e7a5c3ea535b7faf0e9ba3e95d8ca1431ba96f5f431e0fed0e0c8df340d882
\ No newline at end of file diff --git a/db/schema_migrations/20220516092207 b/db/schema_migrations/20220516092207 new file mode 100644 index 00000000000..8731d03e39e --- /dev/null +++ b/db/schema_migrations/20220516092207 @@ -0,0 +1 @@ +c55f8c6e45e933207eae2036cd2705530bce5c79ff54ac3e33cef111949c736d
\ No newline at end of file diff --git a/db/schema_migrations/20220516100652 b/db/schema_migrations/20220516100652 new file mode 100644 index 00000000000..a50dc3ff36c --- /dev/null +++ b/db/schema_migrations/20220516100652 @@ -0,0 +1 @@ +ee255f9340fe64793636217a5115c368e0bd067cba057bb58aa78f370efae423
\ No newline at end of file diff --git a/db/schema_migrations/20220516103353 b/db/schema_migrations/20220516103353 new file mode 100644 index 00000000000..0f0d30f0ec6 --- /dev/null +++ b/db/schema_migrations/20220516103353 @@ -0,0 +1 @@ +68327ee0eb01df152d2420fc31e586be0c5d40460c09cc43a1e955e84e5f00fc
\ No newline at end of file diff --git a/db/schema_migrations/20220516123101 b/db/schema_migrations/20220516123101 new file mode 100644 index 00000000000..ea64cc0ea46 --- /dev/null +++ b/db/schema_migrations/20220516123101 @@ -0,0 +1 @@ +e1421ae1b1f021c5aa1546b7ffdbab4fb26e6fbbe0d1d0d4f57cb39735bc0221
\ No newline at end of file diff --git a/db/schema_migrations/20220516201245 b/db/schema_migrations/20220516201245 new file mode 100644 index 00000000000..eabfba67df8 --- /dev/null +++ b/db/schema_migrations/20220516201245 @@ -0,0 +1 @@ +4b979c4ae290efdbc7c4bfe7105f0b30d00e532ac11c579db7417a317fd35db8
\ No newline at end of file diff --git a/db/schema_migrations/20220517101119 b/db/schema_migrations/20220517101119 new file mode 100644 index 00000000000..18c25e858dc --- /dev/null +++ b/db/schema_migrations/20220517101119 @@ -0,0 +1 @@ +74585dbb76b6744533a1df5dc995b461798fe8d0e0cd37fb6f9d52958f87a403
\ No newline at end of file diff --git a/db/schema_migrations/20220517133753 b/db/schema_migrations/20220517133753 new file mode 100644 index 00000000000..295658d34a2 --- /dev/null +++ b/db/schema_migrations/20220517133753 @@ -0,0 +1 @@ +eadee7b8b85cce48f48dbdab2f5e0b8cd633ef4ef8363960b7de1eb73a6fe1aa
\ No newline at end of file diff --git a/db/schema_migrations/20220517182529 b/db/schema_migrations/20220517182529 new file mode 100644 index 00000000000..29afb5009d5 --- /dev/null +++ b/db/schema_migrations/20220517182529 @@ -0,0 +1 @@ +b47c2ddd218df29117d3c69d59819eed67b83a6d687547a44c1b31b302c005a5
\ No newline at end of file diff --git a/db/schema_migrations/20220518102414 b/db/schema_migrations/20220518102414 new file mode 100644 index 00000000000..4c614b132b0 --- /dev/null +++ b/db/schema_migrations/20220518102414 @@ -0,0 +1 @@ +753b40cdcd5d7b23098c1f7a7f68e25132a75bf1343f59dee583d5a55168f8be
\ No newline at end of file diff --git a/db/schema_migrations/20220518183504 b/db/schema_migrations/20220518183504 new file mode 100644 index 00000000000..6eb9eb50a53 --- /dev/null +++ b/db/schema_migrations/20220518183504 @@ -0,0 +1 @@ +925cd6bbfc67d0f5748c48b960ef1f932370fe078a979440b6bb32d049c2a9a8
\ No newline at end of file diff --git a/db/schema_migrations/20220518183548 b/db/schema_migrations/20220518183548 new file mode 100644 index 00000000000..6023c31fe51 --- /dev/null +++ b/db/schema_migrations/20220518183548 @@ -0,0 +1 @@ +a79526f7eb59fc93d66ff1a58471c9a3de27f8e620b5f3d4a255c88687a5bf2a
\ No newline at end of file diff --git a/db/schema_migrations/20220519013213 b/db/schema_migrations/20220519013213 new file mode 100644 index 00000000000..c3575b668e4 --- /dev/null +++ b/db/schema_migrations/20220519013213 @@ -0,0 +1 @@ +d8ae65034a7768c238a65c4c36d709364dee65652da93c368774e3828b0edb41
\ No newline at end of file diff --git a/db/schema_migrations/20220519045133 b/db/schema_migrations/20220519045133 new file mode 100644 index 00000000000..099a74f8b34 --- /dev/null +++ b/db/schema_migrations/20220519045133 @@ -0,0 +1 @@ +99fd05c3102300c115edf09a54feddfd9721bf63ae09063e6dc9d568be6d8f1f
\ No newline at end of file diff --git a/db/schema_migrations/20220519141345 b/db/schema_migrations/20220519141345 new file mode 100644 index 00000000000..45b67d9cc53 --- /dev/null +++ b/db/schema_migrations/20220519141345 @@ -0,0 +1 @@ +ff20989814782030135a9c55831896b89275293f04d7edbb4a5b6ae568d2a455
\ No newline at end of file diff --git a/db/schema_migrations/20220520030504 b/db/schema_migrations/20220520030504 new file mode 100644 index 00000000000..284d859b42d --- /dev/null +++ b/db/schema_migrations/20220520030504 @@ -0,0 +1 @@ +4d44b5cd1bcd731e841849c65f64a19960fa13cd90d1bda023e797db20b8b8c6
\ No newline at end of file diff --git a/db/schema_migrations/20220520040416 b/db/schema_migrations/20220520040416 new file mode 100644 index 00000000000..2444438b2e4 --- /dev/null +++ b/db/schema_migrations/20220520040416 @@ -0,0 +1 @@ +5055a0f5fd7125d353654be2425c881afa42a3b09eb0ab34dd0929b3440aa643
\ No newline at end of file diff --git a/db/schema_migrations/20220520122755 b/db/schema_migrations/20220520122755 new file mode 100644 index 00000000000..5f627846e88 --- /dev/null +++ b/db/schema_migrations/20220520122755 @@ -0,0 +1 @@ +aac34066922d445a3dfe0c527b500000e0296cae84e38e9e31f721cd4b213d17
\ No newline at end of file diff --git a/db/schema_migrations/20220520143105 b/db/schema_migrations/20220520143105 new file mode 100644 index 00000000000..f0cdbdfa734 --- /dev/null +++ b/db/schema_migrations/20220520143105 @@ -0,0 +1 @@ +f31157879c1d7e2f08a63b4c68ed0353fd6df1e885cb7f3838aba7e1c782394c
\ No newline at end of file diff --git a/db/schema_migrations/20220520144821 b/db/schema_migrations/20220520144821 new file mode 100644 index 00000000000..47cb5507cb7 --- /dev/null +++ b/db/schema_migrations/20220520144821 @@ -0,0 +1 @@ +422c8b5559d262be47da020fe43628db1b19cb638c9c9c4dbe5af1ee03c5cdc9
\ No newline at end of file diff --git a/db/schema_migrations/20220523030804 b/db/schema_migrations/20220523030804 new file mode 100644 index 00000000000..6a9bdd4f66d --- /dev/null +++ b/db/schema_migrations/20220523030804 @@ -0,0 +1 @@ +80535374849c10d41663d339b95b9ffddbec9b40a8af4585c18602cbe92c14d1
\ No newline at end of file diff --git a/db/schema_migrations/20220523030805 b/db/schema_migrations/20220523030805 new file mode 100644 index 00000000000..3714e71a3f3 --- /dev/null +++ b/db/schema_migrations/20220523030805 @@ -0,0 +1 @@ +92a7ed079521ccb8ab04e59826947778c37bccd30d47f1b0e29727f769e3ff32
\ No newline at end of file diff --git a/db/schema_migrations/20220523171107 b/db/schema_migrations/20220523171107 new file mode 100644 index 00000000000..470edcb4633 --- /dev/null +++ b/db/schema_migrations/20220523171107 @@ -0,0 +1 @@ +5b21dda35554a77388dae289e24df405852ae60bb5947edd061bc3dc595b000d
\ No newline at end of file diff --git a/db/schema_migrations/20220524021855 b/db/schema_migrations/20220524021855 new file mode 100644 index 00000000000..2738ba4fb41 --- /dev/null +++ b/db/schema_migrations/20220524021855 @@ -0,0 +1 @@ +549bca1a8f6f33b4044da0ff453cf3e55615697be98366ecdcdc7bbbac2533ef
\ No newline at end of file diff --git a/db/schema_migrations/20220524074947 b/db/schema_migrations/20220524074947 new file mode 100644 index 00000000000..2f6988c8ada --- /dev/null +++ b/db/schema_migrations/20220524074947 @@ -0,0 +1 @@ +377a05674a9f0fb3a2e77ec25effe8b380381d6b827d987afd5a717f73d6d782
\ No newline at end of file diff --git a/db/schema_migrations/20220524080944 b/db/schema_migrations/20220524080944 new file mode 100644 index 00000000000..d6a7c196dc8 --- /dev/null +++ b/db/schema_migrations/20220524080944 @@ -0,0 +1 @@ +af9fd2e51f9781c16528cdb929328346a87c7199275f101efb1c21b7d56b4255
\ No newline at end of file diff --git a/db/schema_migrations/20220524081955 b/db/schema_migrations/20220524081955 new file mode 100644 index 00000000000..62c3483e581 --- /dev/null +++ b/db/schema_migrations/20220524081955 @@ -0,0 +1 @@ +5defac462c6b6bf9e1af542d07bfe23af52ed01ddbb77f43bb206f08090fc098
\ No newline at end of file diff --git a/db/schema_migrations/20220524132416 b/db/schema_migrations/20220524132416 new file mode 100644 index 00000000000..b9e08078784 --- /dev/null +++ b/db/schema_migrations/20220524132416 @@ -0,0 +1 @@ +e4b944d4b2107b203593187e8cefc89df276ce01a93e6b0795c0d710e8f81da2
\ No newline at end of file diff --git a/db/schema_migrations/20220524141800 b/db/schema_migrations/20220524141800 new file mode 100644 index 00000000000..fd15c443b08 --- /dev/null +++ b/db/schema_migrations/20220524141800 @@ -0,0 +1 @@ +9dddbbdb3e72763cc331b5690536312970c92c64d66d7cb2efc118c107ae204c
\ No newline at end of file diff --git a/db/schema_migrations/20220524191259 b/db/schema_migrations/20220524191259 new file mode 100644 index 00000000000..3b9ff7652a3 --- /dev/null +++ b/db/schema_migrations/20220524191259 @@ -0,0 +1 @@ +995c41ab830a9635bef37031d8fa741f5759ba9bb22bb02141502bf322165c77
\ No newline at end of file diff --git a/db/schema_migrations/20220524202158 b/db/schema_migrations/20220524202158 new file mode 100644 index 00000000000..3df81f0c5c2 --- /dev/null +++ b/db/schema_migrations/20220524202158 @@ -0,0 +1 @@ +21f37004086f6d7f606791dd7caeb7c5ca701b009689932eb9ea4eb653e3e0dc
\ No newline at end of file diff --git a/db/schema_migrations/20220525082303 b/db/schema_migrations/20220525082303 new file mode 100644 index 00000000000..9189c9713a0 --- /dev/null +++ b/db/schema_migrations/20220525082303 @@ -0,0 +1 @@ +265effde7f2abd222d5b7101c6d03a185ee3deeb6be772016f06e1eade84c1f3
\ No newline at end of file diff --git a/db/schema_migrations/20220525123825 b/db/schema_migrations/20220525123825 new file mode 100644 index 00000000000..47d4bc2c8a3 --- /dev/null +++ b/db/schema_migrations/20220525123825 @@ -0,0 +1 @@ +8a30ec71e2c28929e0a7ebf744941246e460c37745e60dcd9f13a94b7d005772
\ No newline at end of file diff --git a/db/schema_migrations/20220525123851 b/db/schema_migrations/20220525123851 new file mode 100644 index 00000000000..fd16775f784 --- /dev/null +++ b/db/schema_migrations/20220525123851 @@ -0,0 +1 @@ +f6fcea6f6beef6c2d4848bd4bc11f0854acc9e19771438778f763171e0eaa3c7
\ No newline at end of file diff --git a/db/schema_migrations/20220525123914 b/db/schema_migrations/20220525123914 new file mode 100644 index 00000000000..564ceb0dbe2 --- /dev/null +++ b/db/schema_migrations/20220525123914 @@ -0,0 +1 @@ +504e43ab17c644707c65e396b8aa88a11472372a9c3b8d2b9ef88b9de978b0c3
\ No newline at end of file diff --git a/db/schema_migrations/20220525123940 b/db/schema_migrations/20220525123940 new file mode 100644 index 00000000000..7bb5b598247 --- /dev/null +++ b/db/schema_migrations/20220525123940 @@ -0,0 +1 @@ +7ddd1f03efe86f45b6105c6b0816e28e318e9de219dcd38801a11451745ae5f9
\ No newline at end of file diff --git a/db/schema_migrations/20220525124104 b/db/schema_migrations/20220525124104 new file mode 100644 index 00000000000..229fb6ae2a6 --- /dev/null +++ b/db/schema_migrations/20220525124104 @@ -0,0 +1 @@ +8c1ccabb6d2b3054398a015836bb9fe06f28936625f7a8220b4c58000a891b8a
\ No newline at end of file diff --git a/db/schema_migrations/20220525124125 b/db/schema_migrations/20220525124125 new file mode 100644 index 00000000000..8ccc434a7ac --- /dev/null +++ b/db/schema_migrations/20220525124125 @@ -0,0 +1 @@ +5e9f67479903590d5118e04811bc3c4aacf92fd11b90efa011975d4292dd0207
\ No newline at end of file diff --git a/db/schema_migrations/20220525131557 b/db/schema_migrations/20220525131557 new file mode 100644 index 00000000000..c1b29410ef0 --- /dev/null +++ b/db/schema_migrations/20220525131557 @@ -0,0 +1 @@ +fe0e9acc39c2408853ea3fc35574c553172ad381a5b6f243578f44ed77dc75f8
\ No newline at end of file diff --git a/db/schema_migrations/20220525131624 b/db/schema_migrations/20220525131624 new file mode 100644 index 00000000000..71a3d6d26d2 --- /dev/null +++ b/db/schema_migrations/20220525131624 @@ -0,0 +1 @@ +f34c6e7b75d375342f5c88a9c7b98e15031a6dcdadf7e7dad862ef5f32a54e68
\ No newline at end of file diff --git a/db/schema_migrations/20220525141540 b/db/schema_migrations/20220525141540 new file mode 100644 index 00000000000..5d44edb76dd --- /dev/null +++ b/db/schema_migrations/20220525141540 @@ -0,0 +1 @@ +ecb575072a1176378b180e95090915b191792ce350df84c6a0c198dfb816df96
\ No newline at end of file diff --git a/db/schema_migrations/20220525165334 b/db/schema_migrations/20220525165334 new file mode 100644 index 00000000000..6e30325b09f --- /dev/null +++ b/db/schema_migrations/20220525165334 @@ -0,0 +1 @@ +18e144b7ab897f77679096db30a84c491b94552ff34e6b9ff66d106a59fdb412
\ No newline at end of file diff --git a/db/schema_migrations/20220525172001 b/db/schema_migrations/20220525172001 new file mode 100644 index 00000000000..25755af7ae6 --- /dev/null +++ b/db/schema_migrations/20220525172001 @@ -0,0 +1 @@ +37f90c51322b961933b0aaa5b4d2b8d1f82bd3ee42209b241b9e1198f16adb59
\ No newline at end of file diff --git a/db/schema_migrations/20220526042017 b/db/schema_migrations/20220526042017 new file mode 100644 index 00000000000..ac391e2aa5b --- /dev/null +++ b/db/schema_migrations/20220526042017 @@ -0,0 +1 @@ +2f814744441d104b0d5e533c7f27f4b9284563f20f3bd332a876fee2b4a8b6a0
\ No newline at end of file diff --git a/db/schema_migrations/20220526044516 b/db/schema_migrations/20220526044516 new file mode 100644 index 00000000000..71241178af6 --- /dev/null +++ b/db/schema_migrations/20220526044516 @@ -0,0 +1 @@ +e9f7958f28a6dc22d907052e3c58c2213b97110fdfedffee97b37bd1293e2dd0
\ No newline at end of file diff --git a/db/schema_migrations/20220530044712 b/db/schema_migrations/20220530044712 new file mode 100644 index 00000000000..0277bc87f9f --- /dev/null +++ b/db/schema_migrations/20220530044712 @@ -0,0 +1 @@ +e76914c24f23d352e275387330a8731afb409fe9ae1168c1ee25f5acf5424c07
\ No newline at end of file diff --git a/db/schema_migrations/20220530074027 b/db/schema_migrations/20220530074027 new file mode 100644 index 00000000000..418f778a8c3 --- /dev/null +++ b/db/schema_migrations/20220530074027 @@ -0,0 +1 @@ +3cef4a4f50ebe3d8e23e9c014a57e4c98f8fd27a9f071725a882c5a1a4d228cc
\ No newline at end of file diff --git a/db/schema_migrations/20220530082653 b/db/schema_migrations/20220530082653 new file mode 100644 index 00000000000..7a0bc6f25d6 --- /dev/null +++ b/db/schema_migrations/20220530082653 @@ -0,0 +1 @@ +c049b15e29578180f42701764f27b5301561f2dfb7a2d289f84d69feae70b33f
\ No newline at end of file diff --git a/db/schema_migrations/20220530103023 b/db/schema_migrations/20220530103023 new file mode 100644 index 00000000000..f4a0d805208 --- /dev/null +++ b/db/schema_migrations/20220530103023 @@ -0,0 +1 @@ +8ad5a7cb60abd381850569ddf5ab274d66cf1960d11073825a283f902171b343
\ No newline at end of file diff --git a/db/schema_migrations/20220530104431 b/db/schema_migrations/20220530104431 new file mode 100644 index 00000000000..4e809f44d25 --- /dev/null +++ b/db/schema_migrations/20220530104431 @@ -0,0 +1 @@ +f49e691c46ddaaf1b18d95726e7c2473fab946ea79885727ba09bb92591e4a01
\ No newline at end of file diff --git a/db/schema_migrations/20220530170915 b/db/schema_migrations/20220530170915 new file mode 100644 index 00000000000..9fa7d0128a2 --- /dev/null +++ b/db/schema_migrations/20220530170915 @@ -0,0 +1 @@ +6182d4a468348076aab761714990dd55f69f44a5fafcf566fd11b73486c7d656
\ No newline at end of file diff --git a/db/schema_migrations/20220531024142 b/db/schema_migrations/20220531024142 new file mode 100644 index 00000000000..7d62f03921c --- /dev/null +++ b/db/schema_migrations/20220531024142 @@ -0,0 +1 @@ +d2f51bc463e31d4097c86232b85fff0c4cffe091aac23ba30b4b2851e12a253c
\ No newline at end of file diff --git a/db/schema_migrations/20220531024143 b/db/schema_migrations/20220531024143 new file mode 100644 index 00000000000..72293d5a72f --- /dev/null +++ b/db/schema_migrations/20220531024143 @@ -0,0 +1 @@ +50839e8a00962e423093c9f80534efb1d11b750c11d0602537a83033d1c3638f
\ No newline at end of file diff --git a/db/schema_migrations/20220531100920 b/db/schema_migrations/20220531100920 new file mode 100644 index 00000000000..8010729a4a1 --- /dev/null +++ b/db/schema_migrations/20220531100920 @@ -0,0 +1 @@ +55c13dd2cf8db2ca54d3fb1bd09d459e90a90e01b3c1f7ad950e4b618df241af
\ No newline at end of file diff --git a/db/schema_migrations/20220531233600 b/db/schema_migrations/20220531233600 new file mode 100644 index 00000000000..9c3ff7531bd --- /dev/null +++ b/db/schema_migrations/20220531233600 @@ -0,0 +1 @@ +10676671b1893267c3c466d74a2e9a66525df7c5706eed56afe4fdcb734211cd
\ No newline at end of file diff --git a/db/schema_migrations/20220601040233 b/db/schema_migrations/20220601040233 new file mode 100644 index 00000000000..5acfd2851ca --- /dev/null +++ b/db/schema_migrations/20220601040233 @@ -0,0 +1 @@ +d7e3650b7f83a324c6c7f8da0ec37096c0e538072ab8fd0ac00672fa02e92c77
\ No newline at end of file diff --git a/db/schema_migrations/20220601091804 b/db/schema_migrations/20220601091804 new file mode 100644 index 00000000000..097486be77c --- /dev/null +++ b/db/schema_migrations/20220601091804 @@ -0,0 +1 @@ +3d3c9b4aa88008c907b583db08e1246cd227414147b41f45b63e4ca1cc24de66
\ No newline at end of file diff --git a/db/schema_migrations/20220601091805 b/db/schema_migrations/20220601091805 new file mode 100644 index 00000000000..72668b26307 --- /dev/null +++ b/db/schema_migrations/20220601091805 @@ -0,0 +1 @@ +930a6a853626c3a9f5a529105bf4e4cb8cef9b6f948ccb4faaaf0dcb7a5a2544
\ No newline at end of file diff --git a/db/schema_migrations/20220601101800 b/db/schema_migrations/20220601101800 new file mode 100644 index 00000000000..c1abb83e472 --- /dev/null +++ b/db/schema_migrations/20220601101800 @@ -0,0 +1 @@ +c75a7375240fdd785f873b1a39173efec51d23e16808d23c24a6550604f080ad
\ No newline at end of file diff --git a/db/schema_migrations/20220601223501 b/db/schema_migrations/20220601223501 new file mode 100644 index 00000000000..86abed4fa45 --- /dev/null +++ b/db/schema_migrations/20220601223501 @@ -0,0 +1 @@ +5012f2becb04485a67df5fa0acdf7c73a9410368493256f4774af297de5f86e8
\ No newline at end of file diff --git a/db/schema_migrations/20220602070502 b/db/schema_migrations/20220602070502 new file mode 100644 index 00000000000..68cfe781ef8 --- /dev/null +++ b/db/schema_migrations/20220602070502 @@ -0,0 +1 @@ +9c66d020895c534280862136a08477fe3715465bdeb9d3e7dd632005c19de474
\ No newline at end of file diff --git a/db/schema_migrations/20220602111923 b/db/schema_migrations/20220602111923 new file mode 100644 index 00000000000..9092decdc13 --- /dev/null +++ b/db/schema_migrations/20220602111923 @@ -0,0 +1 @@ +9e11ca08c76940af55e74c7d590ca835db1903b11139f64085fdd59fd6ea9206
\ No newline at end of file diff --git a/db/schema_migrations/20220602130306 b/db/schema_migrations/20220602130306 new file mode 100644 index 00000000000..836f2385b65 --- /dev/null +++ b/db/schema_migrations/20220602130306 @@ -0,0 +1 @@ +493009101e8b1340507ff8cf5d6add16f848d8d99f0b6091bf7b07105f711304
\ No newline at end of file diff --git a/db/schema_migrations/20220603095158 b/db/schema_migrations/20220603095158 new file mode 100644 index 00000000000..3b5bf052908 --- /dev/null +++ b/db/schema_migrations/20220603095158 @@ -0,0 +1 @@ +7948214753beae50164c7ffa4783ca32d8a974223730c788a527c0218da06cbc
\ No newline at end of file diff --git a/db/schema_migrations/20220605170009 b/db/schema_migrations/20220605170009 new file mode 100644 index 00000000000..d32297ec7d1 --- /dev/null +++ b/db/schema_migrations/20220605170009 @@ -0,0 +1 @@ +b3661dbf8254ed37356a1164718c372cf5828fe7aa0218fd02feb1c00370e86f
\ No newline at end of file diff --git a/db/schema_migrations/20220606060825 b/db/schema_migrations/20220606060825 new file mode 100644 index 00000000000..21ba4a16ba6 --- /dev/null +++ b/db/schema_migrations/20220606060825 @@ -0,0 +1 @@ +3c0e1b1bdf658a1335ecd61e5409d428d1ff1827a9f13a9dbb8df7757a899b59
\ No newline at end of file diff --git a/db/schema_migrations/20220606060850 b/db/schema_migrations/20220606060850 new file mode 100644 index 00000000000..33e7ce68d44 --- /dev/null +++ b/db/schema_migrations/20220606060850 @@ -0,0 +1 @@ +86abe66430f55f57cd528af90bbc364d75466ea44f8016c54b9734d123ae69a4
\ No newline at end of file diff --git a/db/schema_migrations/20220607011733 b/db/schema_migrations/20220607011733 new file mode 100644 index 00000000000..7581765679c --- /dev/null +++ b/db/schema_migrations/20220607011733 @@ -0,0 +1 @@ +2d4dd4b889b5fc9c3f329669734f086997ebb514ed62afe6ca4220fc525797c9
\ No newline at end of file diff --git a/db/schema_migrations/20220607095219 b/db/schema_migrations/20220607095219 new file mode 100644 index 00000000000..e33cda54391 --- /dev/null +++ b/db/schema_migrations/20220607095219 @@ -0,0 +1 @@ +64d492cca82603147226c9b0e6f424d2d2ba7a17ea0fe022510fb376016028e1
\ No newline at end of file diff --git a/db/schema_migrations/20220607115703 b/db/schema_migrations/20220607115703 new file mode 100644 index 00000000000..9a4c705041b --- /dev/null +++ b/db/schema_migrations/20220607115703 @@ -0,0 +1 @@ +2103b06971a8c41172a046b61bf62fea4312c29391aaf747e30e1aa8b2c6313c
\ No newline at end of file diff --git a/db/schema_migrations/20220607140222 b/db/schema_migrations/20220607140222 new file mode 100644 index 00000000000..6a8c7b5bedd --- /dev/null +++ b/db/schema_migrations/20220607140222 @@ -0,0 +1 @@ +cbbcc9c2439ff583489239afaadb6b18fc86286360745565af52b9baebbf436e
\ No newline at end of file diff --git a/db/schema_migrations/20220608114734 b/db/schema_migrations/20220608114734 new file mode 100644 index 00000000000..7f9a1972827 --- /dev/null +++ b/db/schema_migrations/20220608114734 @@ -0,0 +1 @@ +282fb55b257baa432f9e7aa97901ef61c58fd8e5dee2e687b21af54db9d37d03
\ No newline at end of file diff --git a/db/schema_migrations/20220609150626 b/db/schema_migrations/20220609150626 new file mode 100644 index 00000000000..f0f54d885cf --- /dev/null +++ b/db/schema_migrations/20220609150626 @@ -0,0 +1 @@ +93e90cbe1fff08de997134dab382dce7c341dd9f4cc16302cac09ce34a419d2d
\ No newline at end of file diff --git a/db/schema_migrations/20220609195803 b/db/schema_migrations/20220609195803 new file mode 100644 index 00000000000..c657c73693e --- /dev/null +++ b/db/schema_migrations/20220609195803 @@ -0,0 +1 @@ +8f9a2af299249b0472e9f1e4b17cdd442abfbeaffa658733cfa9b6db7574fc88
\ No newline at end of file diff --git a/db/schema_migrations/20220610074326 b/db/schema_migrations/20220610074326 new file mode 100644 index 00000000000..8ab6ca66af9 --- /dev/null +++ b/db/schema_migrations/20220610074326 @@ -0,0 +1 @@ +fdd1282379c79b3d638baf35257c276ec38c7b70a924cc678db55d6af3b701b1
\ No newline at end of file diff --git a/db/schema_migrations/20220610125248 b/db/schema_migrations/20220610125248 new file mode 100644 index 00000000000..25e863f8c14 --- /dev/null +++ b/db/schema_migrations/20220610125248 @@ -0,0 +1 @@ +8ba7386e21ebb3ac082e322059b41d423cede484e60748222de6a0673c3ca41f
\ No newline at end of file diff --git a/db/schema_migrations/20220610223040 b/db/schema_migrations/20220610223040 new file mode 100644 index 00000000000..8aee145e29d --- /dev/null +++ b/db/schema_migrations/20220610223040 @@ -0,0 +1 @@ +1b670d02f021f81e3541a789915244238c78e234e6eb0e9a6476328f92686667
\ No newline at end of file diff --git a/db/schema_migrations/20220613095911 b/db/schema_migrations/20220613095911 new file mode 100644 index 00000000000..c2f60fafd11 --- /dev/null +++ b/db/schema_migrations/20220613095911 @@ -0,0 +1 @@ +1d2dc45d6fae911d75eaf5970afbae6d2f31d2efd1c27b75fce5feacbcc319d3
\ No newline at end of file diff --git a/db/schema_migrations/20220614095912 b/db/schema_migrations/20220614095912 new file mode 100644 index 00000000000..e84b4a2fb3d --- /dev/null +++ b/db/schema_migrations/20220614095912 @@ -0,0 +1 @@ +96d899efc1fa39cf3433987ee4d8062456f7a6af6248b97eda2ddc5491dcf7f5
\ No newline at end of file diff --git a/db/schema_migrations/20220615091059 b/db/schema_migrations/20220615091059 new file mode 100644 index 00000000000..1d1b35fc8f6 --- /dev/null +++ b/db/schema_migrations/20220615091059 @@ -0,0 +1 @@ +bbfcaf59734b67142b237b7ea479c5eaa3c2152cdd84c87ad541e5a0e75466ef
\ No newline at end of file diff --git a/db/schema_migrations/20220615105811 b/db/schema_migrations/20220615105811 new file mode 100644 index 00000000000..e2ada7879b8 --- /dev/null +++ b/db/schema_migrations/20220615105811 @@ -0,0 +1 @@ +33456ce3af299e010011b1346b4097ffa1ee642ffb90d342ea22171c3f079d7a
\ No newline at end of file diff --git a/db/schema_migrations/20220616092541 b/db/schema_migrations/20220616092541 new file mode 100644 index 00000000000..bccdcd90ed6 --- /dev/null +++ b/db/schema_migrations/20220616092541 @@ -0,0 +1 @@ +2c177b0199019ebdbc06b43d21d47a35453e3b376ccbde21163128c77826478b
\ No newline at end of file diff --git a/db/schema_migrations/20220616222253 b/db/schema_migrations/20220616222253 new file mode 100644 index 00000000000..dbf34a2a8e1 --- /dev/null +++ b/db/schema_migrations/20220616222253 @@ -0,0 +1 @@ +547c20f7e583e820093a68fa127ea530e6e2e50135e38e72246f4a400e816742
\ No newline at end of file diff --git a/db/schema_migrations/20220617073407 b/db/schema_migrations/20220617073407 new file mode 100644 index 00000000000..4914915f1e6 --- /dev/null +++ b/db/schema_migrations/20220617073407 @@ -0,0 +1 @@ +aff0fb4359747e74fd8275774f1644f0d0acd9f22469c88874cfcd0c7d44752f
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index fa9d9e8f778..4b17fa31b59 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11288,6 +11288,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, @@ -11305,7 +11309,20 @@ CREATE TABLE application_settings ( container_registry_pre_import_timeout integer DEFAULT 1800 NOT NULL, container_registry_import_timeout integer DEFAULT 600 NOT NULL, pipeline_limit_per_project_user_sha integer DEFAULT 0 NOT NULL, + dingtalk_integration_enabled boolean DEFAULT false NOT NULL, + encrypted_dingtalk_corpid bytea, + encrypted_dingtalk_corpid_iv bytea, + encrypted_dingtalk_app_key bytea, + encrypted_dingtalk_app_key_iv bytea, + encrypted_dingtalk_app_secret bytea, + encrypted_dingtalk_app_secret_iv bytea, + 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, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), + CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)), CONSTRAINT app_settings_p_cleanup_package_file_worker_capacity_positive CHECK ((packages_cleanup_package_file_worker_capacity >= 0)), @@ -11326,6 +11343,7 @@ CREATE TABLE application_settings ( CONSTRAINT check_5bcba483c4 CHECK ((char_length(sentry_environment) <= 255)), CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)), CONSTRAINT check_7227fad848 CHECK ((char_length(rate_limiting_response_text) <= 255)), + CONSTRAINT check_734cc9407a CHECK ((char_length(globally_allowed_ips) <= 255)), CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)), CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), CONSTRAINT check_8dca35398a CHECK ((char_length(public_runner_releases_url) <= 255)), @@ -11334,6 +11352,7 @@ CREATE TABLE application_settings ( 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_e2dd6e290a CHECK ((char_length(jira_connect_application_key) <= 255)), CONSTRAINT check_e5024c8801 CHECK ((char_length(elasticsearch_username) <= 255)), CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)), CONSTRAINT check_ef6176834f CHECK ((char_length(encrypted_cloud_license_auth_token_iv) <= 255)), @@ -11348,6 +11367,22 @@ COMMENT ON COLUMN application_settings.encrypted_content_validation_api_key_iv I COMMENT ON COLUMN application_settings.content_validation_endpoint_enabled IS 'JiHu-specific column'; +COMMENT ON COLUMN application_settings.dingtalk_integration_enabled IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.encrypted_dingtalk_corpid IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.encrypted_dingtalk_corpid_iv IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_key IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_key_iv IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_secret IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_secret_iv IS 'JiHu-specific column'; + +COMMENT ON COLUMN application_settings.phone_verification_code_enabled IS 'JiHu-specific column'; + CREATE SEQUENCE application_settings_id_seq START WITH 1 INCREMENT BY 1 @@ -11384,6 +11419,10 @@ CREATE TABLE approval_merge_request_rules ( section text, modified_from_project_rule boolean DEFAULT false NOT NULL, orchestration_policy_idx smallint, + vulnerabilities_allowed smallint DEFAULT 0 NOT NULL, + scanners text[] DEFAULT '{}'::text[] NOT NULL, + severity_levels text[] DEFAULT '{}'::text[] NOT NULL, + vulnerability_states text[] DEFAULT '{newly_detected}'::text[] NOT NULL, CONSTRAINT check_6fca5928b2 CHECK ((char_length(section) <= 255)) ); @@ -11616,6 +11655,26 @@ CREATE SEQUENCE audit_events_id_seq ALTER SEQUENCE audit_events_id_seq OWNED BY audit_events.id; +CREATE TABLE audit_events_streaming_headers ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + external_audit_event_destination_id bigint NOT NULL, + key text NOT NULL, + value text NOT NULL, + CONSTRAINT check_53c3152034 CHECK ((char_length(key) <= 255)), + CONSTRAINT check_ac213cca22 CHECK ((char_length(value) <= 255)) +); + +CREATE SEQUENCE audit_events_streaming_headers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE audit_events_streaming_headers_id_seq OWNED BY audit_events_streaming_headers.id; + CREATE TABLE authentication_events ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -11767,6 +11826,8 @@ CREATE TABLE batched_background_migrations ( max_batch_size integer, started_at timestamp with time zone, on_hold_until timestamp with time zone, + gitlab_schema text NOT NULL, + CONSTRAINT check_0406d9776f CHECK ((char_length(gitlab_schema) <= 255)), CONSTRAINT check_5bb0382d6f CHECK ((char_length(column_name) <= 63)), CONSTRAINT check_6b6a06254a CHECK ((char_length(table_name) <= 63)), CONSTRAINT check_batch_size_in_range CHECK ((batch_size >= sub_batch_size)), @@ -12291,15 +12352,6 @@ CREATE TABLE ci_build_report_results ( data jsonb DEFAULT '{}'::jsonb NOT NULL ); -CREATE SEQUENCE ci_build_report_results_build_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE ci_build_report_results_build_id_seq OWNED BY ci_build_report_results.build_id; - CREATE TABLE ci_build_trace_chunks ( id bigint NOT NULL, chunk_index integer NOT NULL, @@ -12501,6 +12553,7 @@ CREATE TABLE ci_group_variables ( masked boolean DEFAULT false NOT NULL, variable_type smallint DEFAULT 1 NOT NULL, environment_scope text DEFAULT '*'::text NOT NULL, + raw boolean DEFAULT true NOT NULL, CONSTRAINT check_dfe009485a CHECK ((char_length(environment_scope) <= 255)) ); @@ -12521,6 +12574,7 @@ CREATE TABLE ci_instance_variables ( key text NOT NULL, encrypted_value text, encrypted_value_iv text, + raw boolean DEFAULT true NOT NULL, CONSTRAINT check_07a45a5bcb CHECK ((char_length(encrypted_value_iv) <= 255)), CONSTRAINT check_5aede12208 CHECK ((char_length(key) <= 255)), CONSTRAINT check_956afd70f1 CHECK ((char_length(encrypted_value) <= 13579)) @@ -12547,15 +12601,6 @@ CREATE TABLE ci_job_artifact_states ( CONSTRAINT check_df832b66ea CHECK ((char_length(verification_failure) <= 255)) ); -CREATE SEQUENCE ci_job_artifact_states_job_artifact_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE ci_job_artifact_states_job_artifact_id_seq OWNED BY ci_job_artifact_states.job_artifact_id; - CREATE TABLE ci_job_artifacts ( project_id integer NOT NULL, file_type integer NOT NULL, @@ -12609,7 +12654,8 @@ CREATE TABLE ci_job_variables ( encrypted_value_iv character varying, job_id bigint NOT NULL, variable_type smallint DEFAULT 1 NOT NULL, - source smallint DEFAULT 0 NOT NULL + source smallint DEFAULT 0 NOT NULL, + raw boolean DEFAULT true NOT NULL ); CREATE SEQUENCE ci_job_variables_id_seq @@ -12775,7 +12821,8 @@ CREATE TABLE ci_pipeline_schedule_variables ( pipeline_schedule_id integer NOT NULL, created_at timestamp with time zone, updated_at timestamp with time zone, - variable_type smallint DEFAULT 1 NOT NULL + variable_type smallint DEFAULT 1 NOT NULL, + raw boolean DEFAULT true NOT NULL ); CREATE SEQUENCE ci_pipeline_schedule_variables_id_seq @@ -12818,7 +12865,8 @@ CREATE TABLE ci_pipeline_variables ( encrypted_value_salt character varying, encrypted_value_iv character varying, pipeline_id integer NOT NULL, - variable_type smallint DEFAULT 1 NOT NULL + variable_type smallint DEFAULT 1 NOT NULL, + raw boolean DEFAULT true NOT NULL ); CREATE SEQUENCE ci_pipeline_variables_id_seq @@ -12868,15 +12916,6 @@ CREATE TABLE ci_pipelines_config ( content text NOT NULL ); -CREATE SEQUENCE ci_pipelines_config_pipeline_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE ci_pipelines_config_pipeline_id_seq OWNED BY ci_pipelines_config.pipeline_id; - CREATE SEQUENCE ci_pipelines_id_seq START WITH 1 INCREMENT BY 1 @@ -13049,6 +13088,8 @@ CREATE TABLE ci_runners ( maintainer_note text, token_expires_at timestamp with time zone, allowed_plans text[] DEFAULT '{}'::text[] NOT NULL, + semver text, + CONSTRAINT check_a4f24953fd CHECK ((char_length(semver) <= 16)), CONSTRAINT check_ce275cee06 CHECK ((char_length(maintainer_note) <= 1024)) ); @@ -13085,7 +13126,6 @@ CREATE TABLE ci_secure_files ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, file_store smallint DEFAULT 1 NOT NULL, - permissions smallint DEFAULT 0 NOT NULL, name text NOT NULL, file text NOT NULL, checksum bytea NOT NULL, @@ -13259,7 +13299,8 @@ CREATE TABLE ci_variables ( protected boolean DEFAULT false NOT NULL, environment_scope character varying DEFAULT '*'::character varying NOT NULL, masked boolean DEFAULT false NOT NULL, - variable_type smallint DEFAULT 1 NOT NULL + variable_type smallint DEFAULT 1 NOT NULL, + raw boolean DEFAULT true NOT NULL ); CREATE SEQUENCE ci_variables_id_seq @@ -13304,6 +13345,7 @@ CREATE TABLE cluster_agents ( project_id bigint NOT NULL, name text NOT NULL, created_by_user_id bigint, + has_vulnerabilities boolean DEFAULT false NOT NULL, CONSTRAINT check_3498369510 CHECK ((char_length(name) <= 255)) ); @@ -13316,6 +13358,21 @@ CREATE SEQUENCE cluster_agents_id_seq ALTER SEQUENCE cluster_agents_id_seq OWNED BY cluster_agents.id; +CREATE TABLE cluster_enabled_grants ( + id bigint NOT NULL, + namespace_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE cluster_enabled_grants_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE cluster_enabled_grants_id_seq OWNED BY cluster_enabled_grants.id; + CREATE TABLE cluster_groups ( id integer NOT NULL, cluster_id integer NOT NULL, @@ -13737,8 +13794,9 @@ CREATE TABLE compliance_management_frameworks ( description text NOT NULL, color text NOT NULL, namespace_id integer NOT NULL, - regulated boolean DEFAULT true NOT NULL, pipeline_configuration_full_path text, + created_at timestamp with time zone, + updated_at timestamp with time zone, CONSTRAINT check_08cd34b2c2 CHECK ((char_length(color) <= 10)), CONSTRAINT check_1617e0b87e CHECK ((char_length(description) <= 255)), CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255)), @@ -14311,7 +14369,6 @@ CREATE TABLE deploy_tokens ( expires_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL, name character varying NOT NULL, - token character varying, username character varying, token_encrypted character varying(255), deploy_token_type smallint DEFAULT 2 NOT NULL, @@ -14526,6 +14583,30 @@ CREATE SEQUENCE diff_note_positions_id_seq ALTER SEQUENCE diff_note_positions_id_seq OWNED BY diff_note_positions.id; +CREATE TABLE dingtalk_tracker_data ( + id bigint NOT NULL, + integration_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + corpid text, + CONSTRAINT check_d3fe332e6a CHECK ((char_length(corpid) <= 255)) +); + +COMMENT ON TABLE dingtalk_tracker_data IS 'JiHu-specific table'; + +COMMENT ON COLUMN dingtalk_tracker_data.integration_id IS 'JiHu-specific column'; + +COMMENT ON COLUMN dingtalk_tracker_data.corpid IS 'JiHu-specific column'; + +CREATE SEQUENCE dingtalk_tracker_data_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE dingtalk_tracker_data_id_seq OWNED BY dingtalk_tracker_data.id; + CREATE TABLE dora_daily_metrics ( id bigint NOT NULL, environment_id bigint NOT NULL, @@ -14800,6 +14881,10 @@ CREATE TABLE epics ( confidential boolean DEFAULT false NOT NULL, external_key character varying(255), color text DEFAULT '#1068bf'::text, + total_opened_issue_weight integer DEFAULT 0 NOT NULL, + total_closed_issue_weight integer DEFAULT 0 NOT NULL, + total_opened_issue_count integer DEFAULT 0 NOT NULL, + total_closed_issue_count integer DEFAULT 0 NOT NULL, CONSTRAINT check_ca608c40b3 CHECK ((char_length(color) <= 7)), CONSTRAINT check_fcfb4a93ff CHECK ((lock_version IS NOT NULL)) ); @@ -15179,7 +15264,6 @@ CREATE TABLE geo_event_log ( repositories_changed_event_id bigint, repository_created_event_id bigint, hashed_storage_migrated_event_id bigint, - lfs_object_deleted_event_id bigint, hashed_storage_attachments_event_id bigint, reset_checksum_event_id bigint, cache_invalidation_event_id bigint, @@ -15252,22 +15336,6 @@ CREATE SEQUENCE geo_hashed_storage_migrated_events_id_seq ALTER SEQUENCE geo_hashed_storage_migrated_events_id_seq OWNED BY geo_hashed_storage_migrated_events.id; -CREATE TABLE geo_lfs_object_deleted_events ( - id bigint NOT NULL, - lfs_object_id integer NOT NULL, - oid character varying NOT NULL, - file_path character varying NOT NULL -); - -CREATE SEQUENCE geo_lfs_object_deleted_events_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE geo_lfs_object_deleted_events_id_seq OWNED BY geo_lfs_object_deleted_events.id; - CREATE TABLE geo_node_namespace_links ( id integer NOT NULL, geo_node_id integer NOT NULL, @@ -16142,7 +16210,6 @@ CREATE TABLE integrations ( created_at timestamp without time zone, updated_at timestamp without time zone, active boolean DEFAULT false NOT NULL, - properties text, push_events boolean DEFAULT true, issues_events boolean DEFAULT true, merge_requests_events boolean DEFAULT true, @@ -16234,6 +16301,27 @@ CREATE SEQUENCE issuable_metric_images_id_seq ALTER SEQUENCE issuable_metric_images_id_seq OWNED BY issuable_metric_images.id; +CREATE TABLE issuable_resource_links ( + id bigint NOT NULL, + issue_id bigint NOT NULL, + link_text text, + link text NOT NULL, + link_type smallint DEFAULT 0 NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + CONSTRAINT check_67be6729db CHECK ((char_length(link) <= 2200)), + CONSTRAINT check_b137147e0b CHECK ((char_length(link_text) <= 255)) +); + +CREATE SEQUENCE issuable_resource_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE issuable_resource_links_id_seq OWNED BY issuable_resource_links.id; + CREATE TABLE issuable_severities ( id bigint NOT NULL, issue_id bigint NOT NULL, @@ -17415,6 +17503,7 @@ CREATE TABLE namespace_settings ( subgroup_runner_token_expiration_interval integer, project_runner_token_expiration_interval integer, exclude_from_free_user_cap boolean DEFAULT false NOT NULL, + enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)) ); @@ -18697,7 +18786,10 @@ CREATE TABLE plan_limits ( dotenv_size integer DEFAULT 5120 NOT NULL, pipeline_triggers integer DEFAULT 25000 NOT NULL, project_ci_secure_files integer DEFAULT 100 NOT NULL, - repository_size bigint DEFAULT 0 NOT NULL + repository_size bigint DEFAULT 0 NOT NULL, + security_policy_scan_execution_schedules integer DEFAULT 0 NOT NULL, + web_hook_calls_mid integer DEFAULT 0 NOT NULL, + web_hook_calls_low integer DEFAULT 0 NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -19082,7 +19174,8 @@ CREATE TABLE project_build_artifacts_size_refreshes ( state smallint DEFAULT 1 NOT NULL, refresh_started_at timestamp with time zone, created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL + updated_at timestamp with time zone NOT NULL, + last_job_artifact_id_on_refresh_start bigint DEFAULT 0 ); CREATE SEQUENCE project_build_artifacts_size_refreshes_id_seq @@ -19253,7 +19346,8 @@ CREATE TABLE project_features ( operations_access_level integer DEFAULT 20 NOT NULL, analytics_access_level integer DEFAULT 20 NOT NULL, security_and_compliance_access_level integer DEFAULT 10 NOT NULL, - container_registry_access_level integer DEFAULT 0 NOT NULL + container_registry_access_level integer DEFAULT 0 NOT NULL, + package_registry_access_level integer DEFAULT 0 NOT NULL ); CREATE SEQUENCE project_features_id_seq @@ -20809,6 +20903,25 @@ CREATE SEQUENCE sprints_id_seq ALTER SEQUENCE sprints_id_seq OWNED BY sprints.id; +CREATE TABLE ssh_signatures ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + project_id bigint NOT NULL, + key_id bigint NOT NULL, + verification_status smallint DEFAULT 0 NOT NULL, + commit_sha bytea NOT NULL +); + +CREATE SEQUENCE ssh_signatures_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ssh_signatures_id_seq OWNED BY ssh_signatures.id; + CREATE TABLE status_check_responses ( id bigint NOT NULL, merge_request_id bigint NOT NULL, @@ -21022,7 +21135,8 @@ CREATE TABLE terraform_states ( locked_by_user_id bigint, uuid character varying(32) NOT NULL, name character varying(255) NOT NULL, - versioning_enabled boolean DEFAULT true NOT NULL + versioning_enabled boolean DEFAULT true NOT NULL, + deleted_at timestamp with time zone ); CREATE SEQUENCE terraform_states_id_seq @@ -21034,6 +21148,30 @@ CREATE SEQUENCE terraform_states_id_seq ALTER SEQUENCE terraform_states_id_seq OWNED BY terraform_states.id; +CREATE TABLE timelog_categories ( + id bigint NOT NULL, + namespace_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + billing_rate numeric(18,4) DEFAULT 0.0, + billable boolean DEFAULT false NOT NULL, + name text NOT NULL, + description text, + color text DEFAULT '#6699cc'::text NOT NULL, + CONSTRAINT check_37ad5f23d7 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_4ba862ba3e CHECK ((char_length(color) <= 7)), + CONSTRAINT check_c4b8aec13a CHECK ((char_length(description) <= 1024)) +); + +CREATE SEQUENCE timelog_categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE timelog_categories_id_seq OWNED BY timelog_categories.id; + CREATE TABLE timelogs ( id integer NOT NULL, time_spent integer NOT NULL, @@ -22049,6 +22187,24 @@ CREATE SEQUENCE vulnerability_scanners_id_seq ALTER SEQUENCE vulnerability_scanners_id_seq OWNED BY vulnerability_scanners.id; +CREATE TABLE vulnerability_state_transitions ( + id bigint NOT NULL, + vulnerability_id bigint NOT NULL, + to_state smallint NOT NULL, + from_state smallint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE vulnerability_state_transitions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_state_transitions_id_seq OWNED BY vulnerability_state_transitions.id; + CREATE TABLE vulnerability_statistics ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -22133,7 +22289,9 @@ CREATE TABLE web_hooks ( subgroup_events boolean DEFAULT false NOT NULL, recent_failures smallint DEFAULT 0 NOT NULL, backoff_count smallint DEFAULT 0 NOT NULL, - disabled_until timestamp with time zone + disabled_until timestamp with time zone, + encrypted_url_variables bytea, + encrypted_url_variables_iv bytea ); CREATE SEQUENCE web_hooks_id_seq @@ -22203,6 +22361,24 @@ CREATE SEQUENCE wiki_page_slugs_id_seq ALTER SEQUENCE wiki_page_slugs_id_seq OWNED BY wiki_page_slugs.id; +CREATE TABLE work_item_parent_links ( + id bigint NOT NULL, + work_item_id bigint NOT NULL, + work_item_parent_id bigint NOT NULL, + relative_position integer, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE work_item_parent_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE work_item_parent_links_id_seq OWNED BY work_item_parent_links.id; + CREATE TABLE work_item_types ( id bigint NOT NULL, base_type smallint DEFAULT 0 NOT NULL, @@ -22398,6 +22574,8 @@ ALTER TABLE ONLY audit_events ALTER COLUMN id SET DEFAULT nextval('audit_events_ ALTER TABLE ONLY audit_events_external_audit_event_destinations ALTER COLUMN id SET DEFAULT nextval('audit_events_external_audit_event_destinations_id_seq'::regclass); +ALTER TABLE ONLY audit_events_streaming_headers ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_headers_id_seq'::regclass); + ALTER TABLE ONLY authentication_events ALTER COLUMN id SET DEFAULT nextval('authentication_events_id_seq'::regclass); ALTER TABLE ONLY award_emoji ALTER COLUMN id SET DEFAULT nextval('award_emoji_id_seq'::regclass); @@ -22462,8 +22640,6 @@ ALTER TABLE ONLY ci_build_needs ALTER COLUMN id SET DEFAULT nextval('ci_build_ne ALTER TABLE ONLY ci_build_pending_states ALTER COLUMN id SET DEFAULT nextval('ci_build_pending_states_id_seq'::regclass); -ALTER TABLE ONLY ci_build_report_results ALTER COLUMN build_id SET DEFAULT nextval('ci_build_report_results_build_id_seq'::regclass); - ALTER TABLE ONLY ci_build_trace_chunks ALTER COLUMN id SET DEFAULT nextval('ci_build_trace_chunks_id_seq'::regclass); ALTER TABLE ONLY ci_builds ALTER COLUMN id SET DEFAULT nextval('ci_builds_id_seq'::regclass); @@ -22482,8 +22658,6 @@ ALTER TABLE ONLY ci_group_variables ALTER COLUMN id SET DEFAULT nextval('ci_grou ALTER TABLE ONLY ci_instance_variables ALTER COLUMN id SET DEFAULT nextval('ci_instance_variables_id_seq'::regclass); -ALTER TABLE ONLY ci_job_artifact_states ALTER COLUMN job_artifact_id SET DEFAULT nextval('ci_job_artifact_states_job_artifact_id_seq'::regclass); - ALTER TABLE ONLY ci_job_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_job_artifacts_id_seq'::regclass); ALTER TABLE ONLY ci_job_token_project_scope_links ALTER COLUMN id SET DEFAULT nextval('ci_job_token_project_scope_links_id_seq'::regclass); @@ -22512,8 +22686,6 @@ ALTER TABLE ONLY ci_pipeline_variables ALTER COLUMN id SET DEFAULT nextval('ci_p ALTER TABLE ONLY ci_pipelines ALTER COLUMN id SET DEFAULT nextval('ci_pipelines_id_seq'::regclass); -ALTER TABLE ONLY ci_pipelines_config ALTER COLUMN pipeline_id SET DEFAULT nextval('ci_pipelines_config_pipeline_id_seq'::regclass); - ALTER TABLE ONLY ci_platform_metrics ALTER COLUMN id SET DEFAULT nextval('ci_platform_metrics_id_seq'::regclass); ALTER TABLE ONLY ci_project_mirrors ALTER COLUMN id SET DEFAULT nextval('ci_project_mirrors_id_seq'::regclass); @@ -22558,6 +22730,8 @@ ALTER TABLE ONLY cluster_agent_tokens ALTER COLUMN id SET DEFAULT nextval('clust ALTER TABLE ONLY cluster_agents ALTER COLUMN id SET DEFAULT nextval('cluster_agents_id_seq'::regclass); +ALTER TABLE ONLY cluster_enabled_grants ALTER COLUMN id SET DEFAULT nextval('cluster_enabled_grants_id_seq'::regclass); + ALTER TABLE ONLY cluster_groups ALTER COLUMN id SET DEFAULT nextval('cluster_groups_id_seq'::regclass); ALTER TABLE ONLY cluster_platforms_kubernetes ALTER COLUMN id SET DEFAULT nextval('cluster_platforms_kubernetes_id_seq'::regclass); @@ -22656,6 +22830,8 @@ ALTER TABLE ONLY detached_partitions ALTER COLUMN id SET DEFAULT nextval('detach ALTER TABLE ONLY diff_note_positions ALTER COLUMN id SET DEFAULT nextval('diff_note_positions_id_seq'::regclass); +ALTER TABLE ONLY dingtalk_tracker_data ALTER COLUMN id SET DEFAULT nextval('dingtalk_tracker_data_id_seq'::regclass); + ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_daily_metrics_id_seq'::regclass); ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass); @@ -22726,8 +22902,6 @@ ALTER TABLE ONLY geo_hashed_storage_attachments_events ALTER COLUMN id SET DEFAU ALTER TABLE ONLY geo_hashed_storage_migrated_events ALTER COLUMN id SET DEFAULT nextval('geo_hashed_storage_migrated_events_id_seq'::regclass); -ALTER TABLE ONLY geo_lfs_object_deleted_events ALTER COLUMN id SET DEFAULT nextval('geo_lfs_object_deleted_events_id_seq'::regclass); - ALTER TABLE ONLY geo_node_namespace_links ALTER COLUMN id SET DEFAULT nextval('geo_node_namespace_links_id_seq'::regclass); ALTER TABLE ONLY geo_node_statuses ALTER COLUMN id SET DEFAULT nextval('geo_node_statuses_id_seq'::regclass); @@ -22816,6 +22990,8 @@ ALTER TABLE ONLY ip_restrictions ALTER COLUMN id SET DEFAULT nextval('ip_restric ALTER TABLE ONLY issuable_metric_images ALTER COLUMN id SET DEFAULT nextval('issuable_metric_images_id_seq'::regclass); +ALTER TABLE ONLY issuable_resource_links ALTER COLUMN id SET DEFAULT nextval('issuable_resource_links_id_seq'::regclass); + ALTER TABLE ONLY issuable_severities ALTER COLUMN id SET DEFAULT nextval('issuable_severities_id_seq'::regclass); ALTER TABLE ONLY issuable_slas ALTER COLUMN id SET DEFAULT nextval('issuable_slas_id_seq'::regclass); @@ -23178,6 +23354,8 @@ ALTER TABLE ONLY spam_logs ALTER COLUMN id SET DEFAULT nextval('spam_logs_id_seq ALTER TABLE ONLY sprints ALTER COLUMN id SET DEFAULT nextval('sprints_id_seq'::regclass); +ALTER TABLE ONLY ssh_signatures ALTER COLUMN id SET DEFAULT nextval('ssh_signatures_id_seq'::regclass); + ALTER TABLE ONLY status_check_responses ALTER COLUMN id SET DEFAULT nextval('status_check_responses_id_seq'::regclass); ALTER TABLE ONLY status_page_published_incidents ALTER COLUMN id SET DEFAULT nextval('status_page_published_incidents_id_seq'::regclass); @@ -23200,6 +23378,8 @@ ALTER TABLE ONLY terraform_state_versions ALTER COLUMN id SET DEFAULT nextval('t ALTER TABLE ONLY terraform_states ALTER COLUMN id SET DEFAULT nextval('terraform_states_id_seq'::regclass); +ALTER TABLE ONLY timelog_categories ALTER COLUMN id SET DEFAULT nextval('timelog_categories_id_seq'::regclass); + ALTER TABLE ONLY timelogs ALTER COLUMN id SET DEFAULT nextval('timelogs_id_seq'::regclass); ALTER TABLE ONLY todos ALTER COLUMN id SET DEFAULT nextval('todos_id_seq'::regclass); @@ -23282,6 +23462,8 @@ ALTER TABLE ONLY vulnerability_remediations ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY vulnerability_scanners ALTER COLUMN id SET DEFAULT nextval('vulnerability_scanners_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_state_transitions ALTER COLUMN id SET DEFAULT nextval('vulnerability_state_transitions_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_statistics_id_seq'::regclass); ALTER TABLE ONLY vulnerability_user_mentions ALTER COLUMN id SET DEFAULT nextval('vulnerability_user_mentions_id_seq'::regclass); @@ -23296,6 +23478,8 @@ ALTER TABLE ONLY wiki_page_meta ALTER COLUMN id SET DEFAULT nextval('wiki_page_m ALTER TABLE ONLY wiki_page_slugs ALTER COLUMN id SET DEFAULT nextval('wiki_page_slugs_id_seq'::regclass); +ALTER TABLE ONLY work_item_parent_links ALTER COLUMN id SET DEFAULT nextval('work_item_parent_links_id_seq'::regclass); + ALTER TABLE ONLY work_item_types ALTER COLUMN id SET DEFAULT nextval('work_item_types_id_seq'::regclass); ALTER TABLE ONLY x509_certificates ALTER COLUMN id SET DEFAULT nextval('x509_certificates_id_seq'::regclass); @@ -24013,6 +24197,9 @@ ALTER TABLE ONLY audit_events_external_audit_event_destinations ALTER TABLE ONLY audit_events ADD CONSTRAINT audit_events_pkey PRIMARY KEY (id, created_at); +ALTER TABLE ONLY audit_events_streaming_headers + ADD CONSTRAINT audit_events_streaming_headers_pkey PRIMARY KEY (id); + ALTER TABLE ONLY authentication_events ADD CONSTRAINT authentication_events_pkey PRIMARY KEY (id); @@ -24112,6 +24299,9 @@ ALTER TABLE ONLY chat_teams ALTER TABLE vulnerability_scanners ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID; +ALTER TABLE routes + ADD CONSTRAINT check_af84c6c93f CHECK ((namespace_id IS NOT NULL)) NOT VALID; + ALTER TABLE sprints ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID; @@ -24124,6 +24314,9 @@ ALTER TABLE sprints ALTER TABLE projects ADD CONSTRAINT check_fa75869cb1 CHECK ((project_namespace_id IS NOT NULL)) NOT VALID; +ALTER TABLE requirements + ADD CONSTRAINT check_requirement_issue_not_null CHECK ((issue_id IS NOT NULL)) NOT VALID; + ALTER TABLE ONLY ci_build_needs ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id); @@ -24277,6 +24470,9 @@ ALTER TABLE ONLY cluster_agent_tokens ALTER TABLE ONLY cluster_agents ADD CONSTRAINT cluster_agents_pkey PRIMARY KEY (id); +ALTER TABLE ONLY cluster_enabled_grants + ADD CONSTRAINT cluster_enabled_grants_pkey PRIMARY KEY (id); + ALTER TABLE ONLY cluster_groups ADD CONSTRAINT cluster_groups_pkey PRIMARY KEY (id); @@ -24454,6 +24650,9 @@ ALTER TABLE ONLY detached_partitions ALTER TABLE ONLY diff_note_positions ADD CONSTRAINT diff_note_positions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY dingtalk_tracker_data + ADD CONSTRAINT dingtalk_tracker_data_pkey PRIMARY KEY (id); + ALTER TABLE ONLY dora_daily_metrics ADD CONSTRAINT dora_daily_metrics_pkey PRIMARY KEY (id); @@ -24565,9 +24764,6 @@ ALTER TABLE ONLY geo_hashed_storage_attachments_events ALTER TABLE ONLY geo_hashed_storage_migrated_events ADD CONSTRAINT geo_hashed_storage_migrated_events_pkey PRIMARY KEY (id); -ALTER TABLE ONLY geo_lfs_object_deleted_events - ADD CONSTRAINT geo_lfs_object_deleted_events_pkey PRIMARY KEY (id); - ALTER TABLE ONLY geo_node_namespace_links ADD CONSTRAINT geo_node_namespace_links_pkey PRIMARY KEY (id); @@ -24715,6 +24911,9 @@ ALTER TABLE ONLY ip_restrictions ALTER TABLE ONLY issuable_metric_images ADD CONSTRAINT issuable_metric_images_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issuable_resource_links + ADD CONSTRAINT issuable_resource_links_pkey PRIMARY KEY (id); + ALTER TABLE ONLY issuable_severities ADD CONSTRAINT issuable_severities_pkey PRIMARY KEY (id); @@ -25378,6 +25577,9 @@ ALTER TABLE ONLY spam_logs ALTER TABLE ONLY sprints ADD CONSTRAINT sprints_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ssh_signatures + ADD CONSTRAINT ssh_signatures_pkey PRIMARY KEY (id); + ALTER TABLE ONLY status_check_responses ADD CONSTRAINT status_check_responses_pkey PRIMARY KEY (id); @@ -25411,6 +25613,9 @@ ALTER TABLE ONLY terraform_state_versions ALTER TABLE ONLY terraform_states ADD CONSTRAINT terraform_states_pkey PRIMARY KEY (id); +ALTER TABLE ONLY timelog_categories + ADD CONSTRAINT timelog_categories_pkey PRIMARY KEY (id); + ALTER TABLE ONLY timelogs ADD CONSTRAINT timelogs_pkey PRIMARY KEY (id); @@ -25552,6 +25757,9 @@ ALTER TABLE ONLY vulnerability_remediations ALTER TABLE ONLY vulnerability_scanners ADD CONSTRAINT vulnerability_scanners_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_state_transitions + ADD CONSTRAINT vulnerability_state_transitions_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_statistics ADD CONSTRAINT vulnerability_statistics_pkey PRIMARY KEY (id); @@ -25573,6 +25781,9 @@ ALTER TABLE ONLY wiki_page_meta ALTER TABLE ONLY wiki_page_slugs ADD CONSTRAINT wiki_page_slugs_pkey PRIMARY KEY (id); +ALTER TABLE ONLY work_item_parent_links + ADD CONSTRAINT work_item_parent_links_pkey PRIMARY KEY (id); + ALTER TABLE ONLY work_item_types ADD CONSTRAINT work_item_types_pkey PRIMARY KEY (id); @@ -26565,6 +26776,8 @@ CREATE INDEX i_batched_background_migration_job_transition_logs_on_job_id ON ONL CREATE UNIQUE INDEX i_ci_job_token_project_scope_links_on_source_and_target_project ON ci_job_token_project_scope_links USING btree (source_project_id, target_project_id); +CREATE INDEX i_compliance_frameworks_on_id_and_created_at ON compliance_management_frameworks USING btree (id, created_at, pipeline_configuration_full_path); + CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id); CREATE INDEX idx_analytics_devops_adoption_snapshots_finalized ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time) WHERE (recorded_at >= end_time); @@ -26605,6 +26818,8 @@ CREATE INDEX idx_elastic_reindexing_slices_on_elastic_reindexing_subtask_id ON e CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_merge_requests USING btree (environment_id, merge_request_id); +CREATE UNIQUE INDEX idx_external_audit_event_destination_id_key_uniq ON audit_events_streaming_headers USING btree (key, external_audit_event_destination_id); + CREATE INDEX idx_geo_con_rep_updated_events_on_container_repository_id ON geo_container_repository_updated_events USING btree (container_repository_id); CREATE INDEX idx_installable_helm_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id); @@ -26659,6 +26874,8 @@ CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_external_url ON ext CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_name ON external_status_checks USING btree (project_id, name); +CREATE INDEX idx_open_issues_on_project_id_and_confidential ON issues USING btree (project_id, confidential) WHERE (state_id = 1); + CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id); CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON packages_debian_project_component_files USING btree (architecture_id); @@ -26715,6 +26932,8 @@ CREATE INDEX idx_security_scans_on_scan_type ON security_scans USING btree (scan CREATE UNIQUE INDEX idx_serverless_domain_cluster_on_clusters_applications_knative ON serverless_domain_cluster USING btree (clusters_applications_knative_id); +CREATE INDEX idx_streaming_headers_on_external_audit_event_destination_id ON audit_events_streaming_headers USING btree (external_audit_event_destination_id); + CREATE INDEX idx_user_details_on_provisioned_by_group_id_user_id ON user_details USING btree (provisioned_by_group_id, user_id); CREATE UNIQUE INDEX idx_vuln_signatures_on_occurrences_id_and_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, signature_sha); @@ -26911,6 +27130,8 @@ CREATE INDEX index_batched_jobs_by_batched_migration_id_and_id ON batched_backgr CREATE INDEX index_batched_jobs_on_batched_migration_id_and_status ON batched_background_migration_jobs USING btree (batched_background_migration_id, status); +CREATE UNIQUE INDEX index_batched_migrations_on_gl_schema_and_unique_configuration ON batched_background_migrations USING btree (gitlab_schema, job_class_name, table_name, column_name, job_arguments); + CREATE INDEX index_board_assignees_on_assignee_id ON board_assignees USING btree (assignee_id); CREATE UNIQUE INDEX index_board_assignees_on_board_id_and_assignee_id ON board_assignees USING btree (board_id, assignee_id); @@ -27115,6 +27336,8 @@ CREATE UNIQUE INDEX index_ci_job_artifacts_on_job_id_and_file_type ON ci_job_art 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_and_id ON ci_job_artifacts USING btree (project_id, 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])); CREATE INDEX index_ci_job_token_project_scope_links_on_added_by_id ON ci_job_token_project_scope_links USING btree (added_by_id); @@ -27257,6 +27480,8 @@ CREATE INDEX index_ci_runners_on_created_at_desc_and_id_desc ON ci_runners USING CREATE INDEX index_ci_runners_on_description_trigram ON ci_runners USING gin (description gin_trgm_ops); +CREATE INDEX index_ci_runners_on_id_and_semver_cidr ON ci_runners USING btree (id, ((semver)::cidr)); + CREATE INDEX index_ci_runners_on_locked ON ci_runners USING btree (locked); CREATE INDEX index_ci_runners_on_runner_type ON ci_runners USING btree (runner_type); @@ -27331,8 +27556,12 @@ CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_age CREATE INDEX index_cluster_agents_on_created_by_user_id ON cluster_agents USING btree (created_by_user_id); +CREATE INDEX index_cluster_agents_on_project_id_and_has_vulnerabilities ON cluster_agents USING btree (project_id, has_vulnerabilities); + CREATE UNIQUE INDEX index_cluster_agents_on_project_id_and_name ON cluster_agents USING btree (project_id, name); +CREATE UNIQUE INDEX index_cluster_enabled_grants_on_namespace_id ON cluster_enabled_grants USING btree (namespace_id); + CREATE UNIQUE INDEX index_cluster_groups_on_cluster_id_and_group_id ON cluster_groups USING btree (cluster_id, group_id); CREATE INDEX index_cluster_groups_on_group_id ON cluster_groups USING btree (group_id); @@ -27501,14 +27730,12 @@ CREATE INDEX index_deploy_keys_projects_on_project_id ON deploy_keys_projects US CREATE INDEX index_deploy_tokens_on_creator_id ON deploy_tokens USING btree (creator_id); -CREATE UNIQUE INDEX index_deploy_tokens_on_token ON deploy_tokens USING btree (token); - -CREATE INDEX index_deploy_tokens_on_token_and_expires_at_and_id ON deploy_tokens USING btree (token, expires_at, id) WHERE (revoked IS FALSE); - CREATE UNIQUE INDEX index_deploy_tokens_on_token_encrypted ON deploy_tokens USING btree (token_encrypted); CREATE INDEX index_deployment_approvals_on_approval_rule_id ON deployment_approvals USING btree (approval_rule_id); +CREATE INDEX index_deployment_approvals_on_created_at_and_id ON deployment_approvals USING btree (created_at, id); + CREATE UNIQUE INDEX index_deployment_approvals_on_deployment_id_and_user_id ON deployment_approvals USING btree (deployment_id, user_id); CREATE INDEX index_deployment_approvals_on_user_id ON deployment_approvals USING btree (user_id); @@ -27593,6 +27820,8 @@ CREATE UNIQUE INDEX index_design_user_mentions_on_note_id ON design_user_mention CREATE UNIQUE INDEX index_diff_note_positions_on_note_id_and_diff_type ON diff_note_positions USING btree (note_id, diff_type); +CREATE INDEX index_dingtalk_tracker_data_on_integration_id ON dingtalk_tracker_data USING btree (integration_id); + CREATE UNIQUE INDEX index_dora_daily_metrics_on_environment_id_and_date ON dora_daily_metrics USING btree (environment_id, date); CREATE INDEX index_draft_notes_on_author_id ON draft_notes USING btree (author_id); @@ -27677,6 +27906,8 @@ CREATE INDEX index_epics_on_start_date_sourcing_epic_id ON epics USING btree (st CREATE INDEX index_epics_on_start_date_sourcing_milestone_id ON epics USING btree (start_date_sourcing_milestone_id); +CREATE INDEX index_error_tracking_client_for_enabled_check ON error_tracking_client_keys USING btree (project_id, public_key) WHERE (active = true); + CREATE INDEX index_error_tracking_client_keys_on_project_id ON error_tracking_client_keys USING btree (project_id); CREATE INDEX index_error_tracking_error_events_on_error_id ON error_tracking_error_events USING btree (error_id); @@ -27771,8 +28002,6 @@ CREATE INDEX index_geo_event_log_on_hashed_storage_attachments_event_id ON geo_e CREATE INDEX index_geo_event_log_on_hashed_storage_migrated_event_id ON geo_event_log USING btree (hashed_storage_migrated_event_id) WHERE (hashed_storage_migrated_event_id IS NOT NULL); -CREATE INDEX index_geo_event_log_on_lfs_object_deleted_event_id ON geo_event_log USING btree (lfs_object_deleted_event_id) WHERE (lfs_object_deleted_event_id IS NOT NULL); - CREATE INDEX index_geo_event_log_on_repositories_changed_event_id ON geo_event_log USING btree (repositories_changed_event_id) WHERE (repositories_changed_event_id IS NOT NULL); CREATE INDEX index_geo_event_log_on_repository_created_event_id ON geo_event_log USING btree (repository_created_event_id) WHERE (repository_created_event_id IS NOT NULL); @@ -27789,8 +28018,6 @@ CREATE INDEX index_geo_hashed_storage_attachments_events_on_project_id ON geo_ha CREATE INDEX index_geo_hashed_storage_migrated_events_on_project_id ON geo_hashed_storage_migrated_events USING btree (project_id); -CREATE INDEX index_geo_lfs_object_deleted_events_on_lfs_object_id ON geo_lfs_object_deleted_events USING btree (lfs_object_id); - CREATE INDEX index_geo_node_namespace_links_on_geo_node_id ON geo_node_namespace_links USING btree (geo_node_id); CREATE UNIQUE INDEX index_geo_node_namespace_links_on_geo_node_id_and_namespace_id ON geo_node_namespace_links USING btree (geo_node_id, namespace_id); @@ -27901,6 +28128,8 @@ CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_rep CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositories USING btree (shard_id); +CREATE INDEX index_groups_on_parent_id_id ON namespaces USING btree (parent_id, id) WHERE ((type)::text = 'Group'::text); + CREATE INDEX index_historical_data_on_recorded_at ON historical_data USING btree (recorded_at); CREATE UNIQUE INDEX index_http_integrations_on_active_and_project_and_endpoint ON alert_management_http_integrations USING btree (active, project_id, endpoint_identifier) WHERE active; @@ -28001,6 +28230,8 @@ CREATE INDEX index_ip_restrictions_on_group_id ON ip_restrictions USING btree (g CREATE INDEX index_issuable_metric_images_on_issue_id ON issuable_metric_images USING btree (issue_id); +CREATE INDEX index_issuable_resource_links_on_issue_id ON issuable_resource_links USING btree (issue_id); + CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities USING btree (issue_id); CREATE INDEX index_issuable_slas_on_due_at_id_label_applied_issuable_closed ON issuable_slas USING btree (due_at, id) WHERE ((label_applied = false) AND (issuable_closed = false)); @@ -28409,6 +28640,8 @@ CREATE INDEX index_namespaces_on_traversal_ids ON namespaces USING gin (traversa CREATE INDEX index_namespaces_on_traversal_ids_for_groups ON namespaces USING gin (traversal_ids) WHERE ((type)::text = 'Group'::text); +CREATE INDEX index_namespaces_on_traversal_ids_for_groups_btree ON namespaces USING btree (traversal_ids) WHERE ((type)::text = 'Group'::text); + CREATE INDEX index_namespaces_on_type_and_id ON namespaces USING btree (type, id); CREATE INDEX index_namespaces_public_groups_name_id ON namespaces USING btree (name, id) WHERE (((type)::text = 'Group'::text) AND (visibility_level = 20)); @@ -28429,6 +28662,8 @@ CREATE INDEX index_notes_on_created_at ON notes USING btree (created_at); CREATE INDEX index_notes_on_discussion_id ON notes USING btree (discussion_id); +CREATE INDEX index_notes_on_id_where_confidential ON notes USING btree (id) WHERE (confidential = true); + CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code); CREATE INDEX index_notes_on_noteable_id_and_noteable_type_and_system ON notes USING btree (noteable_id, noteable_type, system); @@ -28463,6 +28698,10 @@ CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON oauth_openid_requ CREATE UNIQUE INDEX index_on_deploy_keys_id_and_type_and_public ON keys USING btree (id, type) WHERE (public = true); +CREATE INDEX index_on_dingtalk_tracker_data_corpid ON dingtalk_tracker_data USING btree (corpid) WHERE (corpid IS NOT NULL); + +COMMENT ON INDEX index_on_dingtalk_tracker_data_corpid IS 'JiHu-specific index'; + CREATE INDEX index_on_group_id_on_webhooks ON web_hooks USING btree (group_id); CREATE INDEX index_on_identities_lower_extern_uid_and_provider ON identities USING btree (lower((extern_uid)::text), provider); @@ -28585,6 +28824,8 @@ CREATE INDEX index_packages_maven_metadata_on_path ON packages_maven_metadata US CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_nuget_dependency_link_metadata USING btree (dependency_link_id); +CREATE INDEX index_packages_on_available_pypi_packages ON packages_packages USING btree (project_id, id) WHERE ((status = ANY (ARRAY[0, 1])) AND (package_type = 5) AND (version IS NOT NULL)); + 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); @@ -28667,6 +28908,8 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON pages_domai CREATE INDEX index_pages_domains_on_wildcard ON pages_domains USING btree (wildcard); +CREATE UNIQUE INDEX index_parent_links_on_work_item_id_and_work_item_parent_id ON work_item_parent_links USING btree (work_item_id, work_item_parent_id); + CREATE INDEX index_partial_ci_builds_on_user_id_name_parser_features ON ci_builds USING btree (user_id, name) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('secret_detection'::character varying)::text]))); CREATE INDEX index_pat_on_user_id_and_expires_at ON personal_access_tokens USING btree (user_id, expires_at); @@ -29231,6 +29474,12 @@ CREATE INDEX index_sprints_on_title ON sprints USING btree (title); CREATE INDEX index_sprints_on_title_trigram ON sprints USING gin (title gin_trgm_ops); +CREATE UNIQUE INDEX index_ssh_signatures_on_commit_sha ON ssh_signatures USING btree (commit_sha); + +CREATE INDEX index_ssh_signatures_on_key_id ON ssh_signatures USING btree (key_id); + +CREATE INDEX index_ssh_signatures_on_project_id ON ssh_signatures USING btree (project_id); + CREATE INDEX index_status_check_responses_on_external_approval_rule_id ON status_check_responses USING btree (external_approval_rule_id); CREATE INDEX index_status_check_responses_on_external_status_check_id ON status_check_responses USING btree (external_status_check_id); @@ -29287,6 +29536,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_timelog_categories_on_unique_name_per_namespace ON timelog_categories USING btree (namespace_id, lower(name)); + 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); @@ -29599,6 +29850,8 @@ CREATE INDEX index_vulnerability_reads_on_cluster_agent_id ON vulnerability_read CREATE INDEX index_vulnerability_reads_on_location_image ON vulnerability_reads USING btree (location_image) WHERE (report_type = ANY (ARRAY[2, 7])); +CREATE INDEX index_vulnerability_reads_on_location_image_partial ON vulnerability_reads USING btree (project_id, location_image) WHERE ((report_type = ANY (ARRAY[2, 7])) AND (location_image IS NOT NULL)); + CREATE INDEX index_vulnerability_reads_on_scanner_id ON vulnerability_reads USING btree (scanner_id); CREATE UNIQUE INDEX index_vulnerability_reads_on_uuid ON vulnerability_reads USING btree (uuid); @@ -29609,6 +29862,8 @@ CREATE UNIQUE INDEX index_vulnerability_remediations_on_project_id_and_checksum CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON vulnerability_scanners USING btree (project_id, external_id); +CREATE INDEX index_vulnerability_state_transitions_id_and_vulnerability_id ON vulnerability_state_transitions USING btree (vulnerability_id, id); + CREATE INDEX index_vulnerability_statistics_on_latest_pipeline_id ON vulnerability_statistics USING btree (latest_pipeline_id); CREATE INDEX index_vulnerability_statistics_on_letter_grade ON vulnerability_statistics USING btree (letter_grade); @@ -29647,6 +29902,8 @@ CREATE UNIQUE INDEX index_wiki_page_slugs_on_slug_and_wiki_page_meta_id ON wiki_ CREATE INDEX index_wiki_page_slugs_on_wiki_page_meta_id ON wiki_page_slugs USING btree (wiki_page_meta_id); +CREATE INDEX index_work_item_parent_links_on_work_item_parent_id ON work_item_parent_links USING btree (work_item_parent_id); + CREATE INDEX index_x509_certificates_on_subject_key_identifier ON x509_certificates USING btree (subject_key_identifier); CREATE INDEX index_x509_certificates_on_x509_issuer_id ON x509_certificates USING btree (x509_issuer_id); @@ -29709,6 +29966,8 @@ CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON depl CREATE INDEX partial_index_deployments_for_project_id_and_tag ON deployments USING btree (project_id) WHERE (tag IS TRUE); +CREATE INDEX partial_index_slack_integrations_with_bot_user_id ON slack_integrations USING btree (id) WHERE (bot_user_id IS NOT NULL); + CREATE UNIQUE INDEX partial_index_sop_configs_on_namespace_id ON security_orchestration_policy_configurations USING btree (namespace_id) WHERE (namespace_id IS NOT NULL); CREATE UNIQUE INDEX partial_index_sop_configs_on_project_id ON security_orchestration_policy_configurations USING btree (project_id) WHERE (project_id IS NOT NULL); @@ -29723,28 +29982,28 @@ CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree CREATE INDEX tmp_idx_container_repos_on_non_migrated ON container_repositories USING btree (project_id, id) WHERE ((migration_state <> 'import_done'::text) AND (created_at < '2022-01-23 00:00:00'::timestamp without time zone)); +CREATE INDEX tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown ON ci_job_artifacts USING btree (expire_at, job_id) WHERE ((locked = 2) AND (expire_at IS NOT NULL)); + CREATE INDEX tmp_index_ci_job_artifacts_on_id_where_trace_and_expire_at ON ci_job_artifacts USING btree (id) WHERE ((file_type = 3) AND (expire_at = ANY (ARRAY['2021-04-22 00:00:00+00'::timestamp with time zone, '2021-05-22 00:00:00+00'::timestamp with time zone, '2021-06-22 00:00:00+00'::timestamp with time zone, '2022-01-22 00:00:00+00'::timestamp with time zone, '2022-02-22 00:00:00+00'::timestamp with time zone, '2022-03-22 00:00:00+00'::timestamp with time zone, '2022-04-22 00:00:00+00'::timestamp with time zone]))); CREATE INDEX tmp_index_container_repositories_on_id_migration_state ON container_repositories USING btree (id, migration_state); CREATE INDEX tmp_index_for_namespace_id_migration_on_group_members ON members USING btree (id) WHERE ((member_namespace_id IS NULL) AND ((type)::text = 'GroupMember'::text)); +CREATE INDEX tmp_index_for_namespace_id_migration_on_project_members ON members USING btree (id) WHERE ((member_namespace_id IS NULL) AND ((type)::text = 'ProjectMember'::text)); + CREATE INDEX tmp_index_for_namespace_id_migration_on_routes ON routes USING btree (id) WHERE ((namespace_id IS NULL) AND ((source_type)::text = 'Namespace'::text)); CREATE INDEX tmp_index_for_null_project_namespace_id ON projects USING btree (id) WHERE (project_namespace_id IS NULL); CREATE INDEX tmp_index_for_project_namespace_id_migration_on_routes ON routes USING btree (id) WHERE ((namespace_id IS NULL) AND ((source_type)::text = 'Project'::text)); -CREATE INDEX tmp_index_integrations_on_id_where_type_droneci_or_teamcity ON integrations USING btree (id) WHERE ((type_new = ANY (ARRAY['Integrations::DroneCi'::text, 'Integrations::Teamcity'::text])) AND (encrypted_properties IS NOT NULL)); - CREATE INDEX tmp_index_issues_on_issue_type_and_id ON issues USING btree (issue_type, id); CREATE INDEX tmp_index_members_on_state ON members USING btree (state) WHERE (state = 2); CREATE INDEX tmp_index_merge_requests_draft_and_status ON merge_requests USING btree (id) WHERE ((draft = false) AND (state_id = 1) AND ((title)::text ~* '^(\[draft\]|\(draft\)|draft:|draft|\[WIP\]|WIP:|WIP)'::text)); -CREATE INDEX tmp_index_notes_on_id_where_discussion_id_is_null ON notes USING btree (id) WHERE (discussion_id IS NULL); - CREATE UNIQUE INDEX tmp_index_on_tmp_project_id_on_namespaces ON namespaces USING btree (tmp_project_id); CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2); @@ -29753,8 +30012,6 @@ CREATE INDEX tmp_index_projects_on_id_and_runners_token ON projects USING btree CREATE INDEX tmp_index_projects_on_id_and_runners_token_encrypted ON projects USING btree (id, runners_token_encrypted) WHERE (runners_token_encrypted IS NOT NULL); -CREATE INDEX tp_index_created_at_cluster_id_project_id_on_deployments ON deployments USING btree (created_at, cluster_id, project_id) WHERE ((cluster_id IS NOT NULL) AND (created_at > '2022-04-03 00:00:00'::timestamp without time zone)); - CREATE UNIQUE INDEX uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name ON packages_debian_group_architectures USING btree (distribution_id, name); CREATE UNIQUE INDEX uniq_pkgs_deb_grp_components_on_distribution_id_and_name ON packages_debian_group_components USING btree (distribution_id, name); @@ -31073,6 +31330,8 @@ CREATE TRIGGER ci_pipelines_loose_fk_trigger AFTER DELETE ON ci_pipelines REFERE CREATE TRIGGER ci_runners_loose_fk_trigger AFTER DELETE ON ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); +CREATE TRIGGER clusters_loose_fk_trigger AFTER DELETE ON clusters REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); + CREATE TRIGGER merge_requests_loose_fk_trigger AFTER DELETE ON merge_requests REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); CREATE TRIGGER namespaces_loose_fk_trigger AFTER DELETE ON namespaces REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); @@ -31255,9 +31514,6 @@ ALTER TABLE ONLY ci_pipelines ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_27548c6db3 FOREIGN KEY (hashed_storage_migrated_event_id) REFERENCES geo_hashed_storage_migrated_events(id) ON DELETE CASCADE; -ALTER TABLE ONLY deployments - ADD CONSTRAINT fk_289bba3222 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE SET NULL; - ALTER TABLE ONLY merge_requests_compliance_violations ADD CONSTRAINT fk_290ec1ab02 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; @@ -31417,9 +31673,6 @@ ALTER TABLE ONLY merge_requests ALTER TABLE ONLY ci_builds ADD CONSTRAINT fk_6661f4f0e8 FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE SET NULL; -ALTER TABLE ONLY routes - ADD CONSTRAINT fk_679ff8213d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL; - ALTER TABLE ONLY application_settings ADD CONSTRAINT fk_693b8795e4 FOREIGN KEY (push_rule_id) REFERENCES push_rules(id) ON DELETE SET NULL; @@ -31498,6 +31751,9 @@ ALTER TABLE ONLY issue_customer_relations_contacts ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_7c5bb22a22 FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; +ALTER TABLE ONLY ssh_signatures + ADD CONSTRAINT fk_7d2f93996c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY labels ADD CONSTRAINT fk_7de4989a69 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -31720,6 +31976,9 @@ ALTER TABLE ONLY customer_relations_contacts ALTER TABLE ONLY deployments ADD CONSTRAINT fk_b9a3851b82 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY routes + ADD CONSTRAINT fk_bb2e5b8968 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY gitlab_subscriptions ADD CONSTRAINT fk_bd0c4019c3 FOREIGN KEY (hosted_plan_id) REFERENCES plans(id) ON DELETE CASCADE; @@ -31816,9 +32075,6 @@ ALTER TABLE ONLY web_hooks ALTER TABLE ONLY ci_sources_pipelines ADD CONSTRAINT fk_d4e29af7d7 FOREIGN KEY (source_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; -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 incident_management_timeline_events ADD CONSTRAINT fk_d606a2a890 FOREIGN KEY (promoted_from_note_id) REFERENCES notes(id) ON DELETE SET NULL; @@ -31930,6 +32186,9 @@ ALTER TABLE ONLY epics ALTER TABLE ONLY boards ADD CONSTRAINT fk_f15266b5f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY ssh_signatures + ADD CONSTRAINT fk_f177ea6aa5 FOREIGN KEY (key_id) REFERENCES keys(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_pipeline_variables ADD CONSTRAINT fk_f29c5f4380 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; @@ -32074,6 +32333,9 @@ ALTER TABLE ONLY vulnerability_exports ALTER TABLE ONLY prometheus_alert_events ADD CONSTRAINT fk_rails_106f901176 FOREIGN KEY (prometheus_alert_id) REFERENCES prometheus_alerts(id) ON DELETE CASCADE; +ALTER TABLE ONLY audit_events_streaming_headers + ADD CONSTRAINT fk_rails_109fcf96e2 FOREIGN KEY (external_audit_event_destination_id) REFERENCES audit_events_external_audit_event_destinations(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_sources_projects ADD CONSTRAINT fk_rails_10a1eb379a FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; @@ -32203,6 +32465,9 @@ ALTER TABLE ONLY service_desk_settings ALTER TABLE ONLY saml_group_links ADD CONSTRAINT fk_rails_22e312c530 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY work_item_parent_links + ADD CONSTRAINT fk_rails_231dba8959 FOREIGN KEY (work_item_parent_id) REFERENCES issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_profiles ADD CONSTRAINT fk_rails_23cae5abe1 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(id) ON DELETE CASCADE; @@ -32377,6 +32642,9 @@ ALTER TABLE ONLY epic_user_mentions ALTER TABLE ONLY analytics_cycle_analytics_project_stages ADD CONSTRAINT fk_rails_3ec9fd7912 FOREIGN KEY (end_event_label_id) REFERENCES labels(id) ON DELETE CASCADE; +ALTER TABLE ONLY issuable_resource_links + ADD CONSTRAINT fk_rails_3f0ec6b1cf FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; + ALTER TABLE ONLY board_assignees ADD CONSTRAINT fk_rails_3f6f926bd5 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE; @@ -32467,9 +32735,6 @@ ALTER TABLE ONLY snippet_user_mentions ALTER TABLE ONLY protected_environment_approval_rules ADD CONSTRAINT fk_rails_4e554f96f5 FOREIGN KEY (protected_environment_id) REFERENCES protected_environments(id) ON DELETE CASCADE; -ALTER TABLE ONLY deployment_clusters - ADD CONSTRAINT fk_rails_4e6243e120 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; - ALTER TABLE ONLY geo_repository_renamed_events ADD CONSTRAINT fk_rails_4e6524febb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -32575,6 +32840,12 @@ ALTER TABLE ONLY approval_project_rules ALTER TABLE ONLY incident_management_oncall_participants ADD CONSTRAINT fk_rails_5fe86ea341 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY work_item_parent_links + ADD CONSTRAINT fk_rails_601d5bec3a FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE; + +ALTER TABLE ONLY vulnerability_state_transitions + ADD CONSTRAINT fk_rails_60e4899648 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE; + ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT fk_rails_60f6c325a6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -32776,6 +33047,9 @@ ALTER TABLE ONLY approval_merge_request_rules_users ALTER TABLE ONLY required_code_owners_sections ADD CONSTRAINT fk_rails_817708cf2d FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; +ALTER TABLE ONLY cluster_enabled_grants + ADD CONSTRAINT fk_rails_8336ce35af FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_site_profiles ADD CONSTRAINT fk_rails_83e309d69e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -32956,12 +33230,18 @@ ALTER TABLE ONLY vulnerability_finding_signatures ALTER TABLE ONLY clusters_applications_cert_managers ADD CONSTRAINT fk_rails_9e4f2cb4b2 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY timelog_categories + ADD CONSTRAINT fk_rails_9f27b821a8 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY resource_milestone_events ADD CONSTRAINT fk_rails_a006df5590 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; ALTER TABLE ONLY namespace_root_storage_statistics ADD CONSTRAINT fk_rails_a0702c430b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY dingtalk_tracker_data + ADD CONSTRAINT fk_rails_a138e0d542 FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE; + ALTER TABLE ONLY elastic_reindexing_slices ADD CONSTRAINT fk_rails_a17d86aeb9 FOREIGN KEY (elastic_reindexing_subtask_id) REFERENCES elastic_reindexing_subtasks(id) ON DELETE CASCADE; @@ -33118,9 +33398,6 @@ ALTER TABLE ONLY approval_project_rules_users ALTER TABLE ONLY lists ADD CONSTRAINT fk_rails_baed5f39b7 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE; -ALTER TABLE web_hook_logs - ADD CONSTRAINT fk_rails_bb3355782d FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE; - ALTER TABLE ONLY security_findings ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE; |