diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /db | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'db')
384 files changed, 4995 insertions, 284 deletions
diff --git a/db/click_house/main/20230724064832_create_contribution_analytics_events.sql b/db/click_house/main/20230724064832_create_contribution_analytics_events.sql new file mode 100644 index 00000000000..7867897e897 --- /dev/null +++ b/db/click_house/main/20230724064832_create_contribution_analytics_events.sql @@ -0,0 +1,13 @@ +CREATE TABLE contribution_analytics_events +( + id UInt64 DEFAULT 0, + path String DEFAULT '', + author_id UInt64 DEFAULT 0, + target_type LowCardinality(String) DEFAULT '', + action UInt8 DEFAULT 0, + created_at Date DEFAULT toDate(now()), + updated_at DateTime64(6, 'UTC') DEFAULT now() +) + ENGINE = MergeTree + ORDER BY (path, created_at, author_id, id) + PARTITION BY toYear(created_at); diff --git a/db/click_house/main/20230724064918_contribution_analytics_events_materialized_view.sql b/db/click_house/main/20230724064918_contribution_analytics_events_materialized_view.sql new file mode 100644 index 00000000000..669b03ce0f3 --- /dev/null +++ b/db/click_house/main/20230724064918_contribution_analytics_events_materialized_view.sql @@ -0,0 +1,16 @@ +CREATE MATERIALIZED VIEW contribution_analytics_events_mv +TO contribution_analytics_events +AS +SELECT + id, + argMax(path, events.updated_at) as path, + argMax(author_id, events.updated_at) as author_id, + argMax(target_type, events.updated_at) as target_type, + argMax(action, events.updated_at) as action, + argMax(date(created_at), events.updated_at) as created_at, + max(events.updated_at) as updated_at +FROM events +where (("events"."action" = 5 AND "events"."target_type" = '') + OR ("events"."action" IN (1, 3, 7, 12) + AND "events"."target_type" IN ('MergeRequest', 'Issue'))) +GROUP BY id diff --git a/db/docs/authentication_events.yml b/db/docs/authentication_events.yml index 440ca695ad2..e223d00840e 100644 --- a/db/docs/authentication_events.yml +++ b/db/docs/authentication_events.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39652 milestone: '13.4' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/batched_background_migrations/backfill_default_branch_protection_namespace_setting.yml b/db/docs/batched_background_migrations/backfill_default_branch_protection_namespace_setting.yml new file mode 100644 index 00000000000..7a9e1cb8f5b --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_default_branch_protection_namespace_setting.yml @@ -0,0 +1,6 @@ +--- +migration_job_name: BackfillDefaultBranchProtectionNamespaceSetting +description: This migration back fills column default_branch_protection_defaults of namespace settings table +feature_category: database +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127335/ +milestone: 16.3 diff --git a/db/docs/batched_background_migrations/backfill_dismissal_reason_in_vulnerability_reads.yml b/db/docs/batched_background_migrations/backfill_dismissal_reason_in_vulnerability_reads.yml new file mode 100644 index 00000000000..a446300af0a --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_dismissal_reason_in_vulnerability_reads.yml @@ -0,0 +1,6 @@ +--- +migration_job_name: BackfillDismissalReasonInVulnerabilityReads +description: Backfill `dismissal_reason` for rows with `state` of `dismissed` in `vulnerability_reads` table +feature_category: vulnerability_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/412667 +milestone: 16.1 diff --git a/db/docs/batched_background_migrations/backfill_missing_vulnerability_dismissal_details.yml b/db/docs/batched_background_migrations/backfill_missing_vulnerability_dismissal_details.yml new file mode 100644 index 00000000000..f84a6ad84ad --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_missing_vulnerability_dismissal_details.yml @@ -0,0 +1,6 @@ +--- +migration_job_name: BackfillMissingVulnerabilityDismissalDetails +description: Backfill missing vulnerability dimissal information as a result of https://gitlab.com/gitlab-org/gitlab/-/issues/412983 +feature_category: vulnerability_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126253 +milestone: 16.2 diff --git a/db/docs/batched_background_migrations/backfill_project_statistics_storage_size_without_pipeline_artifacts_size_job.yml b/db/docs/batched_background_migrations/backfill_project_statistics_storage_size_without_pipeline_artifacts_size_job.yml new file mode 100644 index 00000000000..c2dda4a2923 --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_project_statistics_storage_size_without_pipeline_artifacts_size_job.yml @@ -0,0 +1,6 @@ +--- +migration_job_name: BackfillProjectStatisticsStorageSizeWithoutPipelineArtifactsSizeJob +description: Refreshes ProjectStatistics to remove pipeline_artifacts_size from the total storage_size +feature_category: consumables_cost_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126053 +milestone: 16.3 diff --git a/db/docs/batched_background_migrations/delete_orphaned_transferred_project_approval_rules.yml b/db/docs/batched_background_migrations/delete_orphaned_transferred_project_approval_rules.yml new file mode 100644 index 00000000000..774c529116c --- /dev/null +++ b/db/docs/batched_background_migrations/delete_orphaned_transferred_project_approval_rules.yml @@ -0,0 +1,8 @@ +--- +migration_job_name: DeleteOrphanedTransferredProjectApprovalRules +description: | + This migration deletes orphaned project approval rules after project transfer. The orphaned rules belong to policies + that are defined for a group hierachy prior to transfer, so they cannot be applied, nor edited. +feature_category: security_policy_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127767 +milestone: 16.3 diff --git a/db/docs/batched_background_migrations/fix_allow_descendants_override_disabled_shared_runners.yml b/db/docs/batched_background_migrations/fix_allow_descendants_override_disabled_shared_runners.yml new file mode 100644 index 00000000000..dd35c69e744 --- /dev/null +++ b/db/docs/batched_background_migrations/fix_allow_descendants_override_disabled_shared_runners.yml @@ -0,0 +1,6 @@ +--- +migration_job_name: FixAllowDescendantsOverrideDisabledSharedRunners +description: Clears invalid combination of shared runners settings (fixes subgroup creation) +feature_category: runner_fleet +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128112 +milestone: 16.3 diff --git a/db/docs/broadcast_messages.yml b/db/docs/broadcast_messages.yml index bceb79b7f9c..c6c28964e52 100644 --- a/db/docs/broadcast_messages.yml +++ b/db/docs/broadcast_messages.yml @@ -1,7 +1,7 @@ --- table_name: broadcast_messages classes: -- BroadcastMessage +- System::BroadcastMessage feature_categories: - onboarding description: GitLab can display broadcast messages to users of a GitLab instance diff --git a/db/docs/catalog_resource_components.yml b/db/docs/catalog_resource_components.yml new file mode 100644 index 00000000000..122e2f14265 --- /dev/null +++ b/db/docs/catalog_resource_components.yml @@ -0,0 +1,7 @@ +table_name: catalog_resource_components +feature_categories: +- pipeline_composition +description: CI component available in the CI Catalog +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127775 +milestone: '16.3' +gitlab_schema: gitlab_main diff --git a/db/docs/catalog_resource_versions.yml b/db/docs/catalog_resource_versions.yml new file mode 100644 index 00000000000..f01dcd8a2d6 --- /dev/null +++ b/db/docs/catalog_resource_versions.yml @@ -0,0 +1,8 @@ +--- +table_name: catalog_resource_versions +feature_categories: +- pipeline_composition +description: Catalog resource versions that contain valid CI components. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124668 +milestone: '16.2' +gitlab_schema: gitlab_main diff --git a/db/docs/chat_teams.yml b/db/docs/chat_teams.yml index 84584e0d68e..f3ff9f62e0e 100644 --- a/db/docs/chat_teams.yml +++ b/db/docs/chat_teams.yml @@ -8,4 +8,4 @@ feature_categories: description: Stores mappings from external chat teams to GitLab groups. introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8746 milestone: '9.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/cluster_enabled_grants.yml b/db/docs/cluster_enabled_grants.yml index 4c6bef3db0e..59f896f198d 100644 --- a/db/docs/cluster_enabled_grants.yml +++ b/db/docs/cluster_enabled_grants.yml @@ -7,4 +7,4 @@ feature_categories: 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' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/schema_inconsistencies.yml b/db/docs/deleted_tables/schema_inconsistencies.yml index af95f26accb..0358ee8e5b1 100644 --- a/db/docs/schema_inconsistencies.yml +++ b/db/docs/deleted_tables/schema_inconsistencies.yml @@ -7,4 +7,6 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/114876 milestone: '15.11' classes: - Gitlab::Database::SchemaValidation::SchemaInconsistency +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126479 +removed_in_milestone: '16.3' gitlab_schema: gitlab_main diff --git a/db/docs/dependency_proxy_group_settings.yml b/db/docs/dependency_proxy_group_settings.yml index 53ec18594e0..1f9a2995adf 100644 --- a/db/docs/dependency_proxy_group_settings.yml +++ b/db/docs/dependency_proxy_group_settings.yml @@ -7,4 +7,4 @@ feature_categories: description: Group-level settings for the dependency proxy introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/10676 milestone: '11.11' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/emails.yml b/db/docs/emails.yml index 0a6dad02aac..5dee5d0a44f 100644 --- a/db/docs/emails.yml +++ b/db/docs/emails.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores users email records introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/29cfd33d949d21d67f3892473c24d4f0a127dfe6 milestone: '6.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/gitlab_subscriptions.yml b/db/docs/gitlab_subscriptions.yml index 9b0b718c394..1703a95422c 100644 --- a/db/docs/gitlab_subscriptions.yml +++ b/db/docs/gitlab_subscriptions.yml @@ -7,4 +7,4 @@ feature_categories: description: Used to store information related to GitLab subscriptions introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/7885 milestone: '11.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/group_crm_settings.yml b/db/docs/group_crm_settings.yml index 36ade1ba134..3165cdffb02 100644 --- a/db/docs/group_crm_settings.yml +++ b/db/docs/group_crm_settings.yml @@ -7,4 +7,4 @@ feature_categories: description: Group-level settings for CRM-related features introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76983 milestone: '14.7' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/group_features.yml b/db/docs/group_features.yml index 68b84a2a08e..b18074b0711 100644 --- a/db/docs/group_features.yml +++ b/db/docs/group_features.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores access levels for group features, like the wiki introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82017 milestone: '14.10' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/group_group_links.yml b/db/docs/group_group_links.yml index 1fa70ec02a6..bdae1b21995 100644 --- a/db/docs/group_group_links.yml +++ b/db/docs/group_group_links.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17117 milestone: '12.5' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/group_import_states.yml b/db/docs/group_import_states.yml index 6343895264b..1a47b0e0af4 100644 --- a/db/docs/group_import_states.yml +++ b/db/docs/group_import_states.yml @@ -7,4 +7,4 @@ feature_categories: description: Used to store and track the group import status when using the Import/Export feature introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29588 milestone: '13.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/group_ssh_certificates.yml b/db/docs/group_ssh_certificates.yml new file mode 100644 index 00000000000..7b44c39a5c2 --- /dev/null +++ b/db/docs/group_ssh_certificates.yml @@ -0,0 +1,11 @@ +--- +table_name: group_ssh_certificates +classes: +- Groups::SshCertificate +feature_categories: +- source_code_management +description: Stores CA files used to verify which certificates are authorized to access + a namespace +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127856 +milestone: '16.3' +gitlab_schema: gitlab_main diff --git a/db/docs/identities.yml b/db/docs/identities.yml index f2790c53466..7c917c5eabf 100644 --- a/db/docs/identities.yml +++ b/db/docs/identities.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1a80d13a3990937580c97e2b0ba8fb98f69bc055 milestone: '7.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/issue_links.yml b/db/docs/issue_links.yml index ed21e9c177b..810e5d940c8 100644 --- a/db/docs/issue_links.yml +++ b/db/docs/issue_links.yml @@ -2,6 +2,7 @@ table_name: issue_links classes: - IssueLink +- WorkItems::RelatedWorkItemLink feature_categories: - team_planning description: Links two issues by relationship type, which can be related or blocking diff --git a/db/docs/labels.yml b/db/docs/labels.yml index 47a3bfb4417..f43814ced30 100644 --- a/db/docs/labels.yml +++ b/db/docs/labels.yml @@ -1,12 +1,14 @@ --- table_name: labels classes: +- Admin::AbuseReportLabel - GroupLabel - Label - ProjectLabel feature_categories: - team_planning -description: Information related to labels, which can be associated with groups or projects +description: Information related to labels, which can be associated with groups or + projects introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/03654a6abf47c88b8b980a6707874ff78080d2fe milestone: '7.2' gitlab_schema: gitlab_main diff --git a/db/docs/merge_requests.yml b/db/docs/merge_requests.yml index bd08875eafe..7e888184b6a 100644 --- a/db/docs/merge_requests.yml +++ b/db/docs/merge_requests.yml @@ -7,4 +7,4 @@ feature_categories: description: This is the main table that stores information about project merge requests. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/6d460aa2d6b3959593c168eed181516036525393 milestone: "<6.0" -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/namespace_details.yml b/db/docs/namespace_details.yml index 6b91798bc57..d434f580f1c 100644 --- a/db/docs/namespace_details.yml +++ b/db/docs/namespace_details.yml @@ -7,4 +7,4 @@ feature_categories: description: Used to store details for namespaces introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82958 milestone: '15.3' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/namespace_settings.yml b/db/docs/namespace_settings.yml index 48187919e43..df723c37fdc 100644 --- a/db/docs/namespace_settings.yml +++ b/db/docs/namespace_settings.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores settings per namespace introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36321 milestone: '13.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/p_batched_git_ref_updates_deletions.yml b/db/docs/p_batched_git_ref_updates_deletions.yml new file mode 100644 index 00000000000..a09672f38da --- /dev/null +++ b/db/docs/p_batched_git_ref_updates_deletions.yml @@ -0,0 +1,11 @@ +--- +table_name: p_batched_git_ref_updates_deletions +classes: +- BatchedGitRefUpdates::Deletion +feature_categories: +- gitaly +description: Acts as a queue for refs that need to be deleted in Gitaly. This allows + us to batch deletes rather than sending them one at a time. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125333 +milestone: '16.3' +gitlab_schema: gitlab_main diff --git a/db/docs/p_ci_builds.yml b/db/docs/p_ci_builds.yml index ca01e89de09..757d609dd4b 100644 --- a/db/docs/p_ci_builds.yml +++ b/db/docs/p_ci_builds.yml @@ -2,10 +2,15 @@ table_name: p_ci_builds classes: - Ci::Bridge +- Ci::Bridge::Partitioned - Ci::Build +- Ci::Build::Partitioned - Ci::Processable +- Ci::Processable::Partitioned - CommitStatus +- CommitStatus::Partitioned - GenericCommitStatus +- GenericCommitStatus::Partitioned feature_categories: - continuous_integration description: Routing table for ci_builds diff --git a/db/docs/plans.yml b/db/docs/plans.yml index 71053051cb8..bc763c37423 100644 --- a/db/docs/plans.yml +++ b/db/docs/plans.yml @@ -7,4 +7,4 @@ feature_categories: description: Contains information about purchasable Plans for GitLab namespaces introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/39ca951a0f28d147d4689379bbe48a9c14d55d9f milestone: '9.5' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/product_analytics_events_experimental.yml b/db/docs/product_analytics_events_experimental.yml index 347a3ef88ac..371305ba2f8 100644 --- a/db/docs/product_analytics_events_experimental.yml +++ b/db/docs/product_analytics_events_experimental.yml @@ -3,7 +3,7 @@ table_name: product_analytics_events_experimental classes: - ProductAnalyticsEvent feature_categories: -- product_analytics +- product_analytics_data_management description: Product analytic events, experimental feature. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/fc6c53e6f7b47dc22c8619a5a6fe491d29778d3f milestone: '13.2' diff --git a/db/docs/project_authorizations.yml b/db/docs/project_authorizations.yml index 59e97fc24e2..7e15b817122 100644 --- a/db/docs/project_authorizations.yml +++ b/db/docs/project_authorizations.yml @@ -8,4 +8,4 @@ feature_categories: description: Stores maximal access to the project per user introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/6839 milestone: '8.14' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_features.yml b/db/docs/project_features.yml index a0a1cce3a7d..78e20b04178 100644 --- a/db/docs/project_features.yml +++ b/db/docs/project_features.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores access levels for project features like wikis, issues, repositories, containers, ect. introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5606 milestone: '8.12' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/projects.yml b/db/docs/projects.yml index 44ac68d891d..84c0aa3373f 100644 --- a/db/docs/projects.yml +++ b/db/docs/projects.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores project records introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/9ba1224867665844b117fa037e1465bb706b3685 milestone: "<6.0" -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/redirect_routes.yml b/db/docs/redirect_routes.yml index c3a9b0db3d9..9296329f8ae 100644 --- a/db/docs/redirect_routes.yml +++ b/db/docs/redirect_routes.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores routes for redirect after changing the path to group or project introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11136 milestone: '9.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/routes.yml b/db/docs/routes.yml index c1a75dd873c..f070f917e31 100644 --- a/db/docs/routes.yml +++ b/db/docs/routes.yml @@ -9,4 +9,4 @@ feature_categories: description: Stores routes per namespaces and projects introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/7121 milestone: '9.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/saml_providers.yml b/db/docs/saml_providers.yml index 21ef2ed3a26..e1396bf6877 100644 --- a/db/docs/saml_providers.yml +++ b/db/docs/saml_providers.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4549 milestone: '10.7' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/target_branch_rules.yml b/db/docs/target_branch_rules.yml new file mode 100644 index 00000000000..a2bd0795ab2 --- /dev/null +++ b/db/docs/target_branch_rules.yml @@ -0,0 +1,10 @@ +--- +table_name: target_branch_rules +classes: +- Projects::TargetBranchRule +feature_categories: +- code_review_workflow +description: Represents a target branch rule +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126877 +milestone: "16.3" +gitlab_schema: gitlab_main diff --git a/db/docs/upcoming_reconciliations.yml b/db/docs/upcoming_reconciliations.yml index 9e89bb1a57f..75254a524c5 100644 --- a/db/docs/upcoming_reconciliations.yml +++ b/db/docs/upcoming_reconciliations.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores the data needed to notify a user of an upcoming reconciliation introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63054 milestone: '14.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/user_callouts.yml b/db/docs/user_callouts.yml index b77f2e538e4..99746a21cd1 100644 --- a/db/docs/user_callouts.yml +++ b/db/docs/user_callouts.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/16735 milestone: '10.5' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/user_details.yml b/db/docs/user_details.yml index f633ca8b863..e43faacc56c 100644 --- a/db/docs/user_details.yml +++ b/db/docs/user_details.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores user details introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25483 milestone: '12.9' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/user_group_callouts.yml b/db/docs/user_group_callouts.yml index 41028319708..188fd06e60b 100644 --- a/db/docs/user_group_callouts.yml +++ b/db/docs/user_group_callouts.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68785 milestone: '14.3' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/user_preferences.yml b/db/docs/user_preferences.yml index 3763997fc63..5020ef97215 100644 --- a/db/docs/user_preferences.yml +++ b/db/docs/user_preferences.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores users' preferences introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/7816 milestone: '11.5' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/user_statuses.yml b/db/docs/user_statuses.yml index b37b3e259d6..e571e1da9a6 100644 --- a/db/docs/user_statuses.yml +++ b/db/docs/user_statuses.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores users' statuses introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/20614 milestone: '11.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/docs/user_synced_attributes_metadata.yml b/db/docs/user_synced_attributes_metadata.yml index a2162c071c9..490ebd8cf39 100644 --- a/db/docs/user_synced_attributes_metadata.yml +++ b/db/docs/user_synced_attributes_metadata.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/4df54f260751a832ebf0b8c18524020d6604994b milestone: '10.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_clusterwide diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb index 67696828420..05916c688f3 100644 --- a/db/fixtures/development/14_pipelines.rb +++ b/db/fixtures/development/14_pipelines.rb @@ -1,15 +1,28 @@ +# frozen_string_literal: true + require './spec/support/sidekiq_middleware' -class Gitlab::Seeder::Pipelines +# Usage: +# +# Simple invocation seeds 5 random projects: +# +# FILTER=14_pipelines bundle exec rake db:seed_fu +# +# Create a new project with repository within a group +# +# FILTER=14_pipelines NEW_PROJECT=1 bundle exec rake db:seed_fu + +# rubocop:disable Rails/Output +class Gitlab::Seeder::Pipelines # rubocop:disable Style/ClassAndModuleChildren PIPELINE_STAGES = [ { name: 'build', position: 0, builds: [ { name: 'build:linux', status: :success, - queued_at: 10.hour.ago, started_at: 9.hour.ago, finished_at: 8.hour.ago }, + queued_at: 10.hours.ago, started_at: 9.hours.ago, finished_at: 8.hours.ago }, { name: 'build:osx', status: :success, - queued_at: 10.hour.ago, started_at: 10.hour.ago, finished_at: 9.hour.ago }, + queued_at: 10.hours.ago, started_at: 10.hours.ago, finished_at: 9.hours.ago } ] }, { @@ -17,25 +30,25 @@ class Gitlab::Seeder::Pipelines position: 1, builds: [ { name: 'rspec:linux 0 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:linux 1 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:linux 2 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:windows 0 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:windows 1 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:windows 2 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:windows 2 3', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'rspec:osx', status_event: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'spinach:linux', status: :success, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago }, + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago }, { name: 'spinach:osx', status: :failed, allow_failure: true, - queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago } + queued_at: 8.hours.ago, started_at: 8.hours.ago, finished_at: 7.hours.ago } ] }, { @@ -44,16 +57,16 @@ class Gitlab::Seeder::Pipelines builds: [ { name: 'staging', environment: 'staging', status_event: :success, options: { environment: { action: 'start', on_stop: 'stop staging' } }, - queued_at: 7.hour.ago, started_at: 6.hour.ago, finished_at: 4.hour.ago }, + queued_at: 7.hours.ago, started_at: 6.hours.ago, finished_at: 4.hours.ago }, { name: 'stop staging', environment: 'staging', when: 'manual', status: :skipped }, - { name: 'production', environment: 'production', when: 'manual', status: :skipped }, + { name: 'production', environment: 'production', when: 'manual', status: :skipped } ] }, { name: 'notify', position: 3, builds: [ - { name: 'slack', when: 'manual', status: :success }, + { name: 'slack', when: 'manual', status: :success } ] }, { @@ -61,16 +74,25 @@ class Gitlab::Seeder::Pipelines position: 4, builds: [ { name: 'jenkins', status: :success, - queued_at: 7.hour.ago, started_at: 6.hour.ago, finished_at: 4.hour.ago } + queued_at: 7.hours.ago, started_at: 6.hours.ago, finished_at: 4.hours.ago } ] } - ] + ].freeze - def initialize(project) - @project = project + def initialize(project = nil) + @project = project || create_new_project end def seed! + if !@project.repository_exists? || @project.empty_repo? + puts + puts "==============WARNING==============" + puts "(#{@project.full_path}) doesn't have a repository. " \ + 'Try specifying a project with working repository or add NEW_PROJECT=1 parameter ' \ + 'so the seed script will automatically create one.' + return + end + pipelines.each do |pipeline| PIPELINE_STAGES.each do |stage_attrs| stage = stage_create!(pipeline, stage_attrs[:name], stage_attrs[:position]) @@ -90,21 +112,51 @@ class Gitlab::Seeder::Pipelines end ::Gitlab::Seeders::Ci::DailyBuildGroupReportResult.new(@project).seed if @project.last_pipeline + + puts "\nSuccessfully seeded '#{@project.full_path}'\n" + puts "URL: #{Rails.application.routes.url_helpers.project_url(@project)}" end private + def create_new_project + admin = User.admins.first + + namespace = FactoryBot.create( + :group, + :public, + name: "Repo Analytics Group #{suffix}", + path: "r-analytics-group-#{suffix}" + ) + project = FactoryBot.create( + :project, + :public, + :repository, + name: "Repo Analytics Project #{suffix}", + path: "r-analytics-project-#{suffix}", + creator: admin, + namespace: namespace + ) + + namespace.add_owner(admin) + project.create_repository + + project + end + def stage_create!(pipeline, name, position) Ci::Stage.create!(pipeline: pipeline, project: pipeline.project, name: name, position: position) end def pipelines - create_master_pipelines + create_merge_request_pipelines + create_main_pipelines + create_merge_request_pipelines end - def create_master_pipelines - @project.repository.commits('master', limit: 4).map do |commit| - create_pipeline!(@project, 'master', commit).tap do |pipeline| + def create_main_pipelines + branch_name = @project.default_branch + + @project.repository.commits(branch_name, limit: 4).map do |commit| + create_pipeline!(@project, branch_name, commit).tap do |pipeline| random_pipeline.tap do |triggered_by_pipeline| triggered_by_pipeline.try(:sourced_pipelines)&.create( source_job: triggered_by_pipeline.builds.all.sample, @@ -154,8 +206,8 @@ class Gitlab::Seeder::Pipelines setup_test_reports(build) setup_build_log(build) - build.project.environments. - find_or_create_by(name: build.expanded_environment_name) + build.project.environments + .find_or_create_by(name: build.expanded_environment_name) build.save! end @@ -188,9 +240,9 @@ class Gitlab::Seeder::Pipelines end def setup_build_log(build) - if %w(running success failed).include?(build.status) - build.trace.set(FFaker::Lorem.paragraphs(6).join("\n\n")) - end + return unless %w[running success failed].include?(build.status) + + build.trace.set(FFaker::Lorem.paragraphs(6).join("\n\n")) end def generic_commit_status_create!(pipeline, stage, opts = {}) @@ -207,7 +259,7 @@ class Gitlab::Seeder::Pipelines { name: 'test build', ci_stage: stage, stage_idx: stage.position, ref: pipeline.ref, tag: false, user: build_user, project: @project, pipeline: pipeline, - scheduling_type: :stage, created_at: Time.now, updated_at: Time.now, runner_id: runners.shuffle.first.id + scheduling_type: :stage, created_at: Time.now, updated_at: Time.now, runner_id: runners.sample.id }.merge(opts) end @@ -224,19 +276,19 @@ class Gitlab::Seeder::Pipelines end def artifacts_archive_path - Rails.root + 'spec/fixtures/ci_build_artifacts.zip' + "#{Rails.root}/spec/fixtures/ci_build_artifacts.zip" end def artifacts_metadata_path - Rails.root + 'spec/fixtures/ci_build_artifacts_metadata.gz' + "#{Rails.root}/spec/fixtures/ci_build_artifacts_metadata.gz" end def test_reports_pass_path - Rails.root + 'spec/fixtures/junit/junit_ant.xml.gz' + "#{Rails.root}/spec/fixtures/junit/junit_ant.xml.gz" end def test_reports_failed_path - Rails.root + 'spec/fixtures/junit/junit.xml.gz' + "#{Rails.root}/spec/fixtures/junit/junit.xml.gz" end def artifacts_cache_file(file_path) @@ -247,11 +299,22 @@ class Gitlab::Seeder::Pipelines yield(UploadedFile.new(file.path, filename: File.basename(file_path))) end + + def suffix + @suffix ||= Time.now.to_i + end end Gitlab::Seeder.quiet do - Project.not_mass_generated.sample(5).each do |project| - project_builds = Gitlab::Seeder::Pipelines.new(project) - project_builds.seed! + new_project = ENV['NEW_PROJECT'] + + if new_project.present? + Gitlab::Seeder::Pipelines.new.seed! + else + Project.not_mass_generated.sample(5).each do |project| + project_builds = Gitlab::Seeder::Pipelines.new(project) + project_builds.seed! + end end end +# rubocop:enable Rails/Output diff --git a/db/fixtures/development/38_ci_cd_analytics.rb b/db/fixtures/development/38_ci_cd_analytics.rb new file mode 100644 index 00000000000..12aab18c63b --- /dev/null +++ b/db/fixtures/development/38_ci_cd_analytics.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +require './ee/db/seeds/shared/dora_metrics' if Gitlab.ee? + +# Usage: +# +# Simple invocation always creates a new project within a group: +# +# FILTER=ci_cd_analytics SEED_CI_CD_ANALYTICS=1 bundle exec rake db:seed_fu + +# rubocop:disable Rails/Output +class Gitlab::Seeder::CiAnalytics # rubocop:disable Style/ClassAndModuleChildren + FLAG = 'SEED_CI_CD_ANALYTICS' + + def initialize + @project = create_new_project + end + + def seed! + seed_data! + end + + private + + attr_reader :project + + def seed_data! + Sidekiq::Worker.skipping_transaction_check do + create_dora_metrics! if Gitlab.ee? + create_pipelines! + create_releases! + + puts "Successfully seeded '#{project.full_path}' for CI/CD analytics!" + puts "URL: #{Rails.application.routes.url_helpers.project_url(project)}" + end + end + + def create_new_project + namespace = FactoryBot.create( + :group, + name: "CICD analytics Group #{suffix}", + path: "cicd-#{suffix}" + ) + project = FactoryBot.create( + :project, + :repository, + name: "CICD analytics Project #{suffix}", + path: "cicd-#{suffix}", + creator: admin, + namespace: namespace + ) + + namespace.add_owner(admin) + project.create_repository + project + end + + def create_dora_metrics! + Gitlab::Seeder::DoraMetrics.new(project: project).execute + end + + def create_pipelines! + branches = project.repository.branches.sample(15) + pipeline_statuses = [:success, :failed] + + branches.each do |branch| + FactoryBot.create( + :ci_pipeline, + pipeline_statuses.sample, + project: project, + ref: branch.name, + sha: branch.target, + created_at: random_past_date, + duration: rand(10).hours + ) + end + end + + def create_releases! + FactoryBot.create_list(:release, 3, project: project, author: admin) + end + + def admin + @admin ||= User.admins.first + end + + def suffix + @suffix ||= Time.now.to_i + end + + def random_past_date + rand(120).days.ago + end +end + +Gitlab::Seeder.quiet do + if ENV[Gitlab::Seeder::CiAnalytics::FLAG] + Gitlab::Seeder::CiAnalytics.new.seed! + else + puts "Skipped. Use the `#{Gitlab::Seeder::CiAnalytics::FLAG}` environment variable to enable." + end +end +# rubocop:enable Rails/Output diff --git a/db/gitlab_schemas/gitlab_main_cell.yaml b/db/gitlab_schemas/gitlab_main_cell.yaml index 7bc140ffecb..1119c10a9b8 100644 --- a/db/gitlab_schemas/gitlab_main_cell.yaml +++ b/db/gitlab_schemas/gitlab_main_cell.yaml @@ -12,7 +12,3 @@ allow_cross_transactions: - gitlab_main_clusterwide allow_cross_foreign_keys: - gitlab_main - # Temporarily allow FKs between clusterwide and cell schemas - # This is to be removed once we remove all FKs between those - - gitlab_main_clusterwide - diff --git a/db/migrate/20230601090722_add_status_message_to_packages.rb b/db/migrate/20230601090722_add_status_message_to_packages.rb new file mode 100644 index 00000000000..0486bf4c9b2 --- /dev/null +++ b/db/migrate/20230601090722_add_status_message_to_packages.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddStatusMessageToPackages < Gitlab::Database::Migration[2.1] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20230601153401_add_text_limit_to_packages_status_message + def change + add_column :packages_packages, :status_message, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20230601153401_add_text_limit_to_packages_status_message.rb b/db/migrate/20230601153401_add_text_limit_to_packages_status_message.rb new file mode 100644 index 00000000000..baaf8d37ab6 --- /dev/null +++ b/db/migrate/20230601153401_add_text_limit_to_packages_status_message.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToPackagesStatusMessage < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_text_limit :packages_packages, :status_message, 255, validate: false + end + + def down + remove_text_limit :packages_packages, :status_message + end +end diff --git a/db/migrate/20230626142009_add_rule_idx_to_scan_result_policies.rb b/db/migrate/20230626142009_add_rule_idx_to_scan_result_policies.rb new file mode 100644 index 00000000000..8edad14546e --- /dev/null +++ b/db/migrate/20230626142009_add_rule_idx_to_scan_result_policies.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddRuleIdxToScanResultPolicies < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + CONSTRAINT_NAME = "check_scan_result_policies_rule_idx_positive" + + def up + add_column :scan_result_policies, :rule_idx, :smallint + end + + def down + remove_column :scan_result_policies, :rule_idx + end +end diff --git a/db/migrate/20230626142010_add_rule_idx_constraint_to_scan_result_policies.rb b/db/migrate/20230626142010_add_rule_idx_constraint_to_scan_result_policies.rb new file mode 100644 index 00000000000..5fdeaf68137 --- /dev/null +++ b/db/migrate/20230626142010_add_rule_idx_constraint_to_scan_result_policies.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddRuleIdxConstraintToScanResultPolicies < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + CONSTRAINT_NAME = "check_scan_result_policies_rule_idx_positive" + + def up + add_check_constraint :scan_result_policies, "rule_idx IS NULL OR rule_idx >= 0", CONSTRAINT_NAME + end + + def down + remove_check_constraint :scan_result_policies, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20230626143139_add_unique_index_to_scan_result_policies_on_position_in_configuration.rb b/db/migrate/20230626143139_add_unique_index_to_scan_result_policies_on_position_in_configuration.rb new file mode 100644 index 00000000000..d6935759cbf --- /dev/null +++ b/db/migrate/20230626143139_add_unique_index_to_scan_result_policies_on_position_in_configuration.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddUniqueIndexToScanResultPoliciesOnPositionInConfiguration < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_scan_result_policies_on_position_in_configuration' + COLUMNS = %i[security_orchestration_policy_configuration_id project_id orchestration_policy_idx rule_idx] + + def up + add_concurrent_index :scan_result_policies, COLUMNS, unique: true, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :scan_result_policies, INDEX_NAME + end +end diff --git a/db/migrate/20230626211305_create_catalog_resource_versions.rb b/db/migrate/20230626211305_create_catalog_resource_versions.rb new file mode 100644 index 00000000000..9a9aa615ea5 --- /dev/null +++ b/db/migrate/20230626211305_create_catalog_resource_versions.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class CreateCatalogResourceVersions < Gitlab::Database::Migration[2.1] + def change + create_table :catalog_resource_versions do |t| + t.bigint :release_id, null: false, index: { unique: true } + t.bigint :catalog_resource_id, null: false, index: true + t.bigint :project_id, null: false, index: true + + t.datetime_with_timezone :created_at, null: false + end + end +end diff --git a/db/migrate/20230626215602_add_release_fk_to_catalog_resource_versions.rb b/db/migrate/20230626215602_add_release_fk_to_catalog_resource_versions.rb new file mode 100644 index 00000000000..43dda42f09e --- /dev/null +++ b/db/migrate/20230626215602_add_release_fk_to_catalog_resource_versions.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddReleaseFkToCatalogResourceVersions < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :catalog_resource_versions, :releases, column: :release_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :catalog_resource_versions, column: :release_id + end + end +end diff --git a/db/migrate/20230626215614_add_project_fk_to_catalog_resource_versions.rb b/db/migrate/20230626215614_add_project_fk_to_catalog_resource_versions.rb new file mode 100644 index 00000000000..115b13700ad --- /dev/null +++ b/db/migrate/20230626215614_add_project_fk_to_catalog_resource_versions.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddProjectFkToCatalogResourceVersions < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :catalog_resource_versions, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :catalog_resource_versions, column: :project_id + end + end +end diff --git a/db/migrate/20230626215638_add_catalog_resource_fk_to_catalog_resource_versions.rb b/db/migrate/20230626215638_add_catalog_resource_fk_to_catalog_resource_versions.rb new file mode 100644 index 00000000000..844fb96cf87 --- /dev/null +++ b/db/migrate/20230626215638_add_catalog_resource_fk_to_catalog_resource_versions.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddCatalogResourceFkToCatalogResourceVersions < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :catalog_resource_versions, :catalog_resources, + column: :catalog_resource_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :catalog_resource_versions, column: :catalog_resource_id + end + end +end diff --git a/db/migrate/20230704233431_create_table_batched_git_ref_updates_deletions.rb b/db/migrate/20230704233431_create_table_batched_git_ref_updates_deletions.rb new file mode 100644 index 00000000000..4df413a4a5e --- /dev/null +++ b/db/migrate/20230704233431_create_table_batched_git_ref_updates_deletions.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +class CreateTableBatchedGitRefUpdatesDeletions < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + options = { + primary_key: [:id, :partition_id], + options: 'PARTITION BY LIST (partition_id)', + if_not_exists: true + } + + create_table(:p_batched_git_ref_updates_deletions, **options) do |t| + t.bigserial :id, null: false + # Do not bother with foreign key as it provides not benefit and has a performance cost. These get cleaned up over + # time anyway. + t.bigint :project_id, null: false + t.bigint :partition_id, null: false, default: 1 + t.timestamps_with_timezone null: false + t.integer :status, null: false, default: 1, limit: 2 + t.text :ref, null: false, limit: 1024 + + t.index [:project_id, :id], where: 'status = 1', + name: :idx_deletions_on_project_id_and_id_where_pending + end + + connection.execute(<<~SQL) + CREATE TABLE IF NOT EXISTS gitlab_partitions_dynamic.p_batched_git_ref_updates_deletions_1 + PARTITION OF p_batched_git_ref_updates_deletions + FOR VALUES IN (1); + SQL + end + + def down + drop_table :p_batched_git_ref_updates_deletions + end +end diff --git a/db/migrate/20230707003301_add_expiry_notified_at_to_member.rb b/db/migrate/20230707003301_add_expiry_notified_at_to_member.rb new file mode 100644 index 00000000000..e890325e5fa --- /dev/null +++ b/db/migrate/20230707003301_add_expiry_notified_at_to_member.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddExpiryNotifiedAtToMember < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = 'members' + COLUMN_NAME = 'expiry_notified_at' + + def up + with_lock_retries do + add_column(TABLE_NAME, COLUMN_NAME, :datetime_with_timezone) + end + end + + def down + with_lock_retries do + remove_column TABLE_NAME, COLUMN_NAME + end + end +end diff --git a/db/migrate/20230707031923_add_emails_to_x509_certificates.rb b/db/migrate/20230707031923_add_emails_to_x509_certificates.rb new file mode 100644 index 00000000000..44ea425fe72 --- /dev/null +++ b/db/migrate/20230707031923_add_emails_to_x509_certificates.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddEmailsToX509Certificates < Gitlab::Database::Migration[2.1] + def change + add_column :x509_certificates, :emails, :string, array: true, default: [], null: false + end +end diff --git a/db/migrate/20230710094027_add_protected_paths_for_get_request_to_application_settings.rb b/db/migrate/20230710094027_add_protected_paths_for_get_request_to_application_settings.rb new file mode 100644 index 00000000000..8f69a1cfdee --- /dev/null +++ b/db/migrate/20230710094027_add_protected_paths_for_get_request_to_application_settings.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class AddProtectedPathsForGetRequestToApplicationSettings < Gitlab::Database::Migration[2.1] + CONSTRAINT_NAME = 'app_settings_protected_paths_max_length' + + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :application_settings, :protected_paths_for_get_request, + :text, + array: true, + default: [], + null: false, + if_not_exists: true + end + + add_check_constraint :application_settings, 'CARDINALITY(protected_paths_for_get_request) <= 100', CONSTRAINT_NAME + end + + def down + with_lock_retries do + remove_column :application_settings, :protected_paths_for_get_request, if_exists: true + end + end +end diff --git a/db/migrate/20230711032913_initialize_conversion_of_ci_pipeline_chat_data_pipeline_id.rb b/db/migrate/20230711032913_initialize_conversion_of_ci_pipeline_chat_data_pipeline_id.rb new file mode 100644 index 00000000000..e11af34e38b --- /dev/null +++ b/db/migrate/20230711032913_initialize_conversion_of_ci_pipeline_chat_data_pipeline_id.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiPipelineChatDataPipelineId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_pipeline_chat_data + COLUMNS = %i[pipeline_id] + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20230711151845_add_email_reset_offered_at_to_user_details.rb b/db/migrate/20230711151845_add_email_reset_offered_at_to_user_details.rb new file mode 100644 index 00000000000..45b6a7fd57f --- /dev/null +++ b/db/migrate/20230711151845_add_email_reset_offered_at_to_user_details.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddEmailResetOfferedAtToUserDetails < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :user_details, :email_reset_offered_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20230712135325_initialize_conversion_of_ci_pipeline_messages_pipeline_id.rb b/db/migrate/20230712135325_initialize_conversion_of_ci_pipeline_messages_pipeline_id.rb new file mode 100644 index 00000000000..3032a1e2e90 --- /dev/null +++ b/db/migrate/20230712135325_initialize_conversion_of_ci_pipeline_messages_pipeline_id.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiPipelineMessagesPipelineId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_pipeline_messages + COLUMNS = %i[pipeline_id] + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20230714020854_add_name_and_description_to_member_roles.rb b/db/migrate/20230714020854_add_name_and_description_to_member_roles.rb new file mode 100644 index 00000000000..eda87babea1 --- /dev/null +++ b/db/migrate/20230714020854_add_name_and_description_to_member_roles.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddNameAndDescriptionToMemberRoles < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :member_roles, :name, :text, null: false, default: 'Custom', if_not_exists: true + add_column :member_roles, :description, :text, if_not_exists: true + end + + add_text_limit :member_roles, :name, 255 + add_text_limit :member_roles, :description, 255 + end + + def down + with_lock_retries do + remove_column :member_roles, :name, :text, if_exists: true + remove_column :member_roles, :description, :text, if_exists: true + end + end +end diff --git a/db/migrate/20230714084415_add_is_unique_to_project_authorizations.rb b/db/migrate/20230714084415_add_is_unique_to_project_authorizations.rb new file mode 100644 index 00000000000..631ca9ec550 --- /dev/null +++ b/db/migrate/20230714084415_add_is_unique_to_project_authorizations.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIsUniqueToProjectAuthorizations < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :project_authorizations, :is_unique, :boolean, null: true + end +end diff --git a/db/migrate/20230717055659_initialize_conversion_of_ci_pipelines_auto_canceled_by_id.rb b/db/migrate/20230717055659_initialize_conversion_of_ci_pipelines_auto_canceled_by_id.rb new file mode 100644 index 00000000000..bf0943be0d1 --- /dev/null +++ b/db/migrate/20230717055659_initialize_conversion_of_ci_pipelines_auto_canceled_by_id.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiPipelinesAutoCanceledById < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_pipelines + COLUMNS = %i[auto_canceled_by_id] + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20230717062425_initialize_conversion_of_ci_stages_pipeline_id.rb b/db/migrate/20230717062425_initialize_conversion_of_ci_stages_pipeline_id.rb new file mode 100644 index 00000000000..70d6406bb67 --- /dev/null +++ b/db/migrate/20230717062425_initialize_conversion_of_ci_stages_pipeline_id.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiStagesPipelineId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_stages + COLUMNS = %i[pipeline_id] + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20230717142737_create_group_ssh_certificate.rb b/db/migrate/20230717142737_create_group_ssh_certificate.rb new file mode 100644 index 00000000000..b3b856dea7c --- /dev/null +++ b/db/migrate/20230717142737_create_group_ssh_certificate.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateGroupSshCertificate < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + create_table :group_ssh_certificates do |t| + t.references :namespace, index: true, foreign_key: { on_delete: :cascade }, null: false + t.datetime_with_timezone :created_at, null: false + t.binary :fingerprint, null: false + t.text :title, null: false, limit: 256 + t.text :key, null: false, limit: 512.kilobytes + + t.index :fingerprint, unique: true + end + end +end diff --git a/db/migrate/20230717165532_add_nuget_duplicate_allowed_to_namespace_package_settings.rb b/db/migrate/20230717165532_add_nuget_duplicate_allowed_to_namespace_package_settings.rb new file mode 100644 index 00000000000..28b2219d5c0 --- /dev/null +++ b/db/migrate/20230717165532_add_nuget_duplicate_allowed_to_namespace_package_settings.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddNugetDuplicateAllowedToNamespacePackageSettings < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :namespace_package_settings, :nuget_duplicates_allowed, :boolean, default: true, null: false, + if_not_exists: true + add_column :namespace_package_settings, :nuget_duplicate_exception_regex, :text, default: '', null: false, + if_not_exists: true + end + + add_text_limit :namespace_package_settings, :nuget_duplicate_exception_regex, 255 + end + + def down + with_lock_retries do + remove_column :namespace_package_settings, :nuget_duplicates_allowed, if_exists: true + remove_column :namespace_package_settings, :nuget_duplicate_exception_regex, if_exists: true + end + end +end diff --git a/db/migrate/20230718094246_add_namespace_id_to_notes.rb b/db/migrate/20230718094246_add_namespace_id_to_notes.rb new file mode 100644 index 00000000000..f2f3ef401a4 --- /dev/null +++ b/db/migrate/20230718094246_add_namespace_id_to_notes.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddNamespaceIdToNotes < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :notes, :namespace_id, :bigint + end + + def down + remove_column :notes, :namespace_id + end +end diff --git a/db/migrate/20230718111807_add_column_forward_deployment_rollback_allowed_to_ci_cd_setting.rb b/db/migrate/20230718111807_add_column_forward_deployment_rollback_allowed_to_ci_cd_setting.rb new file mode 100644 index 00000000000..cfa442f4861 --- /dev/null +++ b/db/migrate/20230718111807_add_column_forward_deployment_rollback_allowed_to_ci_cd_setting.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddColumnForwardDeploymentRollbackAllowedToCiCdSetting < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :project_ci_cd_settings, :forward_deployment_rollback_allowed, :boolean, default: true, null: false + end + + def down + remove_column :project_ci_cd_settings, :forward_deployment_rollback_allowed + end +end diff --git a/db/migrate/20230718120802_add_package_manager_column_to_sbom_occurrences.rb b/db/migrate/20230718120802_add_package_manager_column_to_sbom_occurrences.rb new file mode 100644 index 00000000000..04b50a5dbcc --- /dev/null +++ b/db/migrate/20230718120802_add_package_manager_column_to_sbom_occurrences.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddPackageManagerColumnToSbomOccurrences < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :sbom_occurrences, :package_manager, :text, if_not_exists: true + end + + add_text_limit :sbom_occurrences, :package_manager, 255 + end + + def down + remove_column :sbom_occurrences, :package_manager, if_exists: true + end +end diff --git a/db/migrate/20230718124213_add_normalized_version_to_packages_nuget_metadatum.rb b/db/migrate/20230718124213_add_normalized_version_to_packages_nuget_metadatum.rb new file mode 100644 index 00000000000..ed86be99e0d --- /dev/null +++ b/db/migrate/20230718124213_add_normalized_version_to_packages_nuget_metadatum.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddNormalizedVersionToPackagesNugetMetadatum < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :packages_nuget_metadata, :normalized_version, :text, if_not_exists: true + end + + add_text_limit :packages_nuget_metadata, :normalized_version, 255 + end + + def down + with_lock_retries do + remove_column :packages_nuget_metadata, :normalized_version, if_exists: true + end + end +end diff --git a/db/migrate/20230718145747_create_target_branch_rules.rb b/db/migrate/20230718145747_create_target_branch_rules.rb new file mode 100644 index 00000000000..e9887a6c49f --- /dev/null +++ b/db/migrate/20230718145747_create_target_branch_rules.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateTargetBranchRules < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + create_table :target_branch_rules do |t| + t.timestamps_with_timezone null: false + t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false + t.text :name, null: false, limit: 255 + # rubocop:disable Migration/AddLimitToTextColumns + # Branch names can be long so we allow for a large number of characters + t.text :target_branch, null: false + # rubocop:enable Migration/AddLimitToTextColumns + end + end +end diff --git a/db/migrate/20230718160522_add_index_packages_nuget_metadatum_on_package_id_and_normalized_version.rb b/db/migrate/20230718160522_add_index_packages_nuget_metadatum_on_package_id_and_normalized_version.rb new file mode 100644 index 00000000000..cba9944b8e1 --- /dev/null +++ b/db/migrate/20230718160522_add_index_packages_nuget_metadatum_on_package_id_and_normalized_version.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexPackagesNugetMetadatumOnPackageIdAndNormalizedVersion < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'idx_packages_nuget_metadata_on_pkg_id_and_normalized_version' + + def up + add_concurrent_index( + :packages_nuget_metadata, + 'package_id, normalized_version', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name(:packages_nuget_metadata, INDEX_NAME) + end +end diff --git a/db/migrate/20230718160749_add_index_packages_packages_on_project_id_and_lower_name_to_packages.rb b/db/migrate/20230718160749_add_index_packages_packages_on_project_id_and_lower_name_to_packages.rb new file mode 100644 index 00000000000..1f21d9fadf3 --- /dev/null +++ b/db/migrate/20230718160749_add_index_packages_packages_on_project_id_and_lower_name_to_packages.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexPackagesPackagesOnProjectIdAndLowerNameToPackages < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_packages_packages_on_project_id_and_lower_name' + NUGET_PACKAGE_TYPE = 4 + + def up + add_concurrent_index( + :packages_packages, + 'project_id, LOWER(name)', + name: INDEX_NAME, + where: "package_type = #{NUGET_PACKAGE_TYPE}" + ) + end + + def down + remove_concurrent_index_by_name(:packages_packages, INDEX_NAME) + end +end diff --git a/db/migrate/20230718234602_add_patch_id_to_merge_request_diffs.rb b/db/migrate/20230718234602_add_patch_id_to_merge_request_diffs.rb new file mode 100644 index 00000000000..f67ffc60513 --- /dev/null +++ b/db/migrate/20230718234602_add_patch_id_to_merge_request_diffs.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddPatchIdToMergeRequestDiffs < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :merge_request_diffs, :patch_id_sha, :binary + end + + def down + remove_column :merge_request_diffs, :patch_id_sha + end +end diff --git a/db/migrate/20230720062249_add_package_registry_allow_anyone_to_pull_option_to_application_settings.rb b/db/migrate/20230720062249_add_package_registry_allow_anyone_to_pull_option_to_application_settings.rb new file mode 100644 index 00000000000..eff2b271f86 --- /dev/null +++ b/db/migrate/20230720062249_add_package_registry_allow_anyone_to_pull_option_to_application_settings.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddPackageRegistryAllowAnyoneToPullOptionToApplicationSettings < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :application_settings, :package_registry_allow_anyone_to_pull_option, :boolean, null: false, + default: true + end +end diff --git a/db/migrate/20230720142334_index_ml_model_versions_on_model_id_and_id.rb b/db/migrate/20230720142334_index_ml_model_versions_on_model_id_and_id.rb new file mode 100644 index 00000000000..934d5e1f8ee --- /dev/null +++ b/db/migrate/20230720142334_index_ml_model_versions_on_model_id_and_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IndexMlModelVersionsOnModelIdAndId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'unique_ml_model_versions_on_model_id_and_id' + + def up + add_concurrent_index :ml_model_versions, [:model_id, :id], name: INDEX_NAME, order: { id: :desc } + end + + def down + remove_concurrent_index_by_name :ml_model_versions, INDEX_NAME + end +end diff --git a/db/migrate/20230723170936_initialize_conversion_of_ci_sources_pipelines_source.rb b/db/migrate/20230723170936_initialize_conversion_of_ci_sources_pipelines_source.rb new file mode 100644 index 00000000000..5ae867b755d --- /dev/null +++ b/db/migrate/20230723170936_initialize_conversion_of_ci_sources_pipelines_source.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiSourcesPipelinesSource < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_sources_pipelines + COLUMNS = %i[pipeline_id source_pipeline_id] + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20230723203612_backfill_default_branch_protection_application_setting.rb b/db/migrate/20230723203612_backfill_default_branch_protection_application_setting.rb new file mode 100644 index 00000000000..6c6231117e1 --- /dev/null +++ b/db/migrate/20230723203612_backfill_default_branch_protection_application_setting.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class BackfillDefaultBranchProtectionApplicationSetting < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class ApplicationSetting < MigrationRecord + self.table_name = 'application_settings' + end + + BRANCH_PROTECTION = [ + { "allow_force_push" => true, + "allowed_to_merge" => [{ "access_level" => 30 }], + "allowed_to_push" => [{ "access_level" => 30 }] }, + { "allow_force_push" => false, + "allowed_to_merge" => [{ "access_level" => 30 }], + "allowed_to_push" => [{ "access_level" => 30 }] }, + { "allow_force_push" => false, + "allowed_to_merge" => [{ "access_level" => 40 }], + "allowed_to_push" => [{ "access_level" => 40 }] }, + { "allow_force_push" => true, + "allowed_to_merge" => [{ "access_level" => 30 }], + "allowed_to_push" => [{ "access_level" => 40 }] }, + { "allow_force_push" => true, + "allowed_to_merge" => [{ "access_level" => 30 }], + "allowed_to_push" => [{ "access_level" => 40 }], + "developer_can_initial_push" => true } + ] + + def up + ApplicationSetting.reset_column_information + + ApplicationSetting.find_each do |application_setting| + level = application_setting.default_branch_protection.to_i + protection_hash = BRANCH_PROTECTION[level] + application_setting.update!(default_branch_protection_defaults: protection_hash) + end + end + + def down + ApplicationSetting.reset_column_information + + ApplicationSetting.update_all(default_branch_protection_defaults: {}) + end +end diff --git a/db/migrate/20230724185321_pm_affected_packages_add_versions_attribute.rb b/db/migrate/20230724185321_pm_affected_packages_add_versions_attribute.rb new file mode 100644 index 00000000000..f1adb65324b --- /dev/null +++ b/db/migrate/20230724185321_pm_affected_packages_add_versions_attribute.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class PmAffectedPackagesAddVersionsAttribute < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :pm_affected_packages, :versions, :jsonb, default: [], null: false + end +end diff --git a/db/migrate/20230725075011_add_updated_at_to_plan_limits.rb b/db/migrate/20230725075011_add_updated_at_to_plan_limits.rb new file mode 100644 index 00000000000..8ed6c68ab67 --- /dev/null +++ b/db/migrate/20230725075011_add_updated_at_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddUpdatedAtToPlanLimits < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :plan_limits, :updated_at, :datetime_with_timezone, null: false, default: -> { 'NOW()' } + end +end diff --git a/db/migrate/20230725085120_update_remote_development_agent_configs_for_firewall_rules.rb b/db/migrate/20230725085120_update_remote_development_agent_configs_for_firewall_rules.rb new file mode 100644 index 00000000000..184fdb0ec9f --- /dev/null +++ b/db/migrate/20230725085120_update_remote_development_agent_configs_for_firewall_rules.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class UpdateRemoteDevelopmentAgentConfigsForFirewallRules < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :remote_development_agent_configs, :network_policy_enabled, :boolean, default: true, null: false + add_column :remote_development_agent_configs, :gitlab_workspaces_proxy_namespace, :text, + default: "gitlab-workspaces", null: false + end + # Kubernetes namespaces are limited to 63 characters + add_text_limit :remote_development_agent_configs, :gitlab_workspaces_proxy_namespace, 63 + end + + def down + with_lock_retries do + remove_column :remote_development_agent_configs, :gitlab_workspaces_proxy_namespace, if_exists: true + remove_column :remote_development_agent_configs, :network_policy_enabled, if_exists: true + end + end +end diff --git a/db/migrate/20230725210728_drop_index_ml_model_versions_on_model_id.rb b/db/migrate/20230725210728_drop_index_ml_model_versions_on_model_id.rb new file mode 100644 index 00000000000..9598e263488 --- /dev/null +++ b/db/migrate/20230725210728_drop_index_ml_model_versions_on_model_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropIndexMlModelVersionsOnModelId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_ml_model_versions_on_model_id' + + def up + remove_concurrent_index_by_name :ml_model_versions, INDEX_NAME + end + + def down + add_concurrent_index :ml_model_versions, :model_id, name: INDEX_NAME + end +end diff --git a/db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb b/db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb new file mode 100644 index 00000000000..71274f4e319 --- /dev/null +++ b/db/migrate/20230726072442_add_npm_scope_and_project_index_to_packages.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddNpmScopeAndProjectIndexToPackages < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'idx_packages_packages_on_npm_scope_and_project_id' + + def up + add_concurrent_index :packages_packages, + "split_part(name, '/', 1), project_id", + where: "package_type = 2 AND position('/' in name) > 0 AND status IN (0, 3) 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/migrate/20230726080527_add_namespace_id_to_issue_search_data.rb b/db/migrate/20230726080527_add_namespace_id_to_issue_search_data.rb new file mode 100644 index 00000000000..e9b0b696492 --- /dev/null +++ b/db/migrate/20230726080527_add_namespace_id_to_issue_search_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddNamespaceIdToIssueSearchData < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :issue_search_data, :namespace_id, :bigint + end + + def down + remove_column :issue_search_data, :namespace_id + end +end diff --git a/db/migrate/20230726104022_add_name_to_google_cloud_logging_configuration.rb b/db/migrate/20230726104022_add_name_to_google_cloud_logging_configuration.rb new file mode 100644 index 00000000000..4ef493092a0 --- /dev/null +++ b/db/migrate/20230726104022_add_name_to_google_cloud_logging_configuration.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddNameToGoogleCloudLoggingConfiguration < Gitlab::Database::Migration[2.1] + # rubocop:disable Migration/AddLimitToTextColumns + # text limit is added in a 20230726104547_add_text_limit_to_google_cloud_logging_configuration_name.rb migration + def change + add_column :audit_events_google_cloud_logging_configurations, :name, :text + end + + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20230726104547_add_text_limit_to_google_cloud_logging_configuration_name.rb b/db/migrate/20230726104547_add_text_limit_to_google_cloud_logging_configuration_name.rb new file mode 100644 index 00000000000..4a13bfda89e --- /dev/null +++ b/db/migrate/20230726104547_add_text_limit_to_google_cloud_logging_configuration_name.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToGoogleCloudLoggingConfigurationName < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_text_limit :audit_events_google_cloud_logging_configurations, :name, 72 + end + + def down + remove_text_limit :audit_events_google_cloud_logging_configurations, :name + end +end diff --git a/db/migrate/20230726104616_add_index_to_google_cloud_logging_configuration.rb b/db/migrate/20230726104616_add_index_to_google_cloud_logging_configuration.rb new file mode 100644 index 00000000000..258d4583aa1 --- /dev/null +++ b/db/migrate/20230726104616_add_index_to_google_cloud_logging_configuration.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddIndexToGoogleCloudLoggingConfiguration < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'uniq_google_cloud_logging_configuration_namespace_id_and_name' + + def up + add_concurrent_index :audit_events_google_cloud_logging_configurations, [:namespace_id, :name], unique: true, + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :audit_events_google_cloud_logging_configurations, INDEX_NAME + end +end diff --git a/db/migrate/20230726142141_add_max_file_download_size_to_application_settings.rb b/db/migrate/20230726142141_add_max_file_download_size_to_application_settings.rb new file mode 100644 index 00000000000..d395da9f14d --- /dev/null +++ b/db/migrate/20230726142141_add_max_file_download_size_to_application_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddMaxFileDownloadSizeToApplicationSettings < Gitlab::Database::Migration[2.1] + def change + add_column :application_settings, :bulk_import_max_download_file_size, :bigint, default: 5120, null: false + end +end diff --git a/db/migrate/20230727084849_create_catalog_resource_components.rb b/db/migrate/20230727084849_create_catalog_resource_components.rb new file mode 100644 index 00000000000..c56f3c96232 --- /dev/null +++ b/db/migrate/20230727084849_create_catalog_resource_components.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreateCatalogResourceComponents < Gitlab::Database::Migration[2.1] + def up + create_table :catalog_resource_components do |t| + t.bigint :catalog_resource_id, null: false, index: true + t.bigint :version_id, null: false, index: true + t.bigint :project_id, null: false, index: true + t.datetime_with_timezone :created_at, null: false + t.integer :resource_type, default: 1, limit: 2, null: false + t.jsonb :inputs, default: {}, null: false + t.text :name, limit: 255, null: false + end + end + + def down + drop_table :catalog_resource_components + end +end diff --git a/db/migrate/20230727091812_add_catalog_resource_fk_to_catalog_resource_components.rb b/db/migrate/20230727091812_add_catalog_resource_fk_to_catalog_resource_components.rb new file mode 100644 index 00000000000..13a76c78efe --- /dev/null +++ b/db/migrate/20230727091812_add_catalog_resource_fk_to_catalog_resource_components.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddCatalogResourceFkToCatalogResourceComponents < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :catalog_resource_components, :catalog_resources, + column: :catalog_resource_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :catalog_resource_components, column: :catalog_resource_id + end + end +end diff --git a/db/migrate/20230727092035_add_catalog_version_fk_to_catalog_resource_components.rb b/db/migrate/20230727092035_add_catalog_version_fk_to_catalog_resource_components.rb new file mode 100644 index 00000000000..5f15a3fd2c2 --- /dev/null +++ b/db/migrate/20230727092035_add_catalog_version_fk_to_catalog_resource_components.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddCatalogVersionFkToCatalogResourceComponents < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :catalog_resource_components, :catalog_resource_versions, + column: :version_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :catalog_resource_components, column: :version_id + end + end +end diff --git a/db/migrate/20230727092425_add_project_fk_to_catalog_resource_components.rb b/db/migrate/20230727092425_add_project_fk_to_catalog_resource_components.rb new file mode 100644 index 00000000000..744fd42d808 --- /dev/null +++ b/db/migrate/20230727092425_add_project_fk_to_catalog_resource_components.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddProjectFkToCatalogResourceComponents < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :catalog_resource_components, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :catalog_resource_components, column: :project_id + end + end +end diff --git a/db/migrate/20230727144741_add_label_lock_on_merge.rb b/db/migrate/20230727144741_add_label_lock_on_merge.rb new file mode 100644 index 00000000000..9c67bb08119 --- /dev/null +++ b/db/migrate/20230727144741_add_label_lock_on_merge.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddLabelLockOnMerge < Gitlab::Database::Migration[2.1] + def change + # no-op as this caused an incident + # See https://gitlab.com/gitlab-com/gl-infra/production/-/issues/16134 + # add_column :labels, :lock_on_merge, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20230727150416_add_max_import_remote_file_size_to_application_settings.rb b/db/migrate/20230727150416_add_max_import_remote_file_size_to_application_settings.rb new file mode 100644 index 00000000000..e2e44c22a3b --- /dev/null +++ b/db/migrate/20230727150416_add_max_import_remote_file_size_to_application_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddMaxImportRemoteFileSizeToApplicationSettings < Gitlab::Database::Migration[2.1] + def change + add_column :application_settings, :max_import_remote_file_size, :bigint, default: 10240, null: false + end +end diff --git a/db/migrate/20230727203840_drop_unique_idx_on_vuln_signatures.rb b/db/migrate/20230727203840_drop_unique_idx_on_vuln_signatures.rb new file mode 100644 index 00000000000..df5957cb24a --- /dev/null +++ b/db/migrate/20230727203840_drop_unique_idx_on_vuln_signatures.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropUniqueIdxOnVulnSignatures < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'idx_vuln_signatures_on_occurrences_id_and_signature_sha' + + def up + remove_concurrent_index_by_name :vulnerability_finding_signatures, INDEX_NAME + end + + def down + add_concurrent_index :vulnerability_finding_signatures, %i[finding_id signature_sha], unique: true, name: INDEX_NAME + end +end diff --git a/db/migrate/20230728171609_add_ci_job_annotations_plan_limits.rb b/db/migrate/20230728171609_add_ci_job_annotations_plan_limits.rb new file mode 100644 index 00000000000..2e39280b6fe --- /dev/null +++ b/db/migrate/20230728171609_add_ci_job_annotations_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddCiJobAnnotationsPlanLimits < Gitlab::Database::Migration[2.1] + def change + add_column :plan_limits, :ci_max_artifact_size_annotations, :integer, null: false, default: 0 + add_column :plan_limits, :ci_job_annotations_size, :integer, null: false, default: 81920 + add_column :plan_limits, :ci_job_annotations_num, :integer, null: false, default: 20 + end +end diff --git a/db/migrate/20230728193736_add_has_merge_request_to_vulnerability_reads.rb b/db/migrate/20230728193736_add_has_merge_request_to_vulnerability_reads.rb new file mode 100644 index 00000000000..aec120f3c80 --- /dev/null +++ b/db/migrate/20230728193736_add_has_merge_request_to_vulnerability_reads.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddHasMergeRequestToVulnerabilityReads < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :vulnerability_reads, :has_merge_request, :boolean, default: false, if_not_exists: true + end + + def down + remove_column :vulnerability_reads, :has_merge_request, if_exists: true + end +end diff --git a/db/migrate/20230731121354_remove_not_null_from_subscription_add_on_purchases_namespace_id.rb b/db/migrate/20230731121354_remove_not_null_from_subscription_add_on_purchases_namespace_id.rb new file mode 100644 index 00000000000..1de02e0f4ed --- /dev/null +++ b/db/migrate/20230731121354_remove_not_null_from_subscription_add_on_purchases_namespace_id.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveNotNullFromSubscriptionAddOnPurchasesNamespaceId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + change_column_null :subscription_add_on_purchases, :namespace_id, true + end + + def down + change_column_null :subscription_add_on_purchases, :namespace_id, false + end +end diff --git a/db/migrate/20230731130351_remove_initialize_analytics_worker_job_instances.rb b/db/migrate/20230731130351_remove_initialize_analytics_worker_job_instances.rb new file mode 100644 index 00000000000..b1bd58d679a --- /dev/null +++ b/db/migrate/20230731130351_remove_initialize_analytics_worker_job_instances.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveInitializeAnalyticsWorkerJobInstances < Gitlab::Database::Migration[2.1] + DEPRECATED_JOB_CLASSES = %w[InitializeAnalyticsWorker] + + disable_ddl_transaction! + + def up + sidekiq_remove_jobs(job_klasses: DEPRECATED_JOB_CLASSES) + end + + def down + # This migration removes any instances of deprecated workers and cannot be undone. + end +end diff --git a/db/migrate/20230802065830_add_max_decompression_archive_size_to_application_settings.rb b/db/migrate/20230802065830_add_max_decompression_archive_size_to_application_settings.rb new file mode 100644 index 00000000000..c2ed6204b0a --- /dev/null +++ b/db/migrate/20230802065830_add_max_decompression_archive_size_to_application_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddMaxDecompressionArchiveSizeToApplicationSettings < Gitlab::Database::Migration[2.1] + def change + add_column :application_settings, :max_decompressed_archive_size, :integer, default: 25600, null: false + end +end diff --git a/db/migrate/20230802070337_add_application_settings_max_decompression_size_constraint.rb b/db/migrate/20230802070337_add_application_settings_max_decompression_size_constraint.rb new file mode 100644 index 00000000000..7698aef6f0b --- /dev/null +++ b/db/migrate/20230802070337_add_application_settings_max_decompression_size_constraint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddApplicationSettingsMaxDecompressionSizeConstraint < Gitlab::Database::Migration[2.1] + CONSTRAINT_NAME = 'app_settings_max_decompressed_archive_size_positive' + + disable_ddl_transaction! + + def up + add_check_constraint :application_settings, 'max_decompressed_archive_size >= 0', CONSTRAINT_NAME + end + + def down + remove_check_constraint :application_settings, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20230802124027_add_component_name_and_input_file_path_to_sbom_occurrences.rb b/db/migrate/20230802124027_add_component_name_and_input_file_path_to_sbom_occurrences.rb new file mode 100644 index 00000000000..4a460f9c44b --- /dev/null +++ b/db/migrate/20230802124027_add_component_name_and_input_file_path_to_sbom_occurrences.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddComponentNameAndInputFilePathToSbomOccurrences < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :sbom_occurrences, :component_name, :text, if_not_exists: true + add_column :sbom_occurrences, :input_file_path, :text, if_not_exists: true + end + + add_text_limit :sbom_occurrences, :component_name, 255 + add_text_limit :sbom_occurrences, :input_file_path, 255 + end + + def down + with_lock_retries do + remove_column :sbom_occurrences, :component_name, if_exists: true + remove_column :sbom_occurrences, :input_file_path, if_exists: true + end + end +end diff --git a/db/migrate/20230803125434_add_has_merge_request_on_vulnerability_reads_trigger.rb b/db/migrate/20230803125434_add_has_merge_request_on_vulnerability_reads_trigger.rb new file mode 100644 index 00000000000..dc6e4b94d9c --- /dev/null +++ b/db/migrate/20230803125434_add_has_merge_request_on_vulnerability_reads_trigger.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +class AddHasMergeRequestOnVulnerabilityReadsTrigger < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + include Gitlab::Database::SchemaHelpers + + TRIGGER_ON_INSERT = 'trigger_update_has_merge_request_on_vulnerability_mr_links_update' + INSERT_FUNCTION_NAME = 'set_has_merge_request_on_vulnerability_reads' + + TRIGGER_ON_DELETE = 'trigger_update_has_merge_request_on_vulnerability_mr_links_delete' + DELETE_FUNCTION_NAME = 'unset_has_merge_request_on_vulnerability_reads' + + def up + create_trigger_function(INSERT_FUNCTION_NAME, replace: true) do + <<~SQL + UPDATE + vulnerability_reads + SET + has_merge_request = true + WHERE + vulnerability_id = NEW.vulnerability_id AND has_merge_request IS FALSE; + RETURN NULL; + SQL + end + + execute(<<~SQL) + CREATE OR REPLACE FUNCTION #{DELETE_FUNCTION_NAME}() + RETURNS TRIGGER + LANGUAGE plpgsql + AS $$ + DECLARE + has_merge_request_links integer; + BEGIN + PERFORM 1 + FROM + vulnerability_reads + WHERE + vulnerability_id = OLD.vulnerability_id + FOR UPDATE; + + SELECT 1 INTO has_merge_request_links FROM vulnerability_merge_request_links WHERE vulnerability_id = OLD.vulnerability_id LIMIT 1; + + IF (has_merge_request_links = 1) THEN + RETURN NULL; + END IF; + + UPDATE + vulnerability_reads + SET + has_merge_request = false + WHERE + vulnerability_id = OLD.vulnerability_id; + + RETURN NULL; + END + $$; + SQL + + execute(<<~SQL) + CREATE TRIGGER #{TRIGGER_ON_INSERT} + AFTER INSERT ON vulnerability_merge_request_links + FOR EACH ROW + EXECUTE FUNCTION #{INSERT_FUNCTION_NAME}(); + SQL + + execute(<<~SQL) + CREATE TRIGGER #{TRIGGER_ON_DELETE} + AFTER DELETE ON vulnerability_merge_request_links + FOR EACH ROW + EXECUTE FUNCTION #{DELETE_FUNCTION_NAME}(); + SQL + end + + def down + drop_trigger(:vulnerability_merge_request_links, TRIGGER_ON_INSERT) + drop_function(INSERT_FUNCTION_NAME) + drop_trigger(:vulnerability_merge_request_links, TRIGGER_ON_DELETE) + drop_function(DELETE_FUNCTION_NAME) + end +end diff --git a/db/migrate/20230804064817_backfill_google_cloud_logging_name.rb b/db/migrate/20230804064817_backfill_google_cloud_logging_name.rb new file mode 100644 index 00000000000..3c9de56e1df --- /dev/null +++ b/db/migrate/20230804064817_backfill_google_cloud_logging_name.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class BackfillGoogleCloudLoggingName < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class GoogleCloudLoggingConfiguration < MigrationRecord + self.table_name = 'audit_events_google_cloud_logging_configurations' + end + + def up + GoogleCloudLoggingConfiguration.update_all("name = 'Destination ' || id") + end + + def down + # noop + end +end diff --git a/db/migrate/20230804065052_add_not_null_to_gcp_config_name.rb b/db/migrate/20230804065052_add_not_null_to_gcp_config_name.rb new file mode 100644 index 00000000000..af5eab64795 --- /dev/null +++ b/db/migrate/20230804065052_add_not_null_to_gcp_config_name.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddNotNullToGcpConfigName < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + change_column_null :audit_events_google_cloud_logging_configurations, :name, false + end + + def down + change_column_null :audit_events_google_cloud_logging_configurations, :name, true + end +end diff --git a/db/migrate/20230804133028_add_index_custom_email_verifications_on_triggered_at_and_state_started.rb b/db/migrate/20230804133028_add_index_custom_email_verifications_on_triggered_at_and_state_started.rb new file mode 100644 index 00000000000..cf90e88f8cd --- /dev/null +++ b/db/migrate/20230804133028_add_index_custom_email_verifications_on_triggered_at_and_state_started.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexCustomEmailVerificationsOnTriggeredAtAndStateStarted < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'i_custom_email_verifications_on_triggered_at_and_state_started' + + def up + add_concurrent_index :service_desk_custom_email_verifications, :triggered_at, + where: 'state = 0', + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :service_desk_custom_email_verifications, INDEX_NAME + end +end diff --git a/db/migrate/20230804141257_add_sentry_clientside_traces_sample_rate.rb b/db/migrate/20230804141257_add_sentry_clientside_traces_sample_rate.rb new file mode 100644 index 00000000000..aaf569c90ed --- /dev/null +++ b/db/migrate/20230804141257_add_sentry_clientside_traces_sample_rate.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddSentryClientsideTracesSampleRate < Gitlab::Database::Migration[2.1] + def change + add_column :application_settings, :sentry_clientside_traces_sample_rate, + :float, default: 0, null: false, if_not_exists: true + end +end diff --git a/db/migrate/20230804141550_add_sentry_clientside_traces_sample_rate_constraint.rb b/db/migrate/20230804141550_add_sentry_clientside_traces_sample_rate_constraint.rb new file mode 100644 index 00000000000..34ccb5e39d9 --- /dev/null +++ b/db/migrate/20230804141550_add_sentry_clientside_traces_sample_rate_constraint.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddSentryClientsideTracesSampleRateConstraint < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + CONSTRAINT_NAME = 'check_app_settings_sentry_clientside_traces_sample_rate_range' + + def up + add_check_constraint :application_settings, + 'sentry_clientside_traces_sample_rate >= 0 AND sentry_clientside_traces_sample_rate <= 1', + CONSTRAINT_NAME + end + + def down + remove_check_constraint :application_settings, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20230807101745_add_active_to_audit_events_streaming_headers.rb b/db/migrate/20230807101745_add_active_to_audit_events_streaming_headers.rb new file mode 100644 index 00000000000..ec9d679353d --- /dev/null +++ b/db/migrate/20230807101745_add_active_to_audit_events_streaming_headers.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddActiveToAuditEventsStreamingHeaders < Gitlab::Database::Migration[2.1] + def change + add_column :audit_events_streaming_headers, :active, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20230807105131_add_active_to_instance_audit_events_streaming_headers.rb b/db/migrate/20230807105131_add_active_to_instance_audit_events_streaming_headers.rb new file mode 100644 index 00000000000..5be4c09c39c --- /dev/null +++ b/db/migrate/20230807105131_add_active_to_instance_audit_events_streaming_headers.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddActiveToInstanceAuditEventsStreamingHeaders < Gitlab::Database::Migration[2.1] + def change + add_column :instance_audit_events_streaming_headers, :active, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20230807202427_add_label_lock_on_merge_redux.rb b/db/migrate/20230807202427_add_label_lock_on_merge_redux.rb new file mode 100644 index 00000000000..99a4808777e --- /dev/null +++ b/db/migrate/20230807202427_add_label_lock_on_merge_redux.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128570 +class AddLabelLockOnMergeRedux < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + return if column_exists?(:labels, :lock_on_merge) + + add_column :labels, :lock_on_merge, :boolean, default: false, null: false + end + + def down + return unless column_exists?(:labels, :lock_on_merge) + + remove_column :labels, :lock_on_merge + end +end diff --git a/db/migrate/20230808123101_rename_application_settings_database_apdex_settings.rb b/db/migrate/20230808123101_rename_application_settings_database_apdex_settings.rb new file mode 100644 index 00000000000..ce7c54f00ef --- /dev/null +++ b/db/migrate/20230808123101_rename_application_settings_database_apdex_settings.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RenameApplicationSettingsDatabaseApdexSettings < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + rename_column_concurrently( + :application_settings, + :database_apdex_settings, + :prometheus_alert_db_indicators_settings + ) + end + + def down + undo_rename_column_concurrently( + :application_settings, + :database_apdex_settings, + :prometheus_alert_db_indicators_settings + ) + end +end diff --git a/db/migrate/20230808135706_add_max_yaml_size_to_application_settings.rb b/db/migrate/20230808135706_add_max_yaml_size_to_application_settings.rb new file mode 100644 index 00000000000..f1b3518d697 --- /dev/null +++ b/db/migrate/20230808135706_add_max_yaml_size_to_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddMaxYamlSizeToApplicationSettings < Gitlab::Database::Migration[2.1] + # Migration that is running immidiately after this migration is + # UpdateCiMaxTotalYamlSizeBytesDefaultValue which will update the limit value + # to whatever was set by the self-hosted customer. + + DEFAULT = 1.megabyte * 150 # max_yaml_size_bytes * ci_max_includes + + def change + add_column :application_settings, :ci_max_total_yaml_size_bytes, :integer, default: DEFAULT, null: false + end +end diff --git a/db/migrate/20230808135859_update_ci_max_total_yaml_size_bytes_default_value.rb b/db/migrate/20230808135859_update_ci_max_total_yaml_size_bytes_default_value.rb new file mode 100644 index 00000000000..546a102b4e6 --- /dev/null +++ b/db/migrate/20230808135859_update_ci_max_total_yaml_size_bytes_default_value.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class UpdateCiMaxTotalYamlSizeBytesDefaultValue < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + execute <<~SQL + UPDATE application_settings + SET ci_max_total_yaml_size_bytes = max_yaml_size_bytes * ci_max_includes + SQL + end + + def down + # No-op + end +end diff --git a/db/migrate/20230808140338_add_flux_resource_column_to_environments.rb b/db/migrate/20230808140338_add_flux_resource_column_to_environments.rb new file mode 100644 index 00000000000..0f9eaacb6ac --- /dev/null +++ b/db/migrate/20230808140338_add_flux_resource_column_to_environments.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddFluxResourceColumnToEnvironments < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :environments, :flux_resource_path, :text unless column_exists?(:environments, :flux_resource_path) + end + + add_text_limit :environments, :flux_resource_path, 255 + end + + def down + with_lock_retries do + remove_column :environments, :flux_resource_path, if_exists: true + end + end +end diff --git a/db/migrate/20230809011700_add_search_to_zoekt_namespace.rb b/db/migrate/20230809011700_add_search_to_zoekt_namespace.rb new file mode 100644 index 00000000000..d7d22dc52f1 --- /dev/null +++ b/db/migrate/20230809011700_add_search_to_zoekt_namespace.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddSearchToZoektNamespace < Gitlab::Database::Migration[2.1] + def change + add_column :zoekt_indexed_namespaces, :search, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20230809140938_add_indexes_to_external_status_checks_on_id_and_project_id.rb b/db/migrate/20230809140938_add_indexes_to_external_status_checks_on_id_and_project_id.rb new file mode 100644 index 00000000000..68288ce6ee8 --- /dev/null +++ b/db/migrate/20230809140938_add_indexes_to_external_status_checks_on_id_and_project_id.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddIndexesToExternalStatusChecksOnIdAndProjectId < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'idx_external_status_checks_on_id_and_project_id' + disable_ddl_transaction! + + def up + add_concurrent_index :external_status_checks, [:id, :project_id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :external_status_checks, name: INDEX_NAME + end +end diff --git a/db/migrate/20230809165212_add_path_prefix_and_build_ref_to_pages_deployments.rb b/db/migrate/20230809165212_add_path_prefix_and_build_ref_to_pages_deployments.rb new file mode 100644 index 00000000000..d2fc8bfc9bc --- /dev/null +++ b/db/migrate/20230809165212_add_path_prefix_and_build_ref_to_pages_deployments.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddPathPrefixAndBuildRefToPagesDeployments < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20230809165213_add_index_to_path_prefix_and_ref_to_pages_deployments + def change + add_column :pages_deployments, :path_prefix, :text + add_column :pages_deployments, :build_ref, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20230809165213_add_index_to_path_prefix_and_build_ref_to_pages_deployments.rb b/db/migrate/20230809165213_add_index_to_path_prefix_and_build_ref_to_pages_deployments.rb new file mode 100644 index 00000000000..bea4346cfab --- /dev/null +++ b/db/migrate/20230809165213_add_index_to_path_prefix_and_build_ref_to_pages_deployments.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddIndexToPathPrefixAndBuildRefToPagesDeployments < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = :pages_deployments + INDEX_NAME = 'index_pages_deployments_unique_path_prefix_by_project' + + def up + add_text_limit TABLE_NAME, :path_prefix, 128 + add_text_limit TABLE_NAME, :build_ref, 512 + + add_concurrent_index TABLE_NAME, + [:project_id, :path_prefix], + name: INDEX_NAME, + unique: true + end + + def down + remove_text_limit TABLE_NAME, :path_prefix + remove_text_limit TABLE_NAME, :build_ref + + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/migrate/20230809192256_add_file_size_limit_to_plan_limits.rb b/db/migrate/20230809192256_add_file_size_limit_to_plan_limits.rb new file mode 100644 index 00000000000..ffbec39a78d --- /dev/null +++ b/db/migrate/20230809192256_add_file_size_limit_to_plan_limits.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddFileSizeLimitToPlanLimits < Gitlab::Database::Migration[2.1] + def change + add_column :plan_limits, :file_size_limit_mb, :float, default: 100, null: false + end +end diff --git a/db/migrate/20230810132301_add_has_remediations_to_vulnerability_reads.rb b/db/migrate/20230810132301_add_has_remediations_to_vulnerability_reads.rb new file mode 100644 index 00000000000..d4648378c97 --- /dev/null +++ b/db/migrate/20230810132301_add_has_remediations_to_vulnerability_reads.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddHasRemediationsToVulnerabilityReads < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :vulnerability_reads, :has_remediations, :boolean, default: false, null: false + end + + def down + remove_column :vulnerability_reads, :has_remediations + end +end diff --git a/db/migrate/20230814055259_add_pipeline_id_and_export_type_to_dependency_list_exports.rb b/db/migrate/20230814055259_add_pipeline_id_and_export_type_to_dependency_list_exports.rb new file mode 100644 index 00000000000..a6d58fef65c --- /dev/null +++ b/db/migrate/20230814055259_add_pipeline_id_and_export_type_to_dependency_list_exports.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddPipelineIdAndExportTypeToDependencyListExports < Gitlab::Database::Migration[2.1] + def change + add_column :dependency_list_exports, :pipeline_id, :bigint + add_column :dependency_list_exports, :export_type, :integer, limit: 2, default: 0, null: false + end +end diff --git a/db/migrate/20230814055310_add_index_pipeline_id_to_dependency_list_exports.rb b/db/migrate/20230814055310_add_index_pipeline_id_to_dependency_list_exports.rb new file mode 100644 index 00000000000..31ca7115668 --- /dev/null +++ b/db/migrate/20230814055310_add_index_pipeline_id_to_dependency_list_exports.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIndexPipelineIdToDependencyListExports < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_dependency_list_exports_on_pipeline_id' + + def up + add_concurrent_index :dependency_list_exports, :pipeline_id, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :dependency_list_exports, INDEX_NAME + end +end diff --git a/db/post_migrate/20230317004428_migrate_daily_redis_hll_events_to_weekly_aggregation.rb b/db/post_migrate/20230317004428_migrate_daily_redis_hll_events_to_weekly_aggregation.rb index 168354cd946..59bff26f964 100644 --- a/db/post_migrate/20230317004428_migrate_daily_redis_hll_events_to_weekly_aggregation.rb +++ b/db/post_migrate/20230317004428_migrate_daily_redis_hll_events_to_weekly_aggregation.rb @@ -3,12 +3,6 @@ class MigrateDailyRedisHllEventsToWeeklyAggregation < Gitlab::Database::Migration[2.1] disable_ddl_transaction! - # Due to the feature flag `use_metric_definitions_for_events_list`, this makes a `SELECT` call - # so this migration is now considered a DML (data manipulation) migration. - # For the time being, we need to specify only `main` database because it is now technically retriving DB data. - # Should be removed with <issue link> - restrict_gitlab_migration gitlab_schema: :gitlab_main - DAILY_EVENTS = %w[g_edit_by_web_ide g_edit_by_sfe diff --git a/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb b/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb index 55a017464c2..a3bf2cfda17 100644 --- a/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb +++ b/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb @@ -7,24 +7,27 @@ class RemoveSamlProviderAndIdentitiesNonRootGroup < Gitlab::Database::Migration[ restrict_gitlab_migration gitlab_schema: :gitlab_main def up - each_batch_range('saml_providers', scope: ->(table) { table.all }, of: BATCH_SIZE) do |min, max| - execute <<~SQL - DELETE FROM identities - WHERE identities.saml_provider_id - IN - ( - SELECT saml_providers.id FROM saml_providers - INNER JOIN namespaces ON namespaces.id=saml_providers.group_id - AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL - AND saml_providers.id BETWEEN #{min} AND #{max} - ); + ::Gitlab::Database + .allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/419931") do + each_batch_range('saml_providers', scope: ->(table) { table.all }, of: BATCH_SIZE) do |min, max| + execute <<~SQL + DELETE FROM identities + WHERE identities.saml_provider_id + IN + ( + SELECT saml_providers.id FROM saml_providers + INNER JOIN namespaces ON namespaces.id=saml_providers.group_id + AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL + AND saml_providers.id BETWEEN #{min} AND #{max} + ); - DELETE FROM saml_providers - USING namespaces - WHERE namespaces.id=saml_providers.group_id - AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL - AND saml_providers.id BETWEEN #{min} AND #{max}; - SQL + DELETE FROM saml_providers + USING namespaces + WHERE namespaces.id=saml_providers.group_id + AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL + AND saml_providers.id BETWEEN #{min} AND #{max}; + SQL + end end end diff --git a/db/post_migrate/20230419094939_swap_merge_request_metrics_id_to_bigint_for_self_hosts.rb b/db/post_migrate/20230419094939_swap_merge_request_metrics_id_to_bigint_for_self_hosts.rb index d249ffb9c1b..f27cc34aef8 100644 --- a/db/post_migrate/20230419094939_swap_merge_request_metrics_id_to_bigint_for_self_hosts.rb +++ b/db/post_migrate/20230419094939_swap_merge_request_metrics_id_to_bigint_for_self_hosts.rb @@ -31,8 +31,8 @@ class SwapMergeRequestMetricsIdToBigintForSelfHosts < Gitlab::Database::Migratio def swap add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: 'index_merge_request_metrics_on_id_convert_to_bigint' - add_concurrent_index TABLE_NAME, 'target_project_id, merged_at DESC NULLS LAST, id_convert_to_bigint DESC', - name: TMP_INDEX_NAME + add_concurrent_index TABLE_NAME, [:target_project_id, :merged_at, :id_convert_to_bigint], + name: TMP_INDEX_NAME, order: { merged_at: 'DESC NULLS LAST', id_convert_to_bigint: 'DESC' } with_lock_retries(raise_on_exhaustion: true) do execute "LOCK TABLE #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" diff --git a/db/post_migrate/20230612232000_queue_backfill_dismissal_reason_in_vulnerability_reads.rb b/db/post_migrate/20230612232000_queue_backfill_dismissal_reason_in_vulnerability_reads.rb new file mode 100644 index 00000000000..2f7c670795a --- /dev/null +++ b/db/post_migrate/20230612232000_queue_backfill_dismissal_reason_in_vulnerability_reads.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class QueueBackfillDismissalReasonInVulnerabilityReads < Gitlab::Database::Migration[2.1] + MIGRATION = "BackfillDismissalReasonInVulnerabilityReads" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 5000 + SUB_BATCH_SIZE = 500 + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :vulnerability_reads, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :vulnerability_reads, :id, []) + end +end diff --git a/db/post_migrate/20230701043315_ensure_backfill_for_ci_pipeline_variables_pipeline_id_is_finished.rb b/db/post_migrate/20230701043315_ensure_backfill_for_ci_pipeline_variables_pipeline_id_is_finished.rb new file mode 100644 index 00000000000..28c520fea6b --- /dev/null +++ b/db/post_migrate/20230701043315_ensure_backfill_for_ci_pipeline_variables_pipeline_id_is_finished.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class EnsureBackfillForCiPipelineVariablesPipelineIdIsFinished < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_ci + disable_ddl_transaction! + + TABLE_NAME = :ci_pipeline_variables + + def up + # no-op + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230701053315_ensure_again_backfill_for_ci_pipeline_variables_pipeline_id_is_finished.rb b/db/post_migrate/20230701053315_ensure_again_backfill_for_ci_pipeline_variables_pipeline_id_is_finished.rb new file mode 100644 index 00000000000..90e8b4d96b3 --- /dev/null +++ b/db/post_migrate/20230701053315_ensure_again_backfill_for_ci_pipeline_variables_pipeline_id_is_finished.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class EnsureAgainBackfillForCiPipelineVariablesPipelineIdIsFinished < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_ci + disable_ddl_transaction! + + TABLE_NAME = :ci_pipeline_variables + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: TABLE_NAME, + column_name: 'id', + job_arguments: [['pipeline_id'], ['pipeline_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230702053002_create_async_index_for_ci_pipline_variables_pipeline_id.rb b/db/post_migrate/20230702053002_create_async_index_for_ci_pipline_variables_pipeline_id.rb new file mode 100644 index 00000000000..0919dceed7e --- /dev/null +++ b/db/post_migrate/20230702053002_create_async_index_for_ci_pipline_variables_pipeline_id.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CreateAsyncIndexForCiPiplineVariablesPipelineId < Gitlab::Database::Migration[2.1] + TABLE_NAME = :ci_pipeline_variables + INDEX_NAME = "index_ci_pipeline_variables_on_pipeline_id_bigint_and_key" + + def up + prepare_async_index TABLE_NAME, [:pipeline_id_convert_to_bigint, :key], unique: true, name: INDEX_NAME + end + + def down + unprepare_async_index TABLE_NAME, [:pipeline_id_convert_to_bigint, :key], unique: true, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230710024518_ensure_todos_bigint_backfill_completed_for_self_managed.rb b/db/post_migrate/20230710024518_ensure_todos_bigint_backfill_completed_for_self_managed.rb new file mode 100644 index 00000000000..5ea4f4f0594 --- /dev/null +++ b/db/post_migrate/20230710024518_ensure_todos_bigint_backfill_completed_for_self_managed.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class EnsureTodosBigintBackfillCompletedForSelfManaged < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + return if should_skip? + + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'todos', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end + + private + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230710024903_swap_todos_note_id_to_bigint_for_self_managed.rb b/db/post_migrate/20230710024903_swap_todos_note_id_to_bigint_for_self_managed.rb new file mode 100644 index 00000000000..2d92be1e7d1 --- /dev/null +++ b/db/post_migrate/20230710024903_swap_todos_note_id_to_bigint_for_self_managed.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +class SwapTodosNoteIdToBigintForSelfManaged < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'todos' + + def up + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def swap + # This will replace the existing index_todos_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, + name: 'index_todos_on_note_id_convert_to_bigint' + + # This will replace the existing fk_91d1f47b13 + add_concurrent_foreign_key TABLE_NAME, :notes, column: :note_id_convert_to_bigint, + name: 'fk_todos_note_id_convert_to_bigint', + on_delete: :cascade + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + execute 'DROP INDEX IF EXISTS index_todos_on_note_id' + rename_index TABLE_NAME, 'index_todos_on_note_id_convert_to_bigint', + 'index_todos_on_note_id' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_91d1f47b13" + rename_constraint(TABLE_NAME, 'fk_todos_note_id_convert_to_bigint', 'fk_91d1f47b13') + end + end + + private + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230711033030_backfill_ci_pipeline_chat_data_pipeline_id_bigint_conversion.rb b/db/post_migrate/20230711033030_backfill_ci_pipeline_chat_data_pipeline_id_bigint_conversion.rb new file mode 100644 index 00000000000..f5274006d0e --- /dev/null +++ b/db/post_migrate/20230711033030_backfill_ci_pipeline_chat_data_pipeline_id_bigint_conversion.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class BackfillCiPipelineChatDataPipelineIdBigintConversion < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + TABLE = :ci_pipeline_chat_data + COLUMNS = %i[pipeline_id] + SUB_BATCH_SIZE = 500 + + def up + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS, sub_batch_size: SUB_BATCH_SIZE) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20230711182029_schedule_remove_temp_index_vulnerability_occurrences.rb b/db/post_migrate/20230711182029_schedule_remove_temp_index_vulnerability_occurrences.rb new file mode 100644 index 00000000000..ee286f40b1a --- /dev/null +++ b/db/post_migrate/20230711182029_schedule_remove_temp_index_vulnerability_occurrences.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class ScheduleRemoveTempIndexVulnerabilityOccurrences < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'tmp_idx_vulnerability_occurrences_on_id_where_report_type_7_99' + + # TODO: Index to be destroyed synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/417880 + def up + prepare_async_index_removal :vulnerability_occurrences, :id, where: 'report_type IN (7, 99)', name: INDEX_NAME + end + + def down + unprepare_async_index :vulnerability_occurrences, :id, where: 'report_type IN (7, 99)', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb b/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb new file mode 100644 index 00000000000..0c76b73dcdc --- /dev/null +++ b/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class DropIndexDeploymentsOnProjectIdAndStatus < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_deployments_on_project_id_and_status' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :deployments, name: INDEX_NAME + end + + def down + # This is based on the following `CREATE INDEX` command in db/init_structure.sql: + # CREATE INDEX index_deployments_on_project_id_and_status ON deployments + # USING btree (project_id, status) + add_concurrent_index :deployments, %i[project_id status], name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb b/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb new file mode 100644 index 00000000000..9916ee7f9ba --- /dev/null +++ b/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class DropIndexDeploymentsOnProjectIdSha < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_deployments_on_project_id_sha' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :deployments, name: INDEX_NAME + end + + def down + # This is based on the following `CREATE INDEX` command in db/init_structure.sql: + # CREATE INDEX index_deployments_on_project_id_sha ON deployments + # USING btree (project_id, sha); + add_concurrent_index :deployments, %i[project_id sha], name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb b/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb new file mode 100644 index 00000000000..52a02e68d14 --- /dev/null +++ b/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class DropIndexDeploymentsOnEnvironmentIdAndIidAndProjectId < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_deployments_on_environment_id_and_iid_and_project_id' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :deployments, name: INDEX_NAME + end + + def down + # This is based on the following `CREATE INDEX` command in db/init_structure.sql: + # CREATE INDEX index_deployments_on_environment_id_and_iid_and_project_id ON deployments + # USING btree (environment_id, iid, project_id); + add_concurrent_index :deployments, %i[environment_id iid project_id], name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230712135428_backfill_ci_pipeline_messages_pipeline_id_bigint_conversion.rb b/db/post_migrate/20230712135428_backfill_ci_pipeline_messages_pipeline_id_bigint_conversion.rb new file mode 100644 index 00000000000..6ac036d0f76 --- /dev/null +++ b/db/post_migrate/20230712135428_backfill_ci_pipeline_messages_pipeline_id_bigint_conversion.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class BackfillCiPipelineMessagesPipelineIdBigintConversion < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + TABLE = :ci_pipeline_messages + COLUMNS = %i[pipeline_id] + SUB_BATCH_SIZE = 500 + + def up + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS, sub_batch_size: SUB_BATCH_SIZE) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20230712141733_remove_chat_names_integration_id_column.rb b/db/post_migrate/20230712141733_remove_chat_names_integration_id_column.rb new file mode 100644 index 00000000000..0c89a9e1bf8 --- /dev/null +++ b/db/post_migrate/20230712141733_remove_chat_names_integration_id_column.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveChatNamesIntegrationIdColumn < Gitlab::Database::Migration[2.1] + def up + remove_column :chat_names, :integration_id + end + + def down + add_column :chat_names, :integration_id, :integer, if_not_exists: true + end +end diff --git a/db/post_migrate/20230712145557_queue_backfill_missing_vulnerability_dismissal_details.rb b/db/post_migrate/20230712145557_queue_backfill_missing_vulnerability_dismissal_details.rb new file mode 100644 index 00000000000..b3e54111562 --- /dev/null +++ b/db/post_migrate/20230712145557_queue_backfill_missing_vulnerability_dismissal_details.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class QueueBackfillMissingVulnerabilityDismissalDetails < Gitlab::Database::Migration[2.1] + MIGRATION = "BackfillMissingVulnerabilityDismissalDetails" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 500 + SUB_BATCH_SIZE = 100 + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :vulnerabilities, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :vulnerabilities, :id, []) + end +end diff --git a/db/post_migrate/20230713021230_remove_namespaces_users_managing_group_id_fk.rb b/db/post_migrate/20230713021230_remove_namespaces_users_managing_group_id_fk.rb new file mode 100644 index 00000000000..0cc76d129ef --- /dev/null +++ b/db/post_migrate/20230713021230_remove_namespaces_users_managing_group_id_fk.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoveNamespacesUsersManagingGroupIdFk < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + return unless foreign_key_exists?(:users, :namespaces, name: "fk_a4b8fefe3e") + + with_lock_retries do + remove_foreign_key_if_exists(:users, :namespaces, + name: "fk_a4b8fefe3e", reverse_lock_order: true) + end + end + + def down + add_concurrent_foreign_key(:users, :namespaces, + name: "fk_a4b8fefe3e", column: :managing_group_id, + target_column: :id, on_delete: :nullify) + end +end diff --git a/db/post_migrate/20230713234121_create_index_vulnerability_findings_on_uuid_sync.rb b/db/post_migrate/20230713234121_create_index_vulnerability_findings_on_uuid_sync.rb new file mode 100644 index 00000000000..abbf2390b0d --- /dev/null +++ b/db/post_migrate/20230713234121_create_index_vulnerability_findings_on_uuid_sync.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CreateIndexVulnerabilityFindingsOnUuidSync < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_vuln_findings_on_uuid_including_vuln_id' + + disable_ddl_transaction! + + def up + return if index_exists_by_name?(:vulnerability_occurrences, INDEX_NAME) + + disable_statement_timeout do + execute <<~SQL + CREATE UNIQUE INDEX CONCURRENTLY #{INDEX_NAME} ON vulnerability_occurrences (uuid) include (vulnerability_id); + SQL + end + end + + def down + remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME) + end +end diff --git a/db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb b/db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb new file mode 100644 index 00000000000..4d98d4792af --- /dev/null +++ b/db/post_migrate/20230714015909_add_index_for_member_expiring_query.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexForMemberExpiringQuery < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_members_on_expiring_at_access_level_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :members, + [:expires_at, :access_level, :id], + where: 'requested_at IS NULL AND expiry_notified_at IS NULL', + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :members, INDEX_NAME + end +end diff --git a/db/post_migrate/20230714095946_schedule_unique_index_project_authorizations_on_unique_project_user.rb b/db/post_migrate/20230714095946_schedule_unique_index_project_authorizations_on_unique_project_user.rb new file mode 100644 index 00000000000..d4d51131dda --- /dev/null +++ b/db/post_migrate/20230714095946_schedule_unique_index_project_authorizations_on_unique_project_user.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ScheduleUniqueIndexProjectAuthorizationsOnUniqueProjectUser < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_unique_project_authorizations_on_unique_project_user' + + def up + prepare_async_index :project_authorizations, + %i[project_id user_id], + unique: true, + where: "is_unique", + name: INDEX_NAME + end + + def down + unprepare_async_index :project_authorizations, + %i[project_id user_id], + name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230717055730_backfill_ci_pipelines_auto_canceled_by_id_conversion.rb b/db/post_migrate/20230717055730_backfill_ci_pipelines_auto_canceled_by_id_conversion.rb new file mode 100644 index 00000000000..58b91c44b79 --- /dev/null +++ b/db/post_migrate/20230717055730_backfill_ci_pipelines_auto_canceled_by_id_conversion.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class BackfillCiPipelinesAutoCanceledByIdConversion < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + TABLE = :ci_pipelines + COLUMNS = %i[auto_canceled_by_id] + SUB_BATCH_SIZE = 250 + + def up + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS, sub_batch_size: SUB_BATCH_SIZE) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb b/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb new file mode 100644 index 00000000000..d93517fb49b --- /dev/null +++ b/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class BackfillCiStagesPipelineIdConversion < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + TABLE = :ci_stages + COLUMNS = %i[pipeline_id] + SUB_BATCH_SIZE = 250 + + def up + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS, sub_batch_size: SUB_BATCH_SIZE) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20230717091811_add_prepared_at_index_to_merge_requests_sync.rb b/db/post_migrate/20230717091811_add_prepared_at_index_to_merge_requests_sync.rb new file mode 100644 index 00000000000..4f05c5634b1 --- /dev/null +++ b/db/post_migrate/20230717091811_add_prepared_at_index_to_merge_requests_sync.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddPreparedAtIndexToMergeRequestsSync < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_merge_requests_on_id_and_prepared_at' + + def up + add_concurrent_index :merge_requests, :id, name: INDEX_NAME, where: "prepared_at IS NULL" + end + + def down + remove_concurrent_index_by_name :merge_requests, INDEX_NAME + end +end diff --git a/db/post_migrate/20230717144729_drop_ci_job_artifacts_partition_id_default_v2.rb b/db/post_migrate/20230717144729_drop_ci_job_artifacts_partition_id_default_v2.rb new file mode 100644 index 00000000000..a3b2cd324fb --- /dev/null +++ b/db/post_migrate/20230717144729_drop_ci_job_artifacts_partition_id_default_v2.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DropCiJobArtifactsPartitionIdDefaultV2 < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + TABLE_NAME = :ci_job_artifacts + COLUMN_NAME = :partition_id + + def up + remove_column_default(TABLE_NAME, COLUMN_NAME) + end + + def down + change_column_default(TABLE_NAME, COLUMN_NAME, from: nil, to: 100) + end +end diff --git a/db/post_migrate/20230717144744_drop_ci_stages_partition_id_default_v2.rb b/db/post_migrate/20230717144744_drop_ci_stages_partition_id_default_v2.rb new file mode 100644 index 00000000000..d32b8718281 --- /dev/null +++ b/db/post_migrate/20230717144744_drop_ci_stages_partition_id_default_v2.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DropCiStagesPartitionIdDefaultV2 < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + TABLE_NAME = :ci_stages + COLUMN_NAME = :partition_id + + def up + remove_column_default(TABLE_NAME, COLUMN_NAME) + end + + def down + change_column_default(TABLE_NAME, COLUMN_NAME, from: nil, to: 100) + end +end diff --git a/db/post_migrate/20230717144802_drop_ci_build_trace_metadata_partition_id_default_v2.rb b/db/post_migrate/20230717144802_drop_ci_build_trace_metadata_partition_id_default_v2.rb new file mode 100644 index 00000000000..e189801c79b --- /dev/null +++ b/db/post_migrate/20230717144802_drop_ci_build_trace_metadata_partition_id_default_v2.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DropCiBuildTraceMetadataPartitionIdDefaultV2 < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + TABLE_NAME = :ci_build_trace_metadata + COLUMN_NAME = :partition_id + + def up + remove_column_default(TABLE_NAME, COLUMN_NAME) + end + + def down + change_column_default(TABLE_NAME, COLUMN_NAME, from: nil, to: 100) + end +end diff --git a/db/post_migrate/20230717144817_drop_ci_pipeline_variable_partition_id_default_v2.rb b/db/post_migrate/20230717144817_drop_ci_pipeline_variable_partition_id_default_v2.rb new file mode 100644 index 00000000000..c75c0226b15 --- /dev/null +++ b/db/post_migrate/20230717144817_drop_ci_pipeline_variable_partition_id_default_v2.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DropCiPipelineVariablePartitionIdDefaultV2 < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + TABLE_NAME = :ci_pipeline_variables + COLUMN_NAME = :partition_id + + def up + remove_column_default(TABLE_NAME, COLUMN_NAME) + end + + def down + change_column_default(TABLE_NAME, COLUMN_NAME, from: nil, to: 100) + end +end diff --git a/db/post_migrate/20230718020825_swap_events_target_id_to_bigint_for_gitlab_dot_com.rb b/db/post_migrate/20230718020825_swap_events_target_id_to_bigint_for_gitlab_dot_com.rb new file mode 100644 index 00000000000..03e95e39649 --- /dev/null +++ b/db/post_migrate/20230718020825_swap_events_target_id_to_bigint_for_gitlab_dot_com.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +class SwapEventsTargetIdToBigintForGitlabDotCom < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'events' + + def up + return unless should_run? + + swap + end + + def down + return unless should_run? + + swap + end + + def swap + # This will replace the existing index_events_on_target_type_and_target_id_and_fingerprint + add_concurrent_index TABLE_NAME, [:target_type, :target_id_convert_to_bigint, :fingerprint], + name: :index_events_on_target_type_and_target_id_bigint_fingerprint, + unique: true + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN target_id TO target_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN target_id_convert_to_bigint TO target_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN target_id_tmp TO target_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:target_id, :target_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + execute 'DROP INDEX IF EXISTS index_events_on_target_type_and_target_id_and_fingerprint' + rename_index TABLE_NAME, 'index_events_on_target_type_and_target_id_bigint_fingerprint', + 'index_events_on_target_type_and_target_id_and_fingerprint' + end + end + + def should_run? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230718025027_cleanup_bigint_conversion_for_events_for_gitlab_com.rb b/db/post_migrate/20230718025027_cleanup_bigint_conversion_for_events_for_gitlab_com.rb new file mode 100644 index 00000000000..647052b987c --- /dev/null +++ b/db/post_migrate/20230718025027_cleanup_bigint_conversion_for_events_for_gitlab_com.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Turning this migration to a no-op due to incident https://gitlab.com/gitlab-com/gl-infra/production/-/issues/16102 +# Migration will be retried in 20230801150214_retry_cleanup_bigint_conversion_for_events_for_gitlab_com.rb +class CleanupBigintConversionForEventsForGitlabCom < Gitlab::Database::Migration[2.1] + def up + # no-op + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230718094501_prepare_notes_namespace_id_index.rb b/db/post_migrate/20230718094501_prepare_notes_namespace_id_index.rb new file mode 100644 index 00000000000..41f57814c41 --- /dev/null +++ b/db/post_migrate/20230718094501_prepare_notes_namespace_id_index.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class PrepareNotesNamespaceIdIndex < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_notes_on_namespace_id' + + # TODO: Index to be created synchronously as part of https://gitlab.com/gitlab-org/gitlab/-/issues/416127 + def up + prepare_async_index :notes, :namespace_id, name: INDEX_NAME + end + + def down + unprepare_async_index :notes, :namespace_id, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230718145613_add_temp_index_for_project_statistics_pipeline_artifacts_size_migration.rb b/db/post_migrate/20230718145613_add_temp_index_for_project_statistics_pipeline_artifacts_size_migration.rb new file mode 100644 index 00000000000..17e1e9e81f8 --- /dev/null +++ b/db/post_migrate/20230718145613_add_temp_index_for_project_statistics_pipeline_artifacts_size_migration.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTempIndexForProjectStatisticsPipelineArtifactsSizeMigration < Gitlab::Database::Migration[2.1] + INDEX_PROJECT_STATSISTICS_PIPELINE_ARTIFACTS_SIZE = 'tmp_index_project_statistics_pipeline_artifacts_size' + + disable_ddl_transaction! + + def up + # Temporary index is to be used to trigger a refresh of project_statistics with + # pipeline_artifacts_size != 0 + add_concurrent_index :project_statistics, [:project_id], + name: INDEX_PROJECT_STATSISTICS_PIPELINE_ARTIFACTS_SIZE, + where: "pipeline_artifacts_size != 0" + end + + def down + remove_concurrent_index_by_name :project_statistics, INDEX_PROJECT_STATSISTICS_PIPELINE_ARTIFACTS_SIZE + end +end diff --git a/db/post_migrate/20230719083202_backfill_project_statistics_storage_size_without_pipeline_artifacts_size.rb b/db/post_migrate/20230719083202_backfill_project_statistics_storage_size_without_pipeline_artifacts_size.rb new file mode 100644 index 00000000000..135d3596960 --- /dev/null +++ b/db/post_migrate/20230719083202_backfill_project_statistics_storage_size_without_pipeline_artifacts_size.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class BackfillProjectStatisticsStorageSizeWithoutPipelineArtifactsSize < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = "BackfillProjectStatisticsStorageSizeWithoutPipelineArtifactsSizeJob" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 500 + SUB_BATCH_SIZE = 100 + + def up + return unless Gitlab.dev_or_test_env? || Gitlab.org_or_com? + + queue_batched_background_migration( + MIGRATION, + :project_statistics, + :project_id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + return unless Gitlab.dev_or_test_env? || Gitlab.org_or_com? + + delete_batched_background_migration(MIGRATION, :project_statistics, :project_id, []) + end +end diff --git a/db/post_migrate/20230721134004_index_project_id_and_package_manager_for_sbom_occurrences.rb b/db/post_migrate/20230721134004_index_project_id_and_package_manager_for_sbom_occurrences.rb new file mode 100644 index 00000000000..8a97263d724 --- /dev/null +++ b/db/post_migrate/20230721134004_index_project_id_and_package_manager_for_sbom_occurrences.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IndexProjectIdAndPackageManagerForSbomOccurrences < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_sbom_occurrences_on_project_id_and_package_manager' + + disable_ddl_transaction! + + def up + add_concurrent_index :sbom_occurrences, [:project_id, :package_manager], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME + end +end diff --git a/db/post_migrate/20230721134546_index_project_id_component_id_and_id_for_sbom_occurrences.rb b/db/post_migrate/20230721134546_index_project_id_component_id_and_id_for_sbom_occurrences.rb new file mode 100644 index 00000000000..3eff5ee3b32 --- /dev/null +++ b/db/post_migrate/20230721134546_index_project_id_component_id_and_id_for_sbom_occurrences.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IndexProjectIdComponentIdAndIdForSbomOccurrences < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_sbom_occurrences_on_project_id_and_component_id_and_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :sbom_occurrences, [:project_id, :component_id, :id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME + end +end diff --git a/db/post_migrate/20230721181046_drop_index_issues_on_project_id_and_created_at_issue_type_incident.rb b/db/post_migrate/20230721181046_drop_index_issues_on_project_id_and_created_at_issue_type_incident.rb new file mode 100644 index 00000000000..3e62f6affad --- /dev/null +++ b/db/post_migrate/20230721181046_drop_index_issues_on_project_id_and_created_at_issue_type_incident.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropIndexIssuesOnProjectIdAndCreatedAtIssueTypeIncident < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_issues_on_project_id_and_created_at_issue_type_incident' + + def up + remove_concurrent_index_by_name :issues, name: INDEX_NAME + end + + def down + add_concurrent_index :issues, [:project_id, :created_at], where: 'issue_type = 1', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230721194757_drop_index_issues_on_incident_issue_type.rb b/db/post_migrate/20230721194757_drop_index_issues_on_incident_issue_type.rb new file mode 100644 index 00000000000..ad9b0da28e2 --- /dev/null +++ b/db/post_migrate/20230721194757_drop_index_issues_on_incident_issue_type.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropIndexIssuesOnIncidentIssueType < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_issues_on_incident_issue_type' + + def up + remove_concurrent_index_by_name :issues, name: INDEX_NAME + end + + def down + add_concurrent_index :issues, :issue_type, where: 'issue_type = 1', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230721200323_drop_index_on_issues_closed_incidents_by_project_id_and_closed_at.rb b/db/post_migrate/20230721200323_drop_index_on_issues_closed_incidents_by_project_id_and_closed_at.rb new file mode 100644 index 00000000000..243c9f458d9 --- /dev/null +++ b/db/post_migrate/20230721200323_drop_index_on_issues_closed_incidents_by_project_id_and_closed_at.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropIndexOnIssuesClosedIncidentsByProjectIdAndClosedAt < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_on_issues_closed_incidents_by_project_id_and_closed_at' + + def up + remove_concurrent_index_by_name :issues, name: INDEX_NAME + end + + def down + add_concurrent_index :issues, [:project_id, :closed_at], where: 'issue_type = 1 AND state_id = 2', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230721200810_drop_index_on_issues_health_status_asc_order.rb b/db/post_migrate/20230721200810_drop_index_on_issues_health_status_asc_order.rb new file mode 100644 index 00000000000..a3cc4ff7107 --- /dev/null +++ b/db/post_migrate/20230721200810_drop_index_on_issues_health_status_asc_order.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropIndexOnIssuesHealthStatusAscOrder < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_on_issues_health_status_asc_order' + + def up + remove_concurrent_index_by_name :issues, name: INDEX_NAME + end + + def down + add_concurrent_index :issues, + [:project_id, :health_status, :id, :state_id, :issue_type], + order: { health_status: 'ASC NULLS LAST', id: :desc }, + name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230721200849_drop_index_on_issues_health_status_desc_order.rb b/db/post_migrate/20230721200849_drop_index_on_issues_health_status_desc_order.rb new file mode 100644 index 00000000000..a120268b800 --- /dev/null +++ b/db/post_migrate/20230721200849_drop_index_on_issues_health_status_desc_order.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropIndexOnIssuesHealthStatusDescOrder < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_on_issues_health_status_desc_order' + + def up + remove_concurrent_index_by_name :issues, name: INDEX_NAME + end + + def down + add_concurrent_index :issues, + [:project_id, :health_status, :id, :state_id, :issue_type], + order: { health_status: 'DESC NULLS LAST', id: :desc }, + name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230723171006_backfill_ci_sources_pipelines_source_conversion.rb b/db/post_migrate/20230723171006_backfill_ci_sources_pipelines_source_conversion.rb new file mode 100644 index 00000000000..7b5cfa9f49a --- /dev/null +++ b/db/post_migrate/20230723171006_backfill_ci_sources_pipelines_source_conversion.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class BackfillCiSourcesPipelinesSourceConversion < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + TABLE = :ci_sources_pipelines + COLUMNS = %i[pipeline_id source_pipeline_id] + SUB_BATCH_SIZE = 250 + + def up + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS, sub_batch_size: SUB_BATCH_SIZE) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20230724071541_queue_backfill_default_branch_protection_namespace_setting.rb b/db/post_migrate/20230724071541_queue_backfill_default_branch_protection_namespace_setting.rb new file mode 100644 index 00000000000..57debd9d0a2 --- /dev/null +++ b/db/post_migrate/20230724071541_queue_backfill_default_branch_protection_namespace_setting.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class QueueBackfillDefaultBranchProtectionNamespaceSetting < Gitlab::Database::Migration[2.1] + MIGRATION = "BackfillDefaultBranchProtectionNamespaceSetting" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10_000 + SUB_BATCH_SIZE = 100 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :namespace_settings, + :namespace_id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :namespace_settings, :namespace_id, []) + end +end diff --git a/db/post_migrate/20230724085146_replace_old_fk_p_ci_builds_metadata_to_builds_v3.rb b/db/post_migrate/20230724085146_replace_old_fk_p_ci_builds_metadata_to_builds_v3.rb new file mode 100644 index 00000000000..acfed3032eb --- /dev/null +++ b/db/post_migrate/20230724085146_replace_old_fk_p_ci_builds_metadata_to_builds_v3.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +class ReplaceOldFkPCiBuildsMetadataToBuildsV3 < Gitlab::Database::Migration[2.1] + include Gitlab::Database::PartitioningMigrationHelpers + + disable_ddl_transaction! + + def up + return if new_foreign_key_exists? + + with_lock_retries do + remove_foreign_key_if_exists :p_ci_builds_metadata, :ci_builds, + name: :fk_e20479742e_p, reverse_lock_order: true + + rename_constraint :p_ci_builds_metadata, :temp_fk_e20479742e_p, :fk_e20479742e_p + + Gitlab::Database::PostgresPartitionedTable.each_partition(:p_ci_builds_metadata) do |partition| + rename_constraint partition.identifier, :temp_fk_e20479742e_p, :fk_e20479742e_p + end + end + end + + def down + return unless new_foreign_key_exists? + + add_concurrent_partitioned_foreign_key :p_ci_builds_metadata, :ci_builds, + name: :temp_fk_e20479742e_p, + column: [:partition_id, :build_id], + target_column: [:partition_id, :id], + on_update: :cascade, + on_delete: :cascade, + validate: true, + reverse_lock_order: true + + switch_constraint_names :p_ci_builds_metadata, :fk_e20479742e_p, :temp_fk_e20479742e_p + + Gitlab::Database::PostgresPartitionedTable.each_partition(:p_ci_builds_metadata) do |partition| + switch_constraint_names partition.identifier, :fk_e20479742e_p, :temp_fk_e20479742e_p + end + end + + private + + def new_foreign_key_exists? + foreign_key_exists?(:p_ci_builds_metadata, :p_ci_builds, name: :fk_e20479742e_p) + end +end diff --git a/db/post_migrate/20230724085149_replace_old_fk_p_ci_runner_machine_builds_to_builds_v3.rb b/db/post_migrate/20230724085149_replace_old_fk_p_ci_runner_machine_builds_to_builds_v3.rb new file mode 100644 index 00000000000..d3919148240 --- /dev/null +++ b/db/post_migrate/20230724085149_replace_old_fk_p_ci_runner_machine_builds_to_builds_v3.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +class ReplaceOldFkPCiRunnerMachineBuildsToBuildsV3 < Gitlab::Database::Migration[2.1] + include Gitlab::Database::PartitioningMigrationHelpers + + disable_ddl_transaction! + + def up + return if new_foreign_key_exists? + + with_lock_retries do + remove_foreign_key_if_exists :p_ci_runner_machine_builds, :ci_builds, + name: :fk_bb490f12fe_p, reverse_lock_order: true + + rename_constraint :p_ci_runner_machine_builds, :temp_fk_bb490f12fe_p, :fk_bb490f12fe_p + + Gitlab::Database::PostgresPartitionedTable.each_partition(:p_ci_runner_machine_builds) do |partition| + rename_constraint partition.identifier, :temp_fk_bb490f12fe_p, :fk_bb490f12fe_p + end + end + end + + def down + return unless new_foreign_key_exists? + + add_concurrent_partitioned_foreign_key :p_ci_runner_machine_builds, :ci_builds, + name: :temp_fk_bb490f12fe_p, + column: [:partition_id, :build_id], + target_column: [:partition_id, :id], + on_update: :cascade, + on_delete: :cascade, + validate: true, + reverse_lock_order: true + + switch_constraint_names :p_ci_runner_machine_builds, :fk_bb490f12fe_p, :temp_fk_bb490f12fe_p + + Gitlab::Database::PostgresPartitionedTable.each_partition(:p_ci_runner_machine_builds) do |partition| + switch_constraint_names partition.identifier, :fk_bb490f12fe_p, :temp_fk_bb490f12fe_p + end + end + + private + + def new_foreign_key_exists? + foreign_key_exists?(:p_ci_runner_machine_builds, :p_ci_builds, name: :fk_bb490f12fe_p) + end +end diff --git a/db/post_migrate/20230724123547_cleanup_conversion_big_int_ci_build_needs_self_managed.rb b/db/post_migrate/20230724123547_cleanup_conversion_big_int_ci_build_needs_self_managed.rb new file mode 100644 index 00000000000..5fbb5bd47cd --- /dev/null +++ b/db/post_migrate/20230724123547_cleanup_conversion_big_int_ci_build_needs_self_managed.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class CleanupConversionBigIntCiBuildNeedsSelfManaged < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + enable_lock_retries! + + TABLE = :ci_build_needs + + def up + return if should_skip? + return unless column_exists?(TABLE, :id_convert_to_bigint) + + # rubocop:disable Migration/WithLockRetriesDisallowedMethod + with_lock_retries do + cleanup_conversion_of_integer_to_bigint(TABLE, :id) + end + # rubocop:enable Migration/WithLockRetriesDisallowedMethod + end + + def down + return if should_skip? + return if column_exists?(TABLE, :id_convert_to_bigint) + + restore_conversion_of_integer_to_bigint(TABLE, :id) + end + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb b/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb new file mode 100644 index 00000000000..b066cb248fb --- /dev/null +++ b/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class IndexProjectsOnNamespaceIdAndRepositorySizeLimit < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_projects_on_namespace_id_and_repository_size_limit" + + disable_ddl_transaction! + + def up + add_concurrent_index :projects, [:namespace_id, :repository_size_limit], name: INDEX_NAME + end + + def down + remove_concurrent_index :projects, [:namespace_id, :repository_size_limit], name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230724164745_queue_delete_orphaned_transferred_project_approval_rules.rb b/db/post_migrate/20230724164745_queue_delete_orphaned_transferred_project_approval_rules.rb new file mode 100644 index 00000000000..7cc1255f54a --- /dev/null +++ b/db/post_migrate/20230724164745_queue_delete_orphaned_transferred_project_approval_rules.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class QueueDeleteOrphanedTransferredProjectApprovalRules < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = "DeleteOrphanedTransferredProjectApprovalRules" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 500 + SUB_BATCH_SIZE = 50 + + def up + queue_batched_background_migration( + MIGRATION, + :approval_project_rules, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :approval_project_rules, :id, []) + end +end diff --git a/db/post_migrate/20230724212040_add_temporary_indexes_for_orphaned_approval_rules.rb b/db/post_migrate/20230724212040_add_temporary_indexes_for_orphaned_approval_rules.rb new file mode 100644 index 00000000000..69e5f7d48ac --- /dev/null +++ b/db/post_migrate/20230724212040_add_temporary_indexes_for_orphaned_approval_rules.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddTemporaryIndexesForOrphanedApprovalRules < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + LICENSE_SCANNING = 2 + SCAN_FINDING = 4 + + TMP_PROJECT_INDEX_NAME = 'tmp_idx_orphaned_approval_project_rules' + TMP_MR_INDEX_NAME = 'tmp_idx_orphaned_approval_merge_request_rules' + + def up + add_concurrent_index('approval_project_rules', :id, where: query_condition, name: TMP_PROJECT_INDEX_NAME) + add_concurrent_index('approval_merge_request_rules', :id, where: query_condition, name: TMP_MR_INDEX_NAME) + end + + def down + remove_concurrent_index_by_name('approval_project_rules', TMP_PROJECT_INDEX_NAME) + remove_concurrent_index_by_name('approval_merge_request_rules', TMP_MR_INDEX_NAME) + end + + private + + def query_condition + "report_type IN (#{LICENSE_SCANNING}, #{SCAN_FINDING}) AND security_orchestration_policy_configuration_id IS NULL" + end +end diff --git a/db/post_migrate/20230725035942_create_sync_index_for_ci_pipline_variables_pipeline_id.rb b/db/post_migrate/20230725035942_create_sync_index_for_ci_pipline_variables_pipeline_id.rb new file mode 100644 index 00000000000..9b2207fd10f --- /dev/null +++ b/db/post_migrate/20230725035942_create_sync_index_for_ci_pipline_variables_pipeline_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateSyncIndexForCiPiplineVariablesPipelineId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = :ci_pipeline_variables + INDEX_NAME = 'index_ci_pipeline_variables_on_pipeline_id_bigint_and_key' + COLUMNS = [:pipeline_id_convert_to_bigint, :key] + + def up + add_concurrent_index TABLE_NAME, COLUMNS, unique: true, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/post_migrate/20230726024322_add_not_valid_foreign_key_for_ci_pipeline_variables_pipeline_id.rb b/db/post_migrate/20230726024322_add_not_valid_foreign_key_for_ci_pipeline_variables_pipeline_id.rb new file mode 100644 index 00000000000..f9785aca1ae --- /dev/null +++ b/db/post_migrate/20230726024322_add_not_valid_foreign_key_for_ci_pipeline_variables_pipeline_id.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddNotValidForeignKeyForCiPipelineVariablesPipelineId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + SOURCE_TABLE = :ci_pipeline_variables + TARGET_TABLE = :ci_pipelines + COLUMN_NAME = :pipeline_id_convert_to_bigint + FK_NAME = 'temp_fk_rails_8d3b04e3e1' + + def up + add_concurrent_foreign_key( + SOURCE_TABLE, TARGET_TABLE, + name: FK_NAME, + column: COLUMN_NAME, + on_delete: :cascade, + validate: false, + reverse_lock_order: true + ) + + prepare_async_foreign_key_validation SOURCE_TABLE, name: FK_NAME + end + + def down + unprepare_async_foreign_key_validation SOURCE_TABLE, name: FK_NAME + + remove_foreign_key_if_exists SOURCE_TABLE, name: FK_NAME + end +end diff --git a/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb b/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb new file mode 100644 index 00000000000..43b4db7d9b5 --- /dev/null +++ b/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddIssueSearchDataNamespaceIdForeignKey < Gitlab::Database::Migration[2.1] + include Gitlab::Database::PartitioningMigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_issue_search_data_on_namespace_id' + + def up + add_concurrent_partitioned_index :issue_search_data, :namespace_id, name: INDEX_NAME + add_concurrent_partitioned_foreign_key :issue_search_data, :namespaces, + column: :namespace_id, + on_delete: :cascade + end + + def down + remove_foreign_key_if_exists :issue_search_data, column: :namespace_id + remove_concurrent_partitioned_index_by_name :issue_search_data, INDEX_NAME + end +end diff --git a/db/post_migrate/20230726201351_remove_issues_issue_type_column.rb b/db/post_migrate/20230726201351_remove_issues_issue_type_column.rb new file mode 100644 index 00000000000..4f066adbc97 --- /dev/null +++ b/db/post_migrate/20230726201351_remove_issues_issue_type_column.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveIssuesIssueTypeColumn < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + remove_column :issues, :issue_type + end + + def down + add_column :issues, :issue_type, :smallint, default: 0, null: false + end +end diff --git a/db/post_migrate/20230726231029_remove_plan_limits_ci_active_pipelines_column.rb b/db/post_migrate/20230726231029_remove_plan_limits_ci_active_pipelines_column.rb new file mode 100644 index 00000000000..ef0a67574ba --- /dev/null +++ b/db/post_migrate/20230726231029_remove_plan_limits_ci_active_pipelines_column.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemovePlanLimitsCiActivePipelinesColumn < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + remove_column :plan_limits, :ci_active_pipelines + end + + def down + add_column :plan_limits, :ci_active_pipelines, :integer, default: 0, null: false + end +end diff --git a/db/post_migrate/20230727102936_drop_prepared_at_index.rb b/db/post_migrate/20230727102936_drop_prepared_at_index.rb new file mode 100644 index 00000000000..ee128a9d130 --- /dev/null +++ b/db/post_migrate/20230727102936_drop_prepared_at_index.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class DropPreparedAtIndex < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_merge_requests_on_id_and_prepared_at' + + # TODO: Issue for sync deletion: https://gitlab.com/gitlab-org/gitlab/-/issues/419917 + + def up + prepare_async_index_removal :merge_requests, :id, name: INDEX_NAME + end + + def down + unprepare_async_index :merge_requests, :id, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230727103144_add_prepared_at_created_at_index.rb b/db/post_migrate/20230727103144_add_prepared_at_created_at_index.rb new file mode 100644 index 00000000000..44c293bca2a --- /dev/null +++ b/db/post_migrate/20230727103144_add_prepared_at_created_at_index.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddPreparedAtCreatedAtIndex < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_merge_requests_id_created_at_prepared_at' + + # TODO: Issue for sync deletion: https://gitlab.com/gitlab-org/gitlab/-/issues/419918 + + def up + prepare_async_index(:merge_requests, + [:created_at, :id], + name: INDEX_NAME, + where: "prepared_at IS NULL") + end + + def down + unprepare_async_index(:merge_requests, [:created_at, :id], name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20230727115635_index_vulnerability_reads_on_project_id_and_vulnerability_id.rb b/db/post_migrate/20230727115635_index_vulnerability_reads_on_project_id_and_vulnerability_id.rb new file mode 100644 index 00000000000..379dfe6e42d --- /dev/null +++ b/db/post_migrate/20230727115635_index_vulnerability_reads_on_project_id_and_vulnerability_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IndexVulnerabilityReadsOnProjectIdAndVulnerabilityId < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_vulnerability_reads_on_project_id_and_vulnerability_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :vulnerability_reads, [:project_id, :vulnerability_id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME + end +end diff --git a/db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb b/db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb new file mode 100644 index 00000000000..40670a60df0 --- /dev/null +++ b/db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class PrepareIndexOnVulnerabilityOccurrencesUuidAsync < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_vulnerability_occurrences_on_uuid_1" + + def up + prepare_async_index( + :vulnerability_occurrences, + :uuid_convert_string_to_uuid, + unique: true, + name: INDEX_NAME + ) + end + + def down + unprepare_async_index( + :vulnerability_occurrences, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb b/db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb new file mode 100644 index 00000000000..abd296a308f --- /dev/null +++ b/db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class PrepareIndexOnVulnerabilityOccurrencesUuidIncludingVulnerabilityIdAsync < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_vuln_findings_on_uuid_including_vuln_id_1" + + def up + index_sql = <<~SQL + CREATE UNIQUE INDEX CONCURRENTLY #{INDEX_NAME} + ON vulnerability_occurrences(uuid_convert_string_to_uuid) + INCLUDE(vulnerability_id) + SQL + + prepare_async_index_from_sql(index_sql) + end + + def down + unprepare_async_index_by_name( + :vulnerability_occurrences, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20230728134722_remove_application_settings_ignored_columns.rb b/db/post_migrate/20230728134722_remove_application_settings_ignored_columns.rb new file mode 100644 index 00000000000..71bd6ae83eb --- /dev/null +++ b/db/post_migrate/20230728134722_remove_application_settings_ignored_columns.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +class RemoveApplicationSettingsIgnoredColumns < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + remove_column :application_settings, :encrypted_tofa_access_token_expires_in, if_exists: true + remove_column :application_settings, :encrypted_tofa_access_token_expires_in_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_args, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_args_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_class, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_class_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_create_credentials_method, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_create_credentials_method_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_fetch_access_token_method, if_exists: true + remove_column :application_settings, :encrypted_tofa_client_library_fetch_access_token_method_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_host, if_exists: true + remove_column :application_settings, :encrypted_tofa_host_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_request_json_keys, if_exists: true + remove_column :application_settings, :encrypted_tofa_request_json_keys_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_request_payload, if_exists: true + remove_column :application_settings, :encrypted_tofa_request_payload_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_response_json_keys, if_exists: true + remove_column :application_settings, :encrypted_tofa_response_json_keys_iv, if_exists: true + remove_column :application_settings, :encrypted_tofa_url, if_exists: true + remove_column :application_settings, :encrypted_tofa_url_iv, if_exists: true + end + + def down + add_column :application_settings, :encrypted_tofa_host, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_host_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_url, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_url_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_response_json_keys, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_response_json_keys_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_request_json_keys, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_request_json_keys_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_request_payload, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_request_payload_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_class, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_class_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_args, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_args_iv, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_create_credentials_method, :binary, + if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_create_credentials_method_iv, :binary, + if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_fetch_access_token_method, :binary, + if_not_exists: true + add_column :application_settings, :encrypted_tofa_client_library_fetch_access_token_method_iv, :binary, + if_not_exists: true + add_column :application_settings, :encrypted_tofa_access_token_expires_in, :binary, if_not_exists: true + add_column :application_settings, :encrypted_tofa_access_token_expires_in_iv, :binary, if_not_exists: true + end +end diff --git a/db/post_migrate/20230728151058_add_auditor_index_to_users_table.rb b/db/post_migrate/20230728151058_add_auditor_index_to_users_table.rb new file mode 100644 index 00000000000..1a849e7b728 --- /dev/null +++ b/db/post_migrate/20230728151058_add_auditor_index_to_users_table.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddAuditorIndexToUsersTable < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_users_for_auditors' + disable_ddl_transaction! + + def up + add_concurrent_index :users, :id, where: 'auditor IS true', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :users, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230728174927_add_epic_work_item_type.rb b/db/post_migrate/20230728174927_add_epic_work_item_type.rb new file mode 100644 index 00000000000..49f70e5379a --- /dev/null +++ b/db/post_migrate/20230728174927_add_epic_work_item_type.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +class AddEpicWorkItemType < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + ISSUE_ENUM_VALUE = 0 + EPIC_ENUM_VALUE = 7 + EPIC_NAME = 'Epic' + EPIC_WIDGETS = { + 'Assignees' => 0, + 'Description' => 1, + 'Hierarchy' => 2, + 'Labels' => 3, + 'Notes' => 5, + 'Start and due date' => 6, + 'Health status' => 7, + 'Status' => 11, + 'Notifications' => 14, + 'Award emoji' => 16 + }.freeze + + class MigrationWorkItemType < MigrationRecord + self.table_name = 'work_item_types' + end + + class MigrationWidgetDefinition < MigrationRecord + self.table_name = 'work_item_widget_definitions' + end + + class MigrationHierarchyRestriction < MigrationRecord + self.table_name = 'work_item_hierarchy_restrictions' + end + + def up + # New instances will not run this migration and add this type via fixtures + # checking if record exists mostly because migration specs will run all migrations + # and that will conflict with the preloaded base work item types + existing_epic_work_item_type = MigrationWorkItemType.find_by(base_type: EPIC_ENUM_VALUE, namespace_id: nil) + + return say('Epic work item type record exists, skipping creation') if existing_epic_work_item_type + + new_epic_work_item_type = MigrationWorkItemType.create( + name: EPIC_NAME, + namespace_id: nil, + base_type: EPIC_ENUM_VALUE, + icon_name: 'issue-type-epic' + ) + + widgets = EPIC_WIDGETS.map do |widget_name, widget_enum_value| + { + work_item_type_id: new_epic_work_item_type.id, + name: widget_name, + widget_type: widget_enum_value + } + end + + MigrationWidgetDefinition.upsert_all( + widgets, + unique_by: :index_work_item_widget_definitions_on_default_witype_and_name + ) + + issue_type = MigrationWorkItemType.find_by(base_type: ISSUE_ENUM_VALUE, namespace_id: nil) + return say('Issue work item type not found, skipping hierarchy restrictions creation') unless issue_type + + restrictions = [ + { parent_type_id: new_epic_work_item_type.id, child_type_id: new_epic_work_item_type.id, maximum_depth: 9 }, + { parent_type_id: new_epic_work_item_type.id, child_type_id: issue_type.id, maximum_depth: 1 } + ] + + MigrationHierarchyRestriction.upsert_all( + restrictions, + unique_by: :index_work_item_hierarchy_restrictions_on_parent_and_child + ) + end + + def down + # There's the remote possibility that issues could already be + # using this issue type, with a tight foreign constraint. + # Therefore we will not attempt to remove any data. + end +end diff --git a/db/post_migrate/20230731090319_add_notes_namespace_id_foreign_key.rb b/db/post_migrate/20230731090319_add_notes_namespace_id_foreign_key.rb new file mode 100644 index 00000000000..5e06170a506 --- /dev/null +++ b/db/post_migrate/20230731090319_add_notes_namespace_id_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddNotesNamespaceIdForeignKey < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_notes_on_namespace_id' + + def up + add_concurrent_index :notes, :namespace_id, name: INDEX_NAME + add_concurrent_foreign_key :notes, :namespaces, + column: :namespace_id, + on_delete: :cascade + end + + def down + remove_foreign_key_if_exists :notes, column: :namespace_id + remove_concurrent_index_by_name :notes, INDEX_NAME + end +end diff --git a/db/post_migrate/20230731100513_add_index_on_vulnerability_reads_for_filtering.rb b/db/post_migrate/20230731100513_add_index_on_vulnerability_reads_for_filtering.rb new file mode 100644 index 00000000000..bbed1e60d35 --- /dev/null +++ b/db/post_migrate/20230731100513_add_index_on_vulnerability_reads_for_filtering.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddIndexOnVulnerabilityReadsForFiltering < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = "idx_vuln_reads_for_filtering" + + def up + add_concurrent_index( + :vulnerability_reads, + %i[project_id state dismissal_reason severity vulnerability_id], + order: { severity: :desc, vulnerability_id: "DESC NULLS LAST" }, + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :vulnerability_reads, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20230731210422_remove_temp_index_vulnerability_occurrences.rb b/db/post_migrate/20230731210422_remove_temp_index_vulnerability_occurrences.rb new file mode 100644 index 00000000000..a4be163cc64 --- /dev/null +++ b/db/post_migrate/20230731210422_remove_temp_index_vulnerability_occurrences.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveTempIndexVulnerabilityOccurrences < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'tmp_idx_vulnerability_occurrences_on_id_where_report_type_7_99' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME + end + + def down + add_concurrent_index :vulnerability_occurrences, :id, where: 'report_type IN (7, 99)', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20230801150214_retry_cleanup_bigint_conversion_for_events_for_gitlab_com.rb b/db/post_migrate/20230801150214_retry_cleanup_bigint_conversion_for_events_for_gitlab_com.rb new file mode 100644 index 00000000000..231c28e538c --- /dev/null +++ b/db/post_migrate/20230801150214_retry_cleanup_bigint_conversion_for_events_for_gitlab_com.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class RetryCleanupBigintConversionForEventsForGitlabCom < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + enable_lock_retries! + + TABLE = :events + COLUMNS = [:target_id] + + # We first attempted to drop the temporary trigger and column at + # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126794 + def up + return unless should_run? + + return unless column_exists?(TABLE, :target_id_convert_to_bigint) + + cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + return unless should_run? + + return if column_exists?(TABLE, :target_id_convert_to_bigint) + + restore_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + private + + def should_run? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230802085923_queue_fix_allow_descendants_override_disabled_shared_runners.rb b/db/post_migrate/20230802085923_queue_fix_allow_descendants_override_disabled_shared_runners.rb new file mode 100644 index 00000000000..fcac9e0209b --- /dev/null +++ b/db/post_migrate/20230802085923_queue_fix_allow_descendants_override_disabled_shared_runners.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class QueueFixAllowDescendantsOverrideDisabledSharedRunners < Gitlab::Database::Migration[2.1] + MIGRATION = "FixAllowDescendantsOverrideDisabledSharedRunners" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 25000 + SUB_BATCH_SIZE = 250 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :namespaces, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :namespaces, :id, []) + end +end diff --git a/db/post_migrate/20230802090519_drop_schema_inconsistencies_table.rb b/db/post_migrate/20230802090519_drop_schema_inconsistencies_table.rb new file mode 100644 index 00000000000..ae95a8b2e6b --- /dev/null +++ b/db/post_migrate/20230802090519_drop_schema_inconsistencies_table.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropSchemaInconsistenciesTable < Gitlab::Database::Migration[2.1] + def up + drop_table :schema_inconsistencies + end + + def down + create_table :schema_inconsistencies do |t| + t.references :issue, index: true, null: false, foreign_key: { on_delete: :cascade } + t.timestamps_with_timezone null: false + t.text :object_name, null: false, limit: 63 + t.text :table_name, null: false, limit: 63 + t.text :valitador_name, null: false, limit: 63 + t.text :diff, null: false, limit: 6144 + end + end +end diff --git a/db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb b/db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb new file mode 100644 index 00000000000..9a983cc1278 --- /dev/null +++ b/db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUniqueIndexProjectAuthorizationsOnUniqueProjectUser < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_unique_project_authorizations_on_unique_project_user' + + disable_ddl_transaction! + + def up + add_concurrent_index :project_authorizations, + %i[project_id user_id], + unique: true, + where: "is_unique", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :project_authorizations, INDEX_NAME + end +end diff --git a/db/post_migrate/20230804053643_add_ticket_work_item_type.rb b/db/post_migrate/20230804053643_add_ticket_work_item_type.rb new file mode 100644 index 00000000000..4d40622dfb4 --- /dev/null +++ b/db/post_migrate/20230804053643_add_ticket_work_item_type.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +class AddTicketWorkItemType < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + ISSUE_ENUM_VALUE = 0 + TICKET_ENUM_VALUE = 8 + TICKET_NAME = 'Ticket' + TICKET_WIDGETS = { + 'Assignees' => 0, + 'Description' => 1, + 'Hierarchy' => 2, + 'Labels' => 3, + 'Milestone' => 4, + 'Notes' => 5, + 'Start and due date' => 6, + 'Health status' => 7, + 'Weight' => 8, + 'Iteration' => 9, + 'Notifications' => 14, + 'Current user todos' => 15, + 'Award emoji' => 16 + }.freeze + + class MigrationWorkItemType < MigrationRecord + self.table_name = 'work_item_types' + end + + class MigrationWidgetDefinition < MigrationRecord + self.table_name = 'work_item_widget_definitions' + end + + class MigrationHierarchyRestriction < MigrationRecord + self.table_name = 'work_item_hierarchy_restrictions' + end + + def up + # New instances will not run this migration and add this type via fixtures + # checking if record exists mostly because migration specs will run all migrations + # and that will conflict with the preloaded base work item types + existing_ticket_work_item_type = MigrationWorkItemType.find_by(base_type: TICKET_ENUM_VALUE, namespace_id: nil) + + return say('Ticket work item type record exists, skipping creation') if existing_ticket_work_item_type + + new_ticket_work_item_type = MigrationWorkItemType.create( + name: TICKET_NAME, + namespace_id: nil, + base_type: TICKET_ENUM_VALUE, + icon_name: 'issue-type-issue' + ) + + return say('Ticket work item type create record failed, skipping creation') if new_ticket_work_item_type.new_record? + + widgets = TICKET_WIDGETS.map do |widget_name, widget_enum_value| + { + work_item_type_id: new_ticket_work_item_type.id, + name: widget_name, + widget_type: widget_enum_value + } + end + + MigrationWidgetDefinition.upsert_all( + widgets, + unique_by: :index_work_item_widget_definitions_on_default_witype_and_name + ) + + issue_type = MigrationWorkItemType.find_by(base_type: ISSUE_ENUM_VALUE, namespace_id: nil) + return say('Issue work item type not found, skipping hierarchy restrictions creation') unless issue_type + + restrictions = [ + { parent_type_id: new_ticket_work_item_type.id, child_type_id: new_ticket_work_item_type.id, maximum_depth: 1 }, + { parent_type_id: new_ticket_work_item_type.id, child_type_id: issue_type.id, maximum_depth: 1 } + ] + + MigrationHierarchyRestriction.upsert_all( + restrictions, + unique_by: :index_work_item_hierarchy_restrictions_on_parent_and_child + ) + end + + def down + # There's the remote possibility that issues could already be + # using this issue type, with a tight foreign constraint. + # Therefore we will not attempt to remove any data. + end +end diff --git a/db/post_migrate/20230804121704_remove_namespaces_user_details_enterprise_group_id_fk.rb b/db/post_migrate/20230804121704_remove_namespaces_user_details_enterprise_group_id_fk.rb new file mode 100644 index 00000000000..23c23587c43 --- /dev/null +++ b/db/post_migrate/20230804121704_remove_namespaces_user_details_enterprise_group_id_fk.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoveNamespacesUserDetailsEnterpriseGroupIdFk < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + return unless foreign_key_exists?(:user_details, :namespaces, name: "fk_c53c794142") + + with_lock_retries do + remove_foreign_key_if_exists(:user_details, :namespaces, + name: "fk_c53c794142", reverse_lock_order: true) + end + end + + def down + add_concurrent_foreign_key(:user_details, :namespaces, + name: "fk_c53c794142", column: :enterprise_group_id, + target_column: :id, on_delete: :nullify) + end +end diff --git a/db/post_migrate/20230804121705_remove_namespaces_user_details_provisioned_by_group_id_fk.rb b/db/post_migrate/20230804121705_remove_namespaces_user_details_provisioned_by_group_id_fk.rb new file mode 100644 index 00000000000..0d43354b92c --- /dev/null +++ b/db/post_migrate/20230804121705_remove_namespaces_user_details_provisioned_by_group_id_fk.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoveNamespacesUserDetailsProvisionedByGroupIdFk < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + return unless foreign_key_exists?(:user_details, :namespaces, name: "fk_190e4fcc88") + + with_lock_retries do + remove_foreign_key_if_exists(:user_details, :namespaces, + name: "fk_190e4fcc88", reverse_lock_order: true) + end + end + + def down + add_concurrent_foreign_key(:user_details, :namespaces, + name: "fk_190e4fcc88", column: :provisioned_by_group_id, + target_column: :id, on_delete: :nullify) + end +end diff --git a/db/post_migrate/20230807083334_add_linked_items_work_item_widget.rb b/db/post_migrate/20230807083334_add_linked_items_work_item_widget.rb new file mode 100644 index 00000000000..041969a6e36 --- /dev/null +++ b/db/post_migrate/20230807083334_add_linked_items_work_item_widget.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +class AddLinkedItemsWorkItemWidget < Gitlab::Database::Migration[2.1] + class WorkItemType < MigrationRecord + self.table_name = 'work_item_types' + end + + class WidgetDefinition < MigrationRecord + self.table_name = 'work_item_widget_definitions' + end + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + WIDGET_NAME = 'Linked items' + WIDGET_ENUM_VALUE = 17 + WORK_ITEM_TYPES = [ + 'Issue', + 'Incident', + 'Test Case', + 'Requirement', + 'Task', + 'Objective', + 'Key Result', + 'Epic' + ].freeze + + def up + widgets = [] + + WORK_ITEM_TYPES.each do |type_name| + type = WorkItemType.find_by_name_and_namespace_id(type_name, nil) + + unless type + Gitlab::AppLogger.warn("type #{type_name} is missing, not adding widget") + + next + end + + widgets << { + work_item_type_id: type.id, + name: WIDGET_NAME, + widget_type: WIDGET_ENUM_VALUE + } + end + + return if widgets.empty? + + WidgetDefinition.upsert_all( + widgets, + unique_by: :index_work_item_widget_definitions_on_default_witype_and_name + ) + end + + def down + WidgetDefinition.where(name: WIDGET_NAME).delete_all + end +end diff --git a/db/post_migrate/20230807085752_ensure_id_uniqueness_for_p_ci_builds.rb b/db/post_migrate/20230807085752_ensure_id_uniqueness_for_p_ci_builds.rb new file mode 100644 index 00000000000..cdd68e7f5dc --- /dev/null +++ b/db/post_migrate/20230807085752_ensure_id_uniqueness_for_p_ci_builds.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +class EnsureIdUniquenessForPCiBuilds < Gitlab::Database::Migration[2.1] + include Gitlab::Database::SchemaHelpers + include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum + + enable_lock_retries! + + TABLE_NAME = :p_ci_builds + FUNCTION_NAME = :assign_p_ci_builds_id_value + TRIGGER_NAME = :assign_p_ci_builds_id_trigger + + def up + return unless should_run? + + change_column_default(TABLE_NAME, :id, nil) + + create_trigger_function(FUNCTION_NAME) do + <<~SQL + IF NEW."id" IS NOT NULL THEN + RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored'; + END IF; + NEW."id" := nextval('ci_builds_id_seq'::regclass); + RETURN NEW; + SQL + end + + Gitlab::Database::PostgresPartitionedTable.each_partition(TABLE_NAME) do |partition| + create_trigger(partition.identifier, TRIGGER_NAME, FUNCTION_NAME, fires: 'BEFORE INSERT') + end + end + + def down + return unless should_run? + + execute(<<~SQL.squish) + ALTER TABLE #{TABLE_NAME} + ALTER COLUMN id SET DEFAULT nextval('ci_builds_id_seq'::regclass); + + DROP FUNCTION IF EXISTS #{FUNCTION_NAME} CASCADE; + SQL + end + + private + + def should_run? + can_execute_on?(:ci_builds) + end +end diff --git a/db/post_migrate/20230808123136_cleanup_application_settings_database_apdex_settings_rename.rb b/db/post_migrate/20230808123136_cleanup_application_settings_database_apdex_settings_rename.rb new file mode 100644 index 00000000000..de1887677bf --- /dev/null +++ b/db/post_migrate/20230808123136_cleanup_application_settings_database_apdex_settings_rename.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CleanupApplicationSettingsDatabaseApdexSettingsRename < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename( + :application_settings, + :database_apdex_settings, + :prometheus_alert_db_indicators_settings + ) + end + + def down + undo_cleanup_concurrent_column_rename( + :application_settings, + :database_apdex_settings, + :prometheus_alert_db_indicators_settings + ) + end +end diff --git a/db/post_migrate/20230808170646_remove_free_user_cap_over_limt_notified_at_column.rb b/db/post_migrate/20230808170646_remove_free_user_cap_over_limt_notified_at_column.rb new file mode 100644 index 00000000000..cd061499d67 --- /dev/null +++ b/db/post_migrate/20230808170646_remove_free_user_cap_over_limt_notified_at_column.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RemoveFreeUserCapOverLimtNotifiedAtColumn < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + remove_column :namespace_details, :free_user_cap_over_limt_notified_at, :datetime_with_timezone + end +end diff --git a/db/post_migrate/20230809090349_ensure_id_uniqueness_for_p_ci_builds_v2.rb b/db/post_migrate/20230809090349_ensure_id_uniqueness_for_p_ci_builds_v2.rb new file mode 100644 index 00000000000..8170059624c --- /dev/null +++ b/db/post_migrate/20230809090349_ensure_id_uniqueness_for_p_ci_builds_v2.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +class EnsureIdUniquenessForPCiBuildsV2 < Gitlab::Database::Migration[2.1] + include Gitlab::Database::SchemaHelpers + include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum + + enable_lock_retries! + + TABLE_NAME = :p_ci_builds + FUNCTION_NAME = :assign_p_ci_builds_id_value + TRIGGER_NAME = :assign_p_ci_builds_id_trigger + + def up + return unless should_run? + return if trigger_exists?(:ci_builds, TRIGGER_NAME) + + change_column_default(TABLE_NAME, :id, nil) + + create_trigger_function(FUNCTION_NAME) do + <<~SQL + IF NEW."id" IS NOT NULL THEN + RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored'; + END IF; + NEW."id" := nextval('ci_builds_id_seq'::regclass); + RETURN NEW; + SQL + end + + Gitlab::Database::PostgresPartitionedTable.each_partition(TABLE_NAME) do |partition| + create_trigger(partition.identifier, TRIGGER_NAME, FUNCTION_NAME, fires: 'BEFORE INSERT') + end + end + + def down + return unless should_run? + + execute(<<~SQL.squish) + ALTER TABLE #{TABLE_NAME} + ALTER COLUMN id SET DEFAULT nextval('ci_builds_id_seq'::regclass); + + DROP FUNCTION IF EXISTS #{FUNCTION_NAME} CASCADE; + SQL + end + + private + + def should_run? + can_execute_on?(:ci_builds) + end +end diff --git a/db/post_migrate/20230809104007_ensure_epic_user_mentions_bigint_backfill_is_finished_for_self_hosts.rb b/db/post_migrate/20230809104007_ensure_epic_user_mentions_bigint_backfill_is_finished_for_self_hosts.rb new file mode 100644 index 00000000000..e190c18c871 --- /dev/null +++ b/db/post_migrate/20230809104007_ensure_epic_user_mentions_bigint_backfill_is_finished_for_self_hosts.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class EnsureEpicUserMentionsBigintBackfillIsFinishedForSelfHosts < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'epic_user_mentions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230809104753_swap_epic_user_mentions_note_id_to_bigint_for_self_hosts.rb b/db/post_migrate/20230809104753_swap_epic_user_mentions_note_id_to_bigint_for_self_hosts.rb new file mode 100644 index 00000000000..60d10b0ec65 --- /dev/null +++ b/db/post_migrate/20230809104753_swap_epic_user_mentions_note_id_to_bigint_for_self_hosts.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +class SwapEpicUserMentionsNoteIdToBigintForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'epic_user_mentions' + + def up + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def swap + # This will replace the existing epic_user_mentions_on_epic_id_and_note_id_index + add_concurrent_index TABLE_NAME, [:epic_id, :note_id_convert_to_bigint], unique: true, + name: 'epic_user_mentions_on_epic_id_and_note_id_convert_to_bigint' + + # This will replace the existing epic_user_mentions_on_epic_id_index + add_concurrent_index TABLE_NAME, :epic_id, unique: true, + name: 'tmp_epic_user_mentions_on_epic_id_index', + where: 'note_id_convert_to_bigint IS NULL' + + # This will replace the existing index_epic_user_mentions_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, unique: true, + name: 'index_epic_user_mentions_on_note_id_convert_to_bigint', + where: 'note_id_convert_to_bigint IS NOT NULL' + + # This will replace the existing fk_rails_1c65976a49 + add_concurrent_foreign_key TABLE_NAME, :notes, column: :note_id_convert_to_bigint, + name: 'fk_epic_user_mentions_note_id_convert_to_bigint', + on_delete: :cascade + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + execute 'DROP INDEX IF EXISTS epic_user_mentions_on_epic_id_and_note_id_index' + rename_index TABLE_NAME, 'epic_user_mentions_on_epic_id_and_note_id_convert_to_bigint', + 'epic_user_mentions_on_epic_id_and_note_id_index' + + execute 'DROP INDEX IF EXISTS epic_user_mentions_on_epic_id_index' + rename_index TABLE_NAME, 'tmp_epic_user_mentions_on_epic_id_index', + 'epic_user_mentions_on_epic_id_index' + + execute 'DROP INDEX IF EXISTS index_epic_user_mentions_on_note_id' + rename_index TABLE_NAME, 'index_epic_user_mentions_on_note_id_convert_to_bigint', + 'index_epic_user_mentions_on_note_id' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_rails_1c65976a49" + rename_constraint(TABLE_NAME, 'fk_epic_user_mentions_note_id_convert_to_bigint', 'fk_rails_1c65976a49') + end + end + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230809133249_index_sbom_occurrences_on_project_id_component_id_and_input_file_path.rb b/db/post_migrate/20230809133249_index_sbom_occurrences_on_project_id_component_id_and_input_file_path.rb new file mode 100644 index 00000000000..5b048344fad --- /dev/null +++ b/db/post_migrate/20230809133249_index_sbom_occurrences_on_project_id_component_id_and_input_file_path.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IndexSbomOccurrencesOnProjectIdComponentIdAndInputFilePath < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_sbom_occurrences_for_input_file_path_search' + + disable_ddl_transaction! + + def up + add_concurrent_index :sbom_occurrences, %i[project_id component_id input_file_path], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME + end +end diff --git a/db/post_migrate/20230810103141_ensure_suggestions_note_id_bigint_backfill_is_finished_for_self_hosts.rb b/db/post_migrate/20230810103141_ensure_suggestions_note_id_bigint_backfill_is_finished_for_self_hosts.rb new file mode 100644 index 00000000000..3c2050bedee --- /dev/null +++ b/db/post_migrate/20230810103141_ensure_suggestions_note_id_bigint_backfill_is_finished_for_self_hosts.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class EnsureSuggestionsNoteIdBigintBackfillIsFinishedForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'suggestions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230810103534_swap_suggestions_note_id_to_bigint_for_self_hosts.rb b/db/post_migrate/20230810103534_swap_suggestions_note_id_to_bigint_for_self_hosts.rb new file mode 100644 index 00000000000..4f1362495a6 --- /dev/null +++ b/db/post_migrate/20230810103534_swap_suggestions_note_id_to_bigint_for_self_hosts.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +class SwapSuggestionsNoteIdToBigintForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'suggestions' + + def up + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def swap + # This will replace the existing index_suggestions_on_note_id_and_relative_order + add_concurrent_index TABLE_NAME, [:note_id_convert_to_bigint, :relative_order], unique: true, + name: 'index_suggestions_on_note_id_convert_to_bigint_relative_order' + + # This will replace the existing fk_rails_33b03a535c + add_concurrent_foreign_key TABLE_NAME, :notes, column: :note_id_convert_to_bigint, + name: 'fk_suggestions_note_id_convert_to_bigint', + on_delete: :cascade + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + # Swap defaults + change_column_default TABLE_NAME, :note_id, nil + change_column_default TABLE_NAME, :note_id_convert_to_bigint, 0 + + execute 'DROP INDEX IF EXISTS index_suggestions_on_note_id_and_relative_order' + rename_index TABLE_NAME, 'index_suggestions_on_note_id_convert_to_bigint_relative_order', + 'index_suggestions_on_note_id_and_relative_order' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_rails_33b03a535c" + rename_constraint(TABLE_NAME, 'fk_suggestions_note_id_convert_to_bigint', 'fk_rails_33b03a535c') + end + end + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230810122746_ensure_snippet_user_mentions_bigint_backfill_is_finished_for_self_hosts.rb b/db/post_migrate/20230810122746_ensure_snippet_user_mentions_bigint_backfill_is_finished_for_self_hosts.rb new file mode 100644 index 00000000000..4dc5162176e --- /dev/null +++ b/db/post_migrate/20230810122746_ensure_snippet_user_mentions_bigint_backfill_is_finished_for_self_hosts.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class EnsureSnippetUserMentionsBigintBackfillIsFinishedForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'snippet_user_mentions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230810123044_swap_snippet_user_mentions_note_id_to_bigint_for_self_hosts.rb b/db/post_migrate/20230810123044_swap_snippet_user_mentions_note_id_to_bigint_for_self_hosts.rb new file mode 100644 index 00000000000..4c8ac259f61 --- /dev/null +++ b/db/post_migrate/20230810123044_swap_snippet_user_mentions_note_id_to_bigint_for_self_hosts.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +class SwapSnippetUserMentionsNoteIdToBigintForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'snippet_user_mentions' + + def up + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def swap + # This will replace the existing index_snippet_user_mentions_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, unique: true, + name: 'index_snippet_user_mentions_on_note_id_convert_to_bigint', + where: 'note_id_convert_to_bigint IS NOT NULL' + + # This will replace the existing snippet_user_mentions_on_snippet_id_and_note_id_index + add_concurrent_index TABLE_NAME, [:snippet_id, :note_id_convert_to_bigint], unique: true, + name: 'tmp_snippet_user_mentions_on_snippet_id_and_note_id_index' + + # This will replace the existing snippet_user_mentions_on_snippet_id_index + add_concurrent_index TABLE_NAME, :snippet_id, unique: true, + name: 'tmp_snippet_user_mentions_on_snippet_id_index', + where: 'note_id_convert_to_bigint IS NULL' + + # This will replace the existing fk_rails_4d3f96b2cb + add_concurrent_foreign_key TABLE_NAME, :notes, column: :note_id_convert_to_bigint, + name: 'fk_snippet_user_mentions_note_id_convert_to_bigint', + on_delete: :cascade + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + execute 'DROP INDEX IF EXISTS index_snippet_user_mentions_on_note_id' + rename_index TABLE_NAME, 'index_snippet_user_mentions_on_note_id_convert_to_bigint', + 'index_snippet_user_mentions_on_note_id' + + execute 'DROP INDEX IF EXISTS snippet_user_mentions_on_snippet_id_and_note_id_index' + rename_index TABLE_NAME, 'tmp_snippet_user_mentions_on_snippet_id_and_note_id_index', + 'snippet_user_mentions_on_snippet_id_and_note_id_index' + + execute 'DROP INDEX IF EXISTS snippet_user_mentions_on_snippet_id_index' + rename_index TABLE_NAME, 'tmp_snippet_user_mentions_on_snippet_id_index', + 'snippet_user_mentions_on_snippet_id_index' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_rails_4d3f96b2cb" + rename_constraint(TABLE_NAME, 'fk_snippet_user_mentions_note_id_convert_to_bigint', 'fk_rails_4d3f96b2cb') + end + end + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230811103654_ensure_vum_bigint_backfill_is_finished_for_self_hosts.rb b/db/post_migrate/20230811103654_ensure_vum_bigint_backfill_is_finished_for_self_hosts.rb new file mode 100644 index 00000000000..6ca1f5727d4 --- /dev/null +++ b/db/post_migrate/20230811103654_ensure_vum_bigint_backfill_is_finished_for_self_hosts.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class EnsureVumBigintBackfillIsFinishedForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'vulnerability_user_mentions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230811103941_swap_vulnerability_user_mentions_note_id_to_bigint_for_self_hosts.rb b/db/post_migrate/20230811103941_swap_vulnerability_user_mentions_note_id_to_bigint_for_self_hosts.rb new file mode 100644 index 00000000000..25cff9464b1 --- /dev/null +++ b/db/post_migrate/20230811103941_swap_vulnerability_user_mentions_note_id_to_bigint_for_self_hosts.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +class SwapVulnerabilityUserMentionsNoteIdToBigintForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'vulnerability_user_mentions' + + def up + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def swap + # This will replace the existing index_vulnerability_user_mentions_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, unique: true, + name: 'index_vulnerability_user_mentions_on_note_id_convert_to_bigint', + where: 'note_id_convert_to_bigint IS NOT NULL' + + # This will replace the existing index_vulns_user_mentions_on_vulnerability_id + add_concurrent_index TABLE_NAME, :vulnerability_id, unique: true, + name: 'tmp_index_vulns_user_mentions_on_vulnerability_id', + where: 'note_id_convert_to_bigint IS NULL' + + # This will replace the existing index_vulns_user_mentions_on_vulnerability_id_and_note_id + add_concurrent_index TABLE_NAME, [:vulnerability_id, :note_id_convert_to_bigint], unique: true, + name: 'tmp_index_vulns_user_mentions_on_vulnerability_id_and_note_id' + + # This will replace the existing fk_rails_a18600f210 + add_concurrent_foreign_key TABLE_NAME, :notes, column: :note_id_convert_to_bigint, + name: 'fk_vulnerability_user_mentions_note_id_convert_to_bigint', + on_delete: :cascade + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + execute 'DROP INDEX IF EXISTS index_vulnerability_user_mentions_on_note_id' + rename_index TABLE_NAME, 'index_vulnerability_user_mentions_on_note_id_convert_to_bigint', + 'index_vulnerability_user_mentions_on_note_id' + + execute 'DROP INDEX IF EXISTS index_vulns_user_mentions_on_vulnerability_id' + rename_index TABLE_NAME, 'tmp_index_vulns_user_mentions_on_vulnerability_id', + 'index_vulns_user_mentions_on_vulnerability_id' + + execute 'DROP INDEX IF EXISTS index_vulns_user_mentions_on_vulnerability_id_and_note_id' + rename_index TABLE_NAME, 'tmp_index_vulns_user_mentions_on_vulnerability_id_and_note_id', + 'index_vulns_user_mentions_on_vulnerability_id_and_note_id' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_rails_a18600f210" + rename_constraint(TABLE_NAME, 'fk_vulnerability_user_mentions_note_id_convert_to_bigint', 'fk_rails_a18600f210') + end + end + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/post_migrate/20230811145848_ensure_commit_user_mentions_note_id_bigint_backfill_is_finished_for_self_managed.rb b/db/post_migrate/20230811145848_ensure_commit_user_mentions_note_id_bigint_backfill_is_finished_for_self_managed.rb new file mode 100644 index 00000000000..9510e2673dc --- /dev/null +++ b/db/post_migrate/20230811145848_ensure_commit_user_mentions_note_id_bigint_backfill_is_finished_for_self_managed.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class EnsureCommitUserMentionsNoteIdBigintBackfillIsFinishedForSelfManaged < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + return if com_or_dev_or_test_but_not_jh? + + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'commit_user_mentions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230811150636_swap_commit_user_mentions_note_id_to_bigint_for_self_managed.rb b/db/post_migrate/20230811150636_swap_commit_user_mentions_note_id_to_bigint_for_self_managed.rb new file mode 100644 index 00000000000..e98cf61db98 --- /dev/null +++ b/db/post_migrate/20230811150636_swap_commit_user_mentions_note_id_to_bigint_for_self_managed.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +class SwapCommitUserMentionsNoteIdToBigintForSelfManaged < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'commit_user_mentions' + + def up + return if com_or_dev_or_test_but_not_jh? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if com_or_dev_or_test_but_not_jh? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + # Same as db/post_migrate/20230321003252_swap_commit_user_mentions_note_id_to_bigint_for_gitlab_dot_com.rb + def swap + # This will replace the existing commit_user_mentions_on_commit_id_and_note_id_unique_index + add_concurrent_index TABLE_NAME, [:commit_id, :note_id_convert_to_bigint], unique: true, + name: 'commit_user_mentions_on_commit_id_and_note_id_convert_to_bigint' + + # This will replace the existing index_commit_user_mentions_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, unique: true, + name: 'index_commit_user_mentions_on_note_id_convert_to_bigint' + + # This will replace the existing fk_rails_a6760813e0 + add_concurrent_foreign_key TABLE_NAME, :notes, column: :note_id_convert_to_bigint, + name: 'fk_commit_user_mentions_note_id_convert_to_bigint', + on_delete: :cascade + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + # Swap defaults + change_column_default TABLE_NAME, :note_id, nil + change_column_default TABLE_NAME, :note_id_convert_to_bigint, 0 + + execute 'DROP INDEX IF EXISTS commit_user_mentions_on_commit_id_and_note_id_unique_index' + rename_index TABLE_NAME, 'commit_user_mentions_on_commit_id_and_note_id_convert_to_bigint', + 'commit_user_mentions_on_commit_id_and_note_id_unique_index' + + execute 'DROP INDEX IF EXISTS index_commit_user_mentions_on_note_id' + rename_index TABLE_NAME, 'index_commit_user_mentions_on_note_id_convert_to_bigint', + 'index_commit_user_mentions_on_note_id' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_rails_a6760813e0" + rename_constraint(TABLE_NAME, 'fk_commit_user_mentions_note_id_convert_to_bigint', 'fk_rails_a6760813e0') + end + end +end diff --git a/db/post_migrate/20230814143925_ensure_timelogs_note_id_bigint_backfill_is_finished_for_self_hosts.rb b/db/post_migrate/20230814143925_ensure_timelogs_note_id_bigint_backfill_is_finished_for_self_hosts.rb new file mode 100644 index 00000000000..5aff282f699 --- /dev/null +++ b/db/post_migrate/20230814143925_ensure_timelogs_note_id_bigint_backfill_is_finished_for_self_hosts.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class EnsureTimelogsNoteIdBigintBackfillIsFinishedForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'timelogs', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230814144045_swap_timelogs_note_id_to_bigint_for_self_hosts.rb b/db/post_migrate/20230814144045_swap_timelogs_note_id_to_bigint_for_self_hosts.rb new file mode 100644 index 00000000000..55a0d46d840 --- /dev/null +++ b/db/post_migrate/20230814144045_swap_timelogs_note_id_to_bigint_for_self_hosts.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +class SwapTimelogsNoteIdToBigintForSelfHosts < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'timelogs' + + def up + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return if columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def down + return if should_skip? + return if temp_column_removed?(TABLE_NAME, :note_id) + return unless columns_swapped?(TABLE_NAME, :note_id) + + swap + end + + def swap + # This will replace the existing index_timelogs_on_note_id + add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, name: 'index_timelogs_on_note_id_convert_to_bigint' + + # This will replace the existing fk_timelogs_note_id + add_concurrent_foreign_key :timelogs, :notes, column: :note_id_convert_to_bigint, + name: 'fk_timelogs_note_id_convert_to_bigint', + on_delete: :nullify + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id" + execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint" + + function_name = Gitlab::Database::UnidirectionalCopyTrigger + .on_table(TABLE_NAME, connection: connection) + .name(:note_id, :note_id_convert_to_bigint) + execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL" + + execute "DROP INDEX IF EXISTS index_timelogs_on_note_id" + rename_index TABLE_NAME, 'index_timelogs_on_note_id_convert_to_bigint', 'index_timelogs_on_note_id' + + execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_timelogs_note_id" + rename_constraint(TABLE_NAME, 'fk_timelogs_note_id_convert_to_bigint', 'fk_timelogs_note_id') + end + end + + def should_skip? + com_or_dev_or_test_but_not_jh? + end +end diff --git a/db/schema_migrations/20230601090722 b/db/schema_migrations/20230601090722 new file mode 100644 index 00000000000..300471f2dcf --- /dev/null +++ b/db/schema_migrations/20230601090722 @@ -0,0 +1 @@ +9d8025f9cc8b9432e5ccc872bbf9ba42bdb60d64af4a787cc1c90e465b452085
\ No newline at end of file diff --git a/db/schema_migrations/20230601153401 b/db/schema_migrations/20230601153401 new file mode 100644 index 00000000000..cbad2334e77 --- /dev/null +++ b/db/schema_migrations/20230601153401 @@ -0,0 +1 @@ +39012bb1ee3985c8b2ca495f799db8f9a60e137f3d503f7721396ac78237a038
\ No newline at end of file diff --git a/db/schema_migrations/20230612232000 b/db/schema_migrations/20230612232000 new file mode 100644 index 00000000000..248552bbb52 --- /dev/null +++ b/db/schema_migrations/20230612232000 @@ -0,0 +1 @@ +cb34e35ebabd6e7f1c5ac0796ab92d1323c88d222ae5a5b38686383b365dca46
\ No newline at end of file diff --git a/db/schema_migrations/20230626142009 b/db/schema_migrations/20230626142009 new file mode 100644 index 00000000000..ed9449a2067 --- /dev/null +++ b/db/schema_migrations/20230626142009 @@ -0,0 +1 @@ +5a4aff0810f41646e25614ad26a826434eb28e85a8f1393e4e1799ce6ab61ff7
\ No newline at end of file diff --git a/db/schema_migrations/20230626142010 b/db/schema_migrations/20230626142010 new file mode 100644 index 00000000000..3ec883ee28f --- /dev/null +++ b/db/schema_migrations/20230626142010 @@ -0,0 +1 @@ +ff621297609cbbcb09108981daacfacf341d1e39bbbbe71fe140c6a0b7af40eb
\ No newline at end of file diff --git a/db/schema_migrations/20230626143139 b/db/schema_migrations/20230626143139 new file mode 100644 index 00000000000..bb9f03a4cbb --- /dev/null +++ b/db/schema_migrations/20230626143139 @@ -0,0 +1 @@ +20e8e9e72d25ed720d4aa8c3045a8cc99c6e34cc9ac4f0973e39627300866f30
\ No newline at end of file diff --git a/db/schema_migrations/20230626211305 b/db/schema_migrations/20230626211305 new file mode 100644 index 00000000000..bb9cf36e48d --- /dev/null +++ b/db/schema_migrations/20230626211305 @@ -0,0 +1 @@ +f4e628f28e4d2ad11bcbee48aed5146a0dfdf2745911db3f63de2dca455e69a5
\ No newline at end of file diff --git a/db/schema_migrations/20230626215602 b/db/schema_migrations/20230626215602 new file mode 100644 index 00000000000..fb64b8c7f66 --- /dev/null +++ b/db/schema_migrations/20230626215602 @@ -0,0 +1 @@ +6a4ecb8e9f8855cb44b425e16cc89c9146fd4709b5daf322747c3034f11c4cf2
\ No newline at end of file diff --git a/db/schema_migrations/20230626215614 b/db/schema_migrations/20230626215614 new file mode 100644 index 00000000000..479153c6451 --- /dev/null +++ b/db/schema_migrations/20230626215614 @@ -0,0 +1 @@ +5c8dbf1b5ad9d41014330eeb07a7daed135a0e9a579d2c15c1f9f0cba83f0bcd
\ No newline at end of file diff --git a/db/schema_migrations/20230626215638 b/db/schema_migrations/20230626215638 new file mode 100644 index 00000000000..b93870e7d7e --- /dev/null +++ b/db/schema_migrations/20230626215638 @@ -0,0 +1 @@ +e72aae56b010d9c04fb6a8cc799ae39a817eb4a755f162d2a1157d6d5a8a3131
\ No newline at end of file diff --git a/db/schema_migrations/20230701043315 b/db/schema_migrations/20230701043315 new file mode 100644 index 00000000000..15a1fd9cbfe --- /dev/null +++ b/db/schema_migrations/20230701043315 @@ -0,0 +1 @@ +e2a7487d4da68819a1bdde6626b32ef8399a917a75d4cbc8ecf2fa140ba1ff16
\ No newline at end of file diff --git a/db/schema_migrations/20230701053315 b/db/schema_migrations/20230701053315 new file mode 100644 index 00000000000..f215dd876ec --- /dev/null +++ b/db/schema_migrations/20230701053315 @@ -0,0 +1 @@ +e171f06f9b1a0824cd11216255b1f99976bdd97069a35a8514934d33e5b3e634
\ No newline at end of file diff --git a/db/schema_migrations/20230702053002 b/db/schema_migrations/20230702053002 new file mode 100644 index 00000000000..a2eb709cd56 --- /dev/null +++ b/db/schema_migrations/20230702053002 @@ -0,0 +1 @@ +54ac5a22e121379b1ffcefc7b4c1f26cadd15a9b0cabfd0d9e3cba3886777d46
\ No newline at end of file diff --git a/db/schema_migrations/20230704233431 b/db/schema_migrations/20230704233431 new file mode 100644 index 00000000000..7b0af2a2a3f --- /dev/null +++ b/db/schema_migrations/20230704233431 @@ -0,0 +1 @@ +d07a8cdd97cc221d64257fdcab34c3e44593f6c3a430523a2e73c96fa12c8ba1
\ No newline at end of file diff --git a/db/schema_migrations/20230707003301 b/db/schema_migrations/20230707003301 new file mode 100644 index 00000000000..b1d5d84ee1b --- /dev/null +++ b/db/schema_migrations/20230707003301 @@ -0,0 +1 @@ +dac0b6b1f86685bd19aed528c75197adfee06154ea68efdb854f4b17deb973fa
\ No newline at end of file diff --git a/db/schema_migrations/20230707031923 b/db/schema_migrations/20230707031923 new file mode 100644 index 00000000000..af20d211b43 --- /dev/null +++ b/db/schema_migrations/20230707031923 @@ -0,0 +1 @@ +0a9e2fd92a64fbd4f2dc0d9fc866b3c5bb582c10503b0a85f1164db2e42c7cd0
\ No newline at end of file diff --git a/db/schema_migrations/20230710024518 b/db/schema_migrations/20230710024518 new file mode 100644 index 00000000000..d681e2a0778 --- /dev/null +++ b/db/schema_migrations/20230710024518 @@ -0,0 +1 @@ +11c031dc6fe6cf48b4268adf64f147d5447f79e53543b3fcb57196f99092af8b
\ No newline at end of file diff --git a/db/schema_migrations/20230710024903 b/db/schema_migrations/20230710024903 new file mode 100644 index 00000000000..4b530327bdd --- /dev/null +++ b/db/schema_migrations/20230710024903 @@ -0,0 +1 @@ +23d1b7e65b4e2742a25063dc277e73e9b48151e038d1079316209aed6d9c8199
\ No newline at end of file diff --git a/db/schema_migrations/20230710094027 b/db/schema_migrations/20230710094027 new file mode 100644 index 00000000000..ecbfffa8df6 --- /dev/null +++ b/db/schema_migrations/20230710094027 @@ -0,0 +1 @@ +1b0168b871414523c2da47b811336660c51819512b54c0d8728386156028615a
\ No newline at end of file diff --git a/db/schema_migrations/20230711032913 b/db/schema_migrations/20230711032913 new file mode 100644 index 00000000000..850a02470d2 --- /dev/null +++ b/db/schema_migrations/20230711032913 @@ -0,0 +1 @@ +0d547c79b1b1451ab06c3a53278e759e2d4067071ffa3e0004ade289f4a6f6a4
\ No newline at end of file diff --git a/db/schema_migrations/20230711033030 b/db/schema_migrations/20230711033030 new file mode 100644 index 00000000000..17871ccf7fd --- /dev/null +++ b/db/schema_migrations/20230711033030 @@ -0,0 +1 @@ +4e89113485a7611dfe33b217af2818ff47c558bb67edd85e27a6bc4c5a06896d
\ No newline at end of file diff --git a/db/schema_migrations/20230711151845 b/db/schema_migrations/20230711151845 new file mode 100644 index 00000000000..1a96738833c --- /dev/null +++ b/db/schema_migrations/20230711151845 @@ -0,0 +1 @@ +4285dfe98db13ffe7f97a69f95e14c584b32cb20526766a8179012c616ef3d0a
\ No newline at end of file diff --git a/db/schema_migrations/20230711182029 b/db/schema_migrations/20230711182029 new file mode 100644 index 00000000000..b0fefc6443b --- /dev/null +++ b/db/schema_migrations/20230711182029 @@ -0,0 +1 @@ +ef4fa027fe7422e3200fdf30b3c9d0f1262f5f8f1f17f5123eb68e5ccd9fe552
\ No newline at end of file diff --git a/db/schema_migrations/20230712052619 b/db/schema_migrations/20230712052619 new file mode 100644 index 00000000000..471e65c78e7 --- /dev/null +++ b/db/schema_migrations/20230712052619 @@ -0,0 +1 @@ +23cbf1e289bb042633fbd56108e00663ee709caa12590d1a02aab8d430e243a7
\ No newline at end of file diff --git a/db/schema_migrations/20230712054057 b/db/schema_migrations/20230712054057 new file mode 100644 index 00000000000..47eb6a2a106 --- /dev/null +++ b/db/schema_migrations/20230712054057 @@ -0,0 +1 @@ +9a8fb423149fc13b24bc945cfc23ba85f4c2e23d865e97d4aebc8694ae9208b9
\ No newline at end of file diff --git a/db/schema_migrations/20230712055956 b/db/schema_migrations/20230712055956 new file mode 100644 index 00000000000..4fe9289faaa --- /dev/null +++ b/db/schema_migrations/20230712055956 @@ -0,0 +1 @@ +07a1d7d532315002acf0c762806c404b09a12d571d80eeb78edeeeddeb2322da
\ No newline at end of file diff --git a/db/schema_migrations/20230712135325 b/db/schema_migrations/20230712135325 new file mode 100644 index 00000000000..ec2e325d273 --- /dev/null +++ b/db/schema_migrations/20230712135325 @@ -0,0 +1 @@ +a5ecb4af74a2cb2a26e2204612a27cfe186d7ed3e46745e308abc80f6ad8aec8
\ No newline at end of file diff --git a/db/schema_migrations/20230712135428 b/db/schema_migrations/20230712135428 new file mode 100644 index 00000000000..37b7331a2ae --- /dev/null +++ b/db/schema_migrations/20230712135428 @@ -0,0 +1 @@ +172ceeeb7a08d0727417c70242a62b423b525d628c550c67a6d11b3602663c45
\ No newline at end of file diff --git a/db/schema_migrations/20230712141733 b/db/schema_migrations/20230712141733 new file mode 100644 index 00000000000..4056382178c --- /dev/null +++ b/db/schema_migrations/20230712141733 @@ -0,0 +1 @@ +d1a7a2c12fdcbb98c0fd2da326490b411b3a0f791a7726ea5796a5bff8399b08
\ No newline at end of file diff --git a/db/schema_migrations/20230712145557 b/db/schema_migrations/20230712145557 new file mode 100644 index 00000000000..56fd5d3dc70 --- /dev/null +++ b/db/schema_migrations/20230712145557 @@ -0,0 +1 @@ +7e3effd7d0b7485193bac1226dd7544dee71381c6b5c1323500f4c4c5b2da690
\ No newline at end of file diff --git a/db/schema_migrations/20230713021230 b/db/schema_migrations/20230713021230 new file mode 100644 index 00000000000..a59fe2501fc --- /dev/null +++ b/db/schema_migrations/20230713021230 @@ -0,0 +1 @@ +acd88f1c0e5d0c429420acdc912b2dff1ba1534df5588038f4cdc515dd878dcc
\ No newline at end of file diff --git a/db/schema_migrations/20230713234121 b/db/schema_migrations/20230713234121 new file mode 100644 index 00000000000..84382d7cf73 --- /dev/null +++ b/db/schema_migrations/20230713234121 @@ -0,0 +1 @@ +8dd7e4a28417629324f904b20d16e67a0832a6a731c3e7095097dc632d93ca9d
\ No newline at end of file diff --git a/db/schema_migrations/20230714015909 b/db/schema_migrations/20230714015909 new file mode 100644 index 00000000000..c5362b4a82d --- /dev/null +++ b/db/schema_migrations/20230714015909 @@ -0,0 +1 @@ +54f82e196c756ca60c4d7300ef1987a6b1ca50d4ef87bf89bb62eb577164365c
\ No newline at end of file diff --git a/db/schema_migrations/20230714020854 b/db/schema_migrations/20230714020854 new file mode 100644 index 00000000000..17efaee93da --- /dev/null +++ b/db/schema_migrations/20230714020854 @@ -0,0 +1 @@ +1c6d77c77c42a47bdc885e5cc8e0aef11a47d1a1e27a405cd1ccc8d938bf13b6
\ No newline at end of file diff --git a/db/schema_migrations/20230714084415 b/db/schema_migrations/20230714084415 new file mode 100644 index 00000000000..4cfc303bbc1 --- /dev/null +++ b/db/schema_migrations/20230714084415 @@ -0,0 +1 @@ +0feaa606eef20192e84dfac7bc9285ca7c7baa56892fba99867c43b6b486dc33
\ No newline at end of file diff --git a/db/schema_migrations/20230714095946 b/db/schema_migrations/20230714095946 new file mode 100644 index 00000000000..26efcf8bed1 --- /dev/null +++ b/db/schema_migrations/20230714095946 @@ -0,0 +1 @@ +4cd83a7c498b698c7fa2b7adade3ac96005ff3408f92138416efa9c3a13ab05b
\ No newline at end of file diff --git a/db/schema_migrations/20230717055659 b/db/schema_migrations/20230717055659 new file mode 100644 index 00000000000..d88c4204c90 --- /dev/null +++ b/db/schema_migrations/20230717055659 @@ -0,0 +1 @@ +e54d239394b07f13e0757ad02020d24ad3b89e2167272a3e831577980ab4fcd1
\ No newline at end of file diff --git a/db/schema_migrations/20230717055730 b/db/schema_migrations/20230717055730 new file mode 100644 index 00000000000..888ab9a3e6f --- /dev/null +++ b/db/schema_migrations/20230717055730 @@ -0,0 +1 @@ +1164a2a92c360d426222edb7674b362975ab26cafbc38cb5524540bd2436ba8c
\ No newline at end of file diff --git a/db/schema_migrations/20230717062425 b/db/schema_migrations/20230717062425 new file mode 100644 index 00000000000..735c10874e0 --- /dev/null +++ b/db/schema_migrations/20230717062425 @@ -0,0 +1 @@ +5303be6b0da16a7b1fa64c1c99ef3809ee2f5c131daaf25e6073ffc4122fe8ec
\ No newline at end of file diff --git a/db/schema_migrations/20230717062445 b/db/schema_migrations/20230717062445 new file mode 100644 index 00000000000..20b05fded65 --- /dev/null +++ b/db/schema_migrations/20230717062445 @@ -0,0 +1 @@ +cb600935d177a342f082bf896ffbc23f638fae2d124a89f7604b84c1e0ca9a2a
\ No newline at end of file diff --git a/db/schema_migrations/20230717091811 b/db/schema_migrations/20230717091811 new file mode 100644 index 00000000000..adcbb70cbeb --- /dev/null +++ b/db/schema_migrations/20230717091811 @@ -0,0 +1 @@ +75ffffb20f6821af4b7fc8d6c8d15fc08e00e5a13f48505935b702452f108fd0
\ No newline at end of file diff --git a/db/schema_migrations/20230717142737 b/db/schema_migrations/20230717142737 new file mode 100644 index 00000000000..8256b5f96a9 --- /dev/null +++ b/db/schema_migrations/20230717142737 @@ -0,0 +1 @@ +b4d019cbb11ee3c443aa8c5b1c34325483b7041529b731642074090e51f914e5
\ No newline at end of file diff --git a/db/schema_migrations/20230717144729 b/db/schema_migrations/20230717144729 new file mode 100644 index 00000000000..786c5fe295b --- /dev/null +++ b/db/schema_migrations/20230717144729 @@ -0,0 +1 @@ +a9264babc5e84597c2f8fb2fb2a3df4dceb0f6fe83877d18df03e679c77afa1b
\ No newline at end of file diff --git a/db/schema_migrations/20230717144744 b/db/schema_migrations/20230717144744 new file mode 100644 index 00000000000..c643d8d90dc --- /dev/null +++ b/db/schema_migrations/20230717144744 @@ -0,0 +1 @@ +2ed2825eb5a1adaf1456096c84c0bc4016374e5525defa31b8c1393a8d864007
\ No newline at end of file diff --git a/db/schema_migrations/20230717144802 b/db/schema_migrations/20230717144802 new file mode 100644 index 00000000000..12494fd2104 --- /dev/null +++ b/db/schema_migrations/20230717144802 @@ -0,0 +1 @@ +eed3845b0321cdb69c7dfe8e54dda940362f1bc99405727eb252744cda254522
\ No newline at end of file diff --git a/db/schema_migrations/20230717144817 b/db/schema_migrations/20230717144817 new file mode 100644 index 00000000000..d16daa2fad6 --- /dev/null +++ b/db/schema_migrations/20230717144817 @@ -0,0 +1 @@ +18f72f73afe0fb027df28f6bc915f8afc1460258b08038055ee9c48a6d2bfbeb
\ No newline at end of file diff --git a/db/schema_migrations/20230717165532 b/db/schema_migrations/20230717165532 new file mode 100644 index 00000000000..64668bece41 --- /dev/null +++ b/db/schema_migrations/20230717165532 @@ -0,0 +1 @@ +91f0790d414432980326cee57a9b37dcd0166559a7aa7dd8dc6a6b3b8be21038
\ No newline at end of file diff --git a/db/schema_migrations/20230718020825 b/db/schema_migrations/20230718020825 new file mode 100644 index 00000000000..dda10a5fbfc --- /dev/null +++ b/db/schema_migrations/20230718020825 @@ -0,0 +1 @@ +07d465dbd1b81bd388516b78e75cfeb890e6166e6b8cab23254a9a79a4de60c5
\ No newline at end of file diff --git a/db/schema_migrations/20230718025027 b/db/schema_migrations/20230718025027 new file mode 100644 index 00000000000..582de04f6ea --- /dev/null +++ b/db/schema_migrations/20230718025027 @@ -0,0 +1 @@ +5e96f3cd5eb5c5943e9081f2c3287a17e69fe1b9ca5fd890e4c883287fac60b6
\ No newline at end of file diff --git a/db/schema_migrations/20230718094246 b/db/schema_migrations/20230718094246 new file mode 100644 index 00000000000..4d42af51f7d --- /dev/null +++ b/db/schema_migrations/20230718094246 @@ -0,0 +1 @@ +8cb2cd90109dcc4f29ab34fa4caca617fe7bf42493e3a6712b66978480f06940
\ No newline at end of file diff --git a/db/schema_migrations/20230718094501 b/db/schema_migrations/20230718094501 new file mode 100644 index 00000000000..3db259aa8ba --- /dev/null +++ b/db/schema_migrations/20230718094501 @@ -0,0 +1 @@ +636bd7305c03f94cd161dc21deda05c289946b31a3c04805c08273f9a7067729
\ No newline at end of file diff --git a/db/schema_migrations/20230718111807 b/db/schema_migrations/20230718111807 new file mode 100644 index 00000000000..1c0f9dc33bf --- /dev/null +++ b/db/schema_migrations/20230718111807 @@ -0,0 +1 @@ +f4a6e21dcacd272de19ee33d4a47c522c819ab867523150b7e4687cfc0af574e
\ No newline at end of file diff --git a/db/schema_migrations/20230718120802 b/db/schema_migrations/20230718120802 new file mode 100644 index 00000000000..811d45b4a44 --- /dev/null +++ b/db/schema_migrations/20230718120802 @@ -0,0 +1 @@ +5c774c26282c6b951a5b4a3241a227361510dff31fad18e4954396a89309c485
\ No newline at end of file diff --git a/db/schema_migrations/20230718124213 b/db/schema_migrations/20230718124213 new file mode 100644 index 00000000000..e58e81caa08 --- /dev/null +++ b/db/schema_migrations/20230718124213 @@ -0,0 +1 @@ +39f3109f0568f565ca001c52a80c097493a9deaada5409ae0e9bb0e996ef4fb1
\ No newline at end of file diff --git a/db/schema_migrations/20230718145613 b/db/schema_migrations/20230718145613 new file mode 100644 index 00000000000..9202326eeed --- /dev/null +++ b/db/schema_migrations/20230718145613 @@ -0,0 +1 @@ +dc5291ab650b378e4bad5a395715a03535e2b217507ab36281dbf43b907fd9e1
\ No newline at end of file diff --git a/db/schema_migrations/20230718145747 b/db/schema_migrations/20230718145747 new file mode 100644 index 00000000000..228326dc30d --- /dev/null +++ b/db/schema_migrations/20230718145747 @@ -0,0 +1 @@ +5bd873b112743d11011ceebb610a1ce3353e46f5652f7413d9c93d468c56f90d
\ No newline at end of file diff --git a/db/schema_migrations/20230718160522 b/db/schema_migrations/20230718160522 new file mode 100644 index 00000000000..172123b9764 --- /dev/null +++ b/db/schema_migrations/20230718160522 @@ -0,0 +1 @@ +dfef3fe7df55dccdb97ce1ac5b0f49f8ab2fb7560e1cb6948d170103e87ba3ea
\ No newline at end of file diff --git a/db/schema_migrations/20230718160749 b/db/schema_migrations/20230718160749 new file mode 100644 index 00000000000..eb171286502 --- /dev/null +++ b/db/schema_migrations/20230718160749 @@ -0,0 +1 @@ +2cde85daf368c2a7f0a19f9a66710149fcd05da09ca555ddbfadb43849011977
\ No newline at end of file diff --git a/db/schema_migrations/20230718234602 b/db/schema_migrations/20230718234602 new file mode 100644 index 00000000000..55c89acbdae --- /dev/null +++ b/db/schema_migrations/20230718234602 @@ -0,0 +1 @@ +b42c91e49c4c0d5459f07838887662f7fe66fe8e1149fd864be384ccae1be9a2
\ No newline at end of file diff --git a/db/schema_migrations/20230719083202 b/db/schema_migrations/20230719083202 new file mode 100644 index 00000000000..03f8d98fa23 --- /dev/null +++ b/db/schema_migrations/20230719083202 @@ -0,0 +1 @@ +a604208ecfe76fe6ba380b804d81018e00a084146c4b29418ce4d447cb030c86
\ No newline at end of file diff --git a/db/schema_migrations/20230720062249 b/db/schema_migrations/20230720062249 new file mode 100644 index 00000000000..4e67deaf793 --- /dev/null +++ b/db/schema_migrations/20230720062249 @@ -0,0 +1 @@ +ad252444f6274d86a9c8c1118b569746c7b0701d5856c31ea95e8f05de80dca4
\ No newline at end of file diff --git a/db/schema_migrations/20230720142334 b/db/schema_migrations/20230720142334 new file mode 100644 index 00000000000..d9a15727ec2 --- /dev/null +++ b/db/schema_migrations/20230720142334 @@ -0,0 +1 @@ +f7f48a276a3ee396daa599d9f6f1d2478b0bbbdf79974ef4813070ba8fee9ef9
\ No newline at end of file diff --git a/db/schema_migrations/20230721134004 b/db/schema_migrations/20230721134004 new file mode 100644 index 00000000000..87da4c80e82 --- /dev/null +++ b/db/schema_migrations/20230721134004 @@ -0,0 +1 @@ +93f43b785d2f0454089fdb8dcd214205596232c765a652bb3588d90a3f6ae040
\ No newline at end of file diff --git a/db/schema_migrations/20230721134546 b/db/schema_migrations/20230721134546 new file mode 100644 index 00000000000..d27aba72ee8 --- /dev/null +++ b/db/schema_migrations/20230721134546 @@ -0,0 +1 @@ +7d6de45ae45840d1743290b4f32fb1f37482a0bd7ac689122b2021c5edabc599
\ No newline at end of file diff --git a/db/schema_migrations/20230721181046 b/db/schema_migrations/20230721181046 new file mode 100644 index 00000000000..106e2313a65 --- /dev/null +++ b/db/schema_migrations/20230721181046 @@ -0,0 +1 @@ +e48f62e077236469147441f9f2fa3303191b8ec43228bd9fe976ce4e4c2b7e7b
\ No newline at end of file diff --git a/db/schema_migrations/20230721194757 b/db/schema_migrations/20230721194757 new file mode 100644 index 00000000000..2757de65eb5 --- /dev/null +++ b/db/schema_migrations/20230721194757 @@ -0,0 +1 @@ +9c8da8fe323f38e5e05bd2a09966f3f6c17f3559d8742377c2bbffa35f0c9292
\ No newline at end of file diff --git a/db/schema_migrations/20230721200323 b/db/schema_migrations/20230721200323 new file mode 100644 index 00000000000..31cefc4a365 --- /dev/null +++ b/db/schema_migrations/20230721200323 @@ -0,0 +1 @@ +ef6014628f15abb46cd3810176889598b2ae53e9d540e7bdd03f008948604730
\ No newline at end of file diff --git a/db/schema_migrations/20230721200810 b/db/schema_migrations/20230721200810 new file mode 100644 index 00000000000..24d48f09001 --- /dev/null +++ b/db/schema_migrations/20230721200810 @@ -0,0 +1 @@ +d7f1a2bf48c9197f153098052d8c8b2b161f07401203a027e8be8ecfa6e4616e
\ No newline at end of file diff --git a/db/schema_migrations/20230721200849 b/db/schema_migrations/20230721200849 new file mode 100644 index 00000000000..e946084ab65 --- /dev/null +++ b/db/schema_migrations/20230721200849 @@ -0,0 +1 @@ +b7136270895edfff2212d0a8af84cbcfda57de81abcdb8aee29ba7bb63ff749c
\ No newline at end of file diff --git a/db/schema_migrations/20230723170936 b/db/schema_migrations/20230723170936 new file mode 100644 index 00000000000..6d84aba9d7f --- /dev/null +++ b/db/schema_migrations/20230723170936 @@ -0,0 +1 @@ +ddba4eb1ed3e9d0e75d693ef79c05acdedce04489650bcc9ba28a5e53e227132
\ No newline at end of file diff --git a/db/schema_migrations/20230723171006 b/db/schema_migrations/20230723171006 new file mode 100644 index 00000000000..6f2c8f47c0e --- /dev/null +++ b/db/schema_migrations/20230723171006 @@ -0,0 +1 @@ +a6bca8200327cd36475931f140ed84629eb0962215eb8adeb3eccf5c60b4b71a
\ No newline at end of file diff --git a/db/schema_migrations/20230723203612 b/db/schema_migrations/20230723203612 new file mode 100644 index 00000000000..43a9a02dddb --- /dev/null +++ b/db/schema_migrations/20230723203612 @@ -0,0 +1 @@ +2fbe6ccc23b398419e52a599b9c748a9d592d53369569e8b865d0ec1f4d99b0d
\ No newline at end of file diff --git a/db/schema_migrations/20230724071541 b/db/schema_migrations/20230724071541 new file mode 100644 index 00000000000..9760046215f --- /dev/null +++ b/db/schema_migrations/20230724071541 @@ -0,0 +1 @@ +3ace146e873db96f6dcb556e701339081620aa268f013979c9062b50957d9e13
\ No newline at end of file diff --git a/db/schema_migrations/20230724085146 b/db/schema_migrations/20230724085146 new file mode 100644 index 00000000000..47b5817d794 --- /dev/null +++ b/db/schema_migrations/20230724085146 @@ -0,0 +1 @@ +3523475202ec758dc33748af5c2e85392d1ab55af4a5c7f7b76412b6723d1bf6
\ No newline at end of file diff --git a/db/schema_migrations/20230724085149 b/db/schema_migrations/20230724085149 new file mode 100644 index 00000000000..e5e1a5f2461 --- /dev/null +++ b/db/schema_migrations/20230724085149 @@ -0,0 +1 @@ +e4236ae465987e86f4a68ee552856afe054dccf5b13c5d71abb72cad186266d1
\ No newline at end of file diff --git a/db/schema_migrations/20230724123547 b/db/schema_migrations/20230724123547 new file mode 100644 index 00000000000..b29f625de7e --- /dev/null +++ b/db/schema_migrations/20230724123547 @@ -0,0 +1 @@ +658cb25d5add4ad4e26d7baef6759f8512fa0244dd347b0522ad75ac496c9965
\ No newline at end of file diff --git a/db/schema_migrations/20230724150939 b/db/schema_migrations/20230724150939 new file mode 100644 index 00000000000..c3190c22f27 --- /dev/null +++ b/db/schema_migrations/20230724150939 @@ -0,0 +1 @@ +4047c6746335957fc3d274036e20a176080fb7aa695a98667ed9170370960212
\ No newline at end of file diff --git a/db/schema_migrations/20230724164745 b/db/schema_migrations/20230724164745 new file mode 100644 index 00000000000..dcc6d5ef80c --- /dev/null +++ b/db/schema_migrations/20230724164745 @@ -0,0 +1 @@ +30a0b3f8bf437471ec7eeaf95d6c033c8403fe23f540c45315e1326e63f4cad9
\ No newline at end of file diff --git a/db/schema_migrations/20230724185321 b/db/schema_migrations/20230724185321 new file mode 100644 index 00000000000..b5ffbeb5734 --- /dev/null +++ b/db/schema_migrations/20230724185321 @@ -0,0 +1 @@ +73dc6e44071a82ff0e6237eaf8619af20944ecb959de803779372138d63ee194
\ No newline at end of file diff --git a/db/schema_migrations/20230724212040 b/db/schema_migrations/20230724212040 new file mode 100644 index 00000000000..f404e1e6d09 --- /dev/null +++ b/db/schema_migrations/20230724212040 @@ -0,0 +1 @@ +ccd668aefe3e5f1a138be29a6084bd59d058c75ad268eeebba4db9bbf0f6ad7e
\ No newline at end of file diff --git a/db/schema_migrations/20230725035942 b/db/schema_migrations/20230725035942 new file mode 100644 index 00000000000..4584dd37211 --- /dev/null +++ b/db/schema_migrations/20230725035942 @@ -0,0 +1 @@ +9447f1376419aa2ab7df07a86ee18cd9f9de223a874f24c9b7177235712e768c
\ No newline at end of file diff --git a/db/schema_migrations/20230725075011 b/db/schema_migrations/20230725075011 new file mode 100644 index 00000000000..000b22e6902 --- /dev/null +++ b/db/schema_migrations/20230725075011 @@ -0,0 +1 @@ +db5e26187d86461e5f1b8b25d565479450642fcd53e6eb278015f7aef769e2e1
\ No newline at end of file diff --git a/db/schema_migrations/20230725085120 b/db/schema_migrations/20230725085120 new file mode 100644 index 00000000000..26f0ee27604 --- /dev/null +++ b/db/schema_migrations/20230725085120 @@ -0,0 +1 @@ +dd5ded7e27fd774358427427179eead1779ec11b9a3167758bde5c5c76db1715
\ No newline at end of file diff --git a/db/schema_migrations/20230725210728 b/db/schema_migrations/20230725210728 new file mode 100644 index 00000000000..97decc29d68 --- /dev/null +++ b/db/schema_migrations/20230725210728 @@ -0,0 +1 @@ +4e79291e9c775309fe2e843887cc669e3146f19305aaaecf1252f1525ff5e032
\ No newline at end of file diff --git a/db/schema_migrations/20230726024322 b/db/schema_migrations/20230726024322 new file mode 100644 index 00000000000..07cf70cbd6f --- /dev/null +++ b/db/schema_migrations/20230726024322 @@ -0,0 +1 @@ +29394a35335d42c959b5f8566e26787d6029e7d7a12706cc09d61129536eedcb
\ No newline at end of file diff --git a/db/schema_migrations/20230726072442 b/db/schema_migrations/20230726072442 new file mode 100644 index 00000000000..81d0080dfa7 --- /dev/null +++ b/db/schema_migrations/20230726072442 @@ -0,0 +1 @@ +8e3a03a08085c8cc882ce9e87846402ef49dc0a48e8f0c8980e8462337536674
\ No newline at end of file diff --git a/db/schema_migrations/20230726080527 b/db/schema_migrations/20230726080527 new file mode 100644 index 00000000000..5132d37dcb6 --- /dev/null +++ b/db/schema_migrations/20230726080527 @@ -0,0 +1 @@ +d81d8131fe9b4db7caad6333d34651b7da47de77ff0c0f586d51940d7caa6e8b
\ No newline at end of file diff --git a/db/schema_migrations/20230726080827 b/db/schema_migrations/20230726080827 new file mode 100644 index 00000000000..fb5bdd084f2 --- /dev/null +++ b/db/schema_migrations/20230726080827 @@ -0,0 +1 @@ +945bd34bf2ffe5372bd28dafcb16a27c2bbf3e7cb79fa75ceac9f093d8ff004b
\ No newline at end of file diff --git a/db/schema_migrations/20230726104022 b/db/schema_migrations/20230726104022 new file mode 100644 index 00000000000..ca48184b4a5 --- /dev/null +++ b/db/schema_migrations/20230726104022 @@ -0,0 +1 @@ +d11b25fc925acdd86fe8ba25347a45dac314cf1963dbdaa6da58f63ade92cd2c
\ No newline at end of file diff --git a/db/schema_migrations/20230726104547 b/db/schema_migrations/20230726104547 new file mode 100644 index 00000000000..7657a19078b --- /dev/null +++ b/db/schema_migrations/20230726104547 @@ -0,0 +1 @@ +d880367d09bb1e563ddc61727b9bf852782853b78b822039bcf59fde4a714cc3
\ No newline at end of file diff --git a/db/schema_migrations/20230726104616 b/db/schema_migrations/20230726104616 new file mode 100644 index 00000000000..dde68062a7c --- /dev/null +++ b/db/schema_migrations/20230726104616 @@ -0,0 +1 @@ +15bfb68b92824b905681fedae219caa92ddd8976d6178497a76e2714db872a08
\ No newline at end of file diff --git a/db/schema_migrations/20230726142141 b/db/schema_migrations/20230726142141 new file mode 100644 index 00000000000..06a2c51af4d --- /dev/null +++ b/db/schema_migrations/20230726142141 @@ -0,0 +1 @@ +bc333d824160ea4021d7c99c396097a84d29f94d2c606da75ee98ff39dbeafff
\ No newline at end of file diff --git a/db/schema_migrations/20230726201351 b/db/schema_migrations/20230726201351 new file mode 100644 index 00000000000..5c853a999ea --- /dev/null +++ b/db/schema_migrations/20230726201351 @@ -0,0 +1 @@ +03a51d3154a9e9a0b60375c75fe9289d59939187c0443f59ed22da95d446c134
\ No newline at end of file diff --git a/db/schema_migrations/20230726231029 b/db/schema_migrations/20230726231029 new file mode 100644 index 00000000000..6db951be302 --- /dev/null +++ b/db/schema_migrations/20230726231029 @@ -0,0 +1 @@ +0a8e2a1116e349879ad938264f1a40e996fc18c7c7b4c164b28b8d28cf1d7ee9
\ No newline at end of file diff --git a/db/schema_migrations/20230727084849 b/db/schema_migrations/20230727084849 new file mode 100644 index 00000000000..055effd61a1 --- /dev/null +++ b/db/schema_migrations/20230727084849 @@ -0,0 +1 @@ +6d5a0159ac860df6fa61df7d0021f0ee4b5d6d474a1e1ddbcf204ef9fae56d58
\ No newline at end of file diff --git a/db/schema_migrations/20230727091812 b/db/schema_migrations/20230727091812 new file mode 100644 index 00000000000..d53712b7e1f --- /dev/null +++ b/db/schema_migrations/20230727091812 @@ -0,0 +1 @@ +08bd3bce63a0926a991aa8dc5b5d97d3b2779b91a1f6600ecb3544b5fc2bc012
\ No newline at end of file diff --git a/db/schema_migrations/20230727092035 b/db/schema_migrations/20230727092035 new file mode 100644 index 00000000000..0ed7850e4fd --- /dev/null +++ b/db/schema_migrations/20230727092035 @@ -0,0 +1 @@ +d1514aaf710007c44c57add40fe70008426b2bde6638c2b7725934529a1bf907
\ No newline at end of file diff --git a/db/schema_migrations/20230727092425 b/db/schema_migrations/20230727092425 new file mode 100644 index 00000000000..ceebf49f233 --- /dev/null +++ b/db/schema_migrations/20230727092425 @@ -0,0 +1 @@ +85ba7931c55fb60beb753cc31c3782af9d7a6260599e8c9b2e52b843f45bf1ee
\ No newline at end of file diff --git a/db/schema_migrations/20230727102936 b/db/schema_migrations/20230727102936 new file mode 100644 index 00000000000..a07533f29c8 --- /dev/null +++ b/db/schema_migrations/20230727102936 @@ -0,0 +1 @@ +f71b5244de5b3ed97e38414b304df80fd94ce0855a624efd178ffedfa36dfd31
\ No newline at end of file diff --git a/db/schema_migrations/20230727103144 b/db/schema_migrations/20230727103144 new file mode 100644 index 00000000000..1d7b02fd330 --- /dev/null +++ b/db/schema_migrations/20230727103144 @@ -0,0 +1 @@ +09f9ee7ddf7153dbdb151f15a9de245d722a908b67b799da8a80f1bd9cb93c31
\ No newline at end of file diff --git a/db/schema_migrations/20230727115635 b/db/schema_migrations/20230727115635 new file mode 100644 index 00000000000..1e432fb2539 --- /dev/null +++ b/db/schema_migrations/20230727115635 @@ -0,0 +1 @@ +192ccfdaa3957d429ae546bf6cc38b92e9f39567ca860772fb7f777de1716cb4
\ No newline at end of file diff --git a/db/schema_migrations/20230727132342 b/db/schema_migrations/20230727132342 new file mode 100644 index 00000000000..c9ca8639120 --- /dev/null +++ b/db/schema_migrations/20230727132342 @@ -0,0 +1 @@ +e896540db12617f10f58ae18bd5790adcfe26098cba589de9f2a93f2507a6239
\ No newline at end of file diff --git a/db/schema_migrations/20230727144741 b/db/schema_migrations/20230727144741 new file mode 100644 index 00000000000..8d762d5db29 --- /dev/null +++ b/db/schema_migrations/20230727144741 @@ -0,0 +1 @@ +e2b2b76f54ee551e777aecbaefe51663d55ea2b305ffccc3acf5d8a2da351a63
\ No newline at end of file diff --git a/db/schema_migrations/20230727150416 b/db/schema_migrations/20230727150416 new file mode 100644 index 00000000000..ee9118a5dd3 --- /dev/null +++ b/db/schema_migrations/20230727150416 @@ -0,0 +1 @@ +4f12085655616744c4d322c09acebb97a565aee95a450e0a605ee9614557284d
\ No newline at end of file diff --git a/db/schema_migrations/20230727203840 b/db/schema_migrations/20230727203840 new file mode 100644 index 00000000000..cf392959479 --- /dev/null +++ b/db/schema_migrations/20230727203840 @@ -0,0 +1 @@ +259dbdf6d142a0af4c1761eef22e52965ebca63dc801c4b8ed9d885323f24eaa
\ No newline at end of file diff --git a/db/schema_migrations/20230728122928 b/db/schema_migrations/20230728122928 new file mode 100644 index 00000000000..7f1f6f735af --- /dev/null +++ b/db/schema_migrations/20230728122928 @@ -0,0 +1 @@ +47ccfbc79bcce6f7775e0713c2f4580f65df516e32355fa30c3a28cd9534505b
\ No newline at end of file diff --git a/db/schema_migrations/20230728134722 b/db/schema_migrations/20230728134722 new file mode 100644 index 00000000000..5436d98e58b --- /dev/null +++ b/db/schema_migrations/20230728134722 @@ -0,0 +1 @@ +ced67a2aadaf55341b07510b8df1bf386c955dfe60e023b712f543cd83307a58
\ No newline at end of file diff --git a/db/schema_migrations/20230728151058 b/db/schema_migrations/20230728151058 new file mode 100644 index 00000000000..fbd20a70cfb --- /dev/null +++ b/db/schema_migrations/20230728151058 @@ -0,0 +1 @@ +9e67e23ae5c84abd5217f25ce8b2a65d5ad611c68cd444c546bd4b0f45624530
\ No newline at end of file diff --git a/db/schema_migrations/20230728171609 b/db/schema_migrations/20230728171609 new file mode 100644 index 00000000000..7192de166d2 --- /dev/null +++ b/db/schema_migrations/20230728171609 @@ -0,0 +1 @@ +2e2c9416a8c60fc7273f732b2890ee84dcd864ff68a269a2ca1603e6bfaf4c31
\ No newline at end of file diff --git a/db/schema_migrations/20230728174927 b/db/schema_migrations/20230728174927 new file mode 100644 index 00000000000..aa826bb7186 --- /dev/null +++ b/db/schema_migrations/20230728174927 @@ -0,0 +1 @@ +5f796b08ce9888671e53dbdb7690d09518c714f442c94bd154cf568dee5afe99
\ No newline at end of file diff --git a/db/schema_migrations/20230728193736 b/db/schema_migrations/20230728193736 new file mode 100644 index 00000000000..5b02838e541 --- /dev/null +++ b/db/schema_migrations/20230728193736 @@ -0,0 +1 @@ +95c35da7b042c627c8abe1f23cc6287a034206eee4a716f213055dba0da26934
\ No newline at end of file diff --git a/db/schema_migrations/20230731090319 b/db/schema_migrations/20230731090319 new file mode 100644 index 00000000000..6849ff0f158 --- /dev/null +++ b/db/schema_migrations/20230731090319 @@ -0,0 +1 @@ +d3ec607d6efbc8f890648bad5ccaf84360ce0ba2417c0dfcb9b91eca08767cf4
\ No newline at end of file diff --git a/db/schema_migrations/20230731100513 b/db/schema_migrations/20230731100513 new file mode 100644 index 00000000000..4f83eaeb294 --- /dev/null +++ b/db/schema_migrations/20230731100513 @@ -0,0 +1 @@ +a85f3b493021cc27079dc07fe0ba5f11eeeca9798cf6ccdc60f7f7f7eae049af
\ No newline at end of file diff --git a/db/schema_migrations/20230731121354 b/db/schema_migrations/20230731121354 new file mode 100644 index 00000000000..c5770298707 --- /dev/null +++ b/db/schema_migrations/20230731121354 @@ -0,0 +1 @@ +e04e8910fdcf1f15522b80248771d3c3e6499eb64d233e29ed83ce0577cb3a98
\ No newline at end of file diff --git a/db/schema_migrations/20230731130351 b/db/schema_migrations/20230731130351 new file mode 100644 index 00000000000..b35240ee857 --- /dev/null +++ b/db/schema_migrations/20230731130351 @@ -0,0 +1 @@ +a68e6320db6c7d370aa72ccd0a262f989d9a2c1dd3b4c49fdae9dcb80fa04f59
\ No newline at end of file diff --git a/db/schema_migrations/20230731210422 b/db/schema_migrations/20230731210422 new file mode 100644 index 00000000000..10689aa1fba --- /dev/null +++ b/db/schema_migrations/20230731210422 @@ -0,0 +1 @@ +288e4e5aa1a26878372d79d562fa8d6b683394081ec4270152eaac6d99df2bac
\ No newline at end of file diff --git a/db/schema_migrations/20230801150214 b/db/schema_migrations/20230801150214 new file mode 100644 index 00000000000..a94dfb5bcbd --- /dev/null +++ b/db/schema_migrations/20230801150214 @@ -0,0 +1 @@ +34601628500574506908150f11a5705dd65b7b144e09b7cd8f60176fdaec43c8
\ No newline at end of file diff --git a/db/schema_migrations/20230802065830 b/db/schema_migrations/20230802065830 new file mode 100644 index 00000000000..18e459034a1 --- /dev/null +++ b/db/schema_migrations/20230802065830 @@ -0,0 +1 @@ +1bc56bc33ef336f4c97d15c8b726dad319a5775b8f8efa759bb14bb9a4db44eb
\ No newline at end of file diff --git a/db/schema_migrations/20230802070337 b/db/schema_migrations/20230802070337 new file mode 100644 index 00000000000..7defc6bb63d --- /dev/null +++ b/db/schema_migrations/20230802070337 @@ -0,0 +1 @@ +1b158b3191749032084d69f68e02f8aaddeb640ee10db4f1bb43041e4fd2d4ac
\ No newline at end of file diff --git a/db/schema_migrations/20230802085923 b/db/schema_migrations/20230802085923 new file mode 100644 index 00000000000..62145f3261e --- /dev/null +++ b/db/schema_migrations/20230802085923 @@ -0,0 +1 @@ +f96b1ce7addca2cb49faf339e3e92ac69a4ee98e1ff298393d2dafc375309909
\ No newline at end of file diff --git a/db/schema_migrations/20230802090519 b/db/schema_migrations/20230802090519 new file mode 100644 index 00000000000..e647c55550e --- /dev/null +++ b/db/schema_migrations/20230802090519 @@ -0,0 +1 @@ +b519b51d4ea2ba1abd49a986163e7b7b6900770a99f6b7223e66359fb00983b2
\ No newline at end of file diff --git a/db/schema_migrations/20230802092922 b/db/schema_migrations/20230802092922 new file mode 100644 index 00000000000..7c00327103a --- /dev/null +++ b/db/schema_migrations/20230802092922 @@ -0,0 +1 @@ +e43d57a88d6dce76867753e349850c7d405397c3356b263ced5ffb47922850f1
\ No newline at end of file diff --git a/db/schema_migrations/20230802124027 b/db/schema_migrations/20230802124027 new file mode 100644 index 00000000000..03a208d4817 --- /dev/null +++ b/db/schema_migrations/20230802124027 @@ -0,0 +1 @@ +01111bb2594364e38a15fabbebdf9d73bbbf831fc270ff0f033b5f4659326eaa
\ No newline at end of file diff --git a/db/schema_migrations/20230803125434 b/db/schema_migrations/20230803125434 new file mode 100644 index 00000000000..5248d3f41c3 --- /dev/null +++ b/db/schema_migrations/20230803125434 @@ -0,0 +1 @@ +e775635caa9cf30a48474d5b2dd5e2023d112546e168be8a27ee0f7b16890ad0
\ No newline at end of file diff --git a/db/schema_migrations/20230804053643 b/db/schema_migrations/20230804053643 new file mode 100644 index 00000000000..73d57848407 --- /dev/null +++ b/db/schema_migrations/20230804053643 @@ -0,0 +1 @@ +b43f49777ced6b731662cf87af0c0ba31abc4bf21eab7592ba6d8bc9cd4d2f9b
\ No newline at end of file diff --git a/db/schema_migrations/20230804064817 b/db/schema_migrations/20230804064817 new file mode 100644 index 00000000000..47516d38feb --- /dev/null +++ b/db/schema_migrations/20230804064817 @@ -0,0 +1 @@ +5a327f06245cec54c72328bd688900ad36a2a58443d6f888103009d03162d157
\ No newline at end of file diff --git a/db/schema_migrations/20230804065052 b/db/schema_migrations/20230804065052 new file mode 100644 index 00000000000..81bd82cf1fd --- /dev/null +++ b/db/schema_migrations/20230804065052 @@ -0,0 +1 @@ +49a6a3f3f9991355ef28ff4d5ec8777f3ec5de7badc7150638e4a8eda2550a07
\ No newline at end of file diff --git a/db/schema_migrations/20230804121704 b/db/schema_migrations/20230804121704 new file mode 100644 index 00000000000..1444b9cc9a3 --- /dev/null +++ b/db/schema_migrations/20230804121704 @@ -0,0 +1 @@ +ea9fa68d5b4001cc4fc8bbcdba5183bfaee216844c87811d2f9d45d008495ee6
\ No newline at end of file diff --git a/db/schema_migrations/20230804121705 b/db/schema_migrations/20230804121705 new file mode 100644 index 00000000000..df3f45a34ed --- /dev/null +++ b/db/schema_migrations/20230804121705 @@ -0,0 +1 @@ +70c78a39fdfe0889a2a5e9adc16f4aeed343b83ff7009d29b303c866e7681740
\ No newline at end of file diff --git a/db/schema_migrations/20230804133028 b/db/schema_migrations/20230804133028 new file mode 100644 index 00000000000..5f8148ae308 --- /dev/null +++ b/db/schema_migrations/20230804133028 @@ -0,0 +1 @@ +e63bf851a7a66f8aa0823e5c8f41eba3829494081dda54e7e39b265b0676d4da
\ No newline at end of file diff --git a/db/schema_migrations/20230804141257 b/db/schema_migrations/20230804141257 new file mode 100644 index 00000000000..a1ef7320f7a --- /dev/null +++ b/db/schema_migrations/20230804141257 @@ -0,0 +1 @@ +2ba47bc978866f2c6fc2ce154a9ef7229101411da7671ed709cdac4de837d659
\ No newline at end of file diff --git a/db/schema_migrations/20230804141550 b/db/schema_migrations/20230804141550 new file mode 100644 index 00000000000..464d17407a8 --- /dev/null +++ b/db/schema_migrations/20230804141550 @@ -0,0 +1 @@ +78697d628098801e9e2aabce4959bae6d28edc297360fb935301364c3c2085d2
\ No newline at end of file diff --git a/db/schema_migrations/20230807083334 b/db/schema_migrations/20230807083334 new file mode 100644 index 00000000000..3851d65d681 --- /dev/null +++ b/db/schema_migrations/20230807083334 @@ -0,0 +1 @@ +182c43606c01958ca22df9565bddfad174d464e9946a1ac5a4a81bdbede5d768
\ No newline at end of file diff --git a/db/schema_migrations/20230807085752 b/db/schema_migrations/20230807085752 new file mode 100644 index 00000000000..ae2b041fc7c --- /dev/null +++ b/db/schema_migrations/20230807085752 @@ -0,0 +1 @@ +5bcb3c38cad89f3f06c7583bbdda8d7bdf48d987ce57fb14cac606191380b392
\ No newline at end of file diff --git a/db/schema_migrations/20230807101745 b/db/schema_migrations/20230807101745 new file mode 100644 index 00000000000..fd952d8a45a --- /dev/null +++ b/db/schema_migrations/20230807101745 @@ -0,0 +1 @@ +438ec650c1a80ab1b52a83653c67b6f871b5ea49b7d5bfbc62dcbb98b74c6514
\ No newline at end of file diff --git a/db/schema_migrations/20230807105131 b/db/schema_migrations/20230807105131 new file mode 100644 index 00000000000..d7a6197f851 --- /dev/null +++ b/db/schema_migrations/20230807105131 @@ -0,0 +1 @@ +382b03581eb197643900ecf817141031497d5e2f8b59479e6f6a826d0f5c0ab9
\ No newline at end of file diff --git a/db/schema_migrations/20230807202427 b/db/schema_migrations/20230807202427 new file mode 100644 index 00000000000..7c3979533e8 --- /dev/null +++ b/db/schema_migrations/20230807202427 @@ -0,0 +1 @@ +479182c1a96d0c827e9de927f529ebaa447fcd3811619d53da4cd52b3462ea21
\ No newline at end of file diff --git a/db/schema_migrations/20230808123101 b/db/schema_migrations/20230808123101 new file mode 100644 index 00000000000..fc216bcd651 --- /dev/null +++ b/db/schema_migrations/20230808123101 @@ -0,0 +1 @@ +a6d1407e0b01cb6b87b84e05e8c054daa8a36265dc2fd3457f60efdd71813ce9
\ No newline at end of file diff --git a/db/schema_migrations/20230808123136 b/db/schema_migrations/20230808123136 new file mode 100644 index 00000000000..7ce93e8d1c3 --- /dev/null +++ b/db/schema_migrations/20230808123136 @@ -0,0 +1 @@ +184d082289e04f22a52787b617c712c684d97c4a9b4c5812798adf9b669299cd
\ No newline at end of file diff --git a/db/schema_migrations/20230808135706 b/db/schema_migrations/20230808135706 new file mode 100644 index 00000000000..4c208369bed --- /dev/null +++ b/db/schema_migrations/20230808135706 @@ -0,0 +1 @@ +bfbccb5da8ee57e5789f4aa6671e2f9c479bfbce9b7627a70af2650a64defff6
\ No newline at end of file diff --git a/db/schema_migrations/20230808135859 b/db/schema_migrations/20230808135859 new file mode 100644 index 00000000000..41c16692865 --- /dev/null +++ b/db/schema_migrations/20230808135859 @@ -0,0 +1 @@ +1f03ce0f01ddd47fb9092b270771a3ec12fcdbd478c5cc90f90b9cab4688023a
\ No newline at end of file diff --git a/db/schema_migrations/20230808140338 b/db/schema_migrations/20230808140338 new file mode 100644 index 00000000000..0de053dbfa4 --- /dev/null +++ b/db/schema_migrations/20230808140338 @@ -0,0 +1 @@ +f1a85a0ff5f98f20af6ba9785df591bdebe7bf1fdbed15efdbbf34e93287881b
\ No newline at end of file diff --git a/db/schema_migrations/20230808170646 b/db/schema_migrations/20230808170646 new file mode 100644 index 00000000000..80f454148e1 --- /dev/null +++ b/db/schema_migrations/20230808170646 @@ -0,0 +1 @@ +e641285671d775a8aee8911a5775718a546c88a9a970ba99e3631ff88a8a9d4d
\ No newline at end of file diff --git a/db/schema_migrations/20230809011700 b/db/schema_migrations/20230809011700 new file mode 100644 index 00000000000..5104f7fdf94 --- /dev/null +++ b/db/schema_migrations/20230809011700 @@ -0,0 +1 @@ +523fb5ebd7655b0b955c47a0e71919654c08d4e57b8d701f03bf0d4a97d412af
\ No newline at end of file diff --git a/db/schema_migrations/20230809090349 b/db/schema_migrations/20230809090349 new file mode 100644 index 00000000000..4ed6a71b429 --- /dev/null +++ b/db/schema_migrations/20230809090349 @@ -0,0 +1 @@ +45c2aeda5ea7ef5422974f85b900cc871e056a04f32733da7e45e202bac4d701
\ No newline at end of file diff --git a/db/schema_migrations/20230809104007 b/db/schema_migrations/20230809104007 new file mode 100644 index 00000000000..ce6be16c854 --- /dev/null +++ b/db/schema_migrations/20230809104007 @@ -0,0 +1 @@ +2c5718cdc1da47dfef22afe13b66bab779fcd3da9284b3042066c5d6c1d74e60
\ No newline at end of file diff --git a/db/schema_migrations/20230809104753 b/db/schema_migrations/20230809104753 new file mode 100644 index 00000000000..070247f5daf --- /dev/null +++ b/db/schema_migrations/20230809104753 @@ -0,0 +1 @@ +78e90f3af35328bc54438774e57f1ce0f71946c3eb6c6bac175e9f15da3e0113
\ No newline at end of file diff --git a/db/schema_migrations/20230809133249 b/db/schema_migrations/20230809133249 new file mode 100644 index 00000000000..0b4fb9cd793 --- /dev/null +++ b/db/schema_migrations/20230809133249 @@ -0,0 +1 @@ +0e710bdbd00626f66ede91b8782f8049743b5bf1e91b90e32eb733bcd159383c
\ No newline at end of file diff --git a/db/schema_migrations/20230809140938 b/db/schema_migrations/20230809140938 new file mode 100644 index 00000000000..a2a3439bbdc --- /dev/null +++ b/db/schema_migrations/20230809140938 @@ -0,0 +1 @@ +27897e0b43bcc6cfdc7d2b2be484094631e1b0af4e1b7c3edba17dc27ff8a240
\ No newline at end of file diff --git a/db/schema_migrations/20230809165212 b/db/schema_migrations/20230809165212 new file mode 100644 index 00000000000..72d1751c42e --- /dev/null +++ b/db/schema_migrations/20230809165212 @@ -0,0 +1 @@ +4137f5af1cb4a00144afecac7ad99e926be4f5a8fa501faaab00f4f017c90cf6
\ No newline at end of file diff --git a/db/schema_migrations/20230809165213 b/db/schema_migrations/20230809165213 new file mode 100644 index 00000000000..c0bcff0566e --- /dev/null +++ b/db/schema_migrations/20230809165213 @@ -0,0 +1 @@ +cdab5ff65d93b1883bd75c60efa21ce03031b2678f4535ae2a50a6ca4377c32d
\ No newline at end of file diff --git a/db/schema_migrations/20230809192256 b/db/schema_migrations/20230809192256 new file mode 100644 index 00000000000..3ccbe859dc4 --- /dev/null +++ b/db/schema_migrations/20230809192256 @@ -0,0 +1 @@ +2dd7b10298b2b4f81755faa2f56a6362739ea9c34508758731be8512e1f44532
\ No newline at end of file diff --git a/db/schema_migrations/20230810103141 b/db/schema_migrations/20230810103141 new file mode 100644 index 00000000000..7174633ba72 --- /dev/null +++ b/db/schema_migrations/20230810103141 @@ -0,0 +1 @@ +494af6d42a1ad5f8a5680bf983c5ec34bb7df7a4d863f435109e2375bba3fa31
\ No newline at end of file diff --git a/db/schema_migrations/20230810103534 b/db/schema_migrations/20230810103534 new file mode 100644 index 00000000000..1c5267af28b --- /dev/null +++ b/db/schema_migrations/20230810103534 @@ -0,0 +1 @@ +67daf5d01957f1e7eed31ff9fb56cb4b46136c4adaeb087e56bbbf21f364d4f7
\ No newline at end of file diff --git a/db/schema_migrations/20230810122746 b/db/schema_migrations/20230810122746 new file mode 100644 index 00000000000..d01aefb0adb --- /dev/null +++ b/db/schema_migrations/20230810122746 @@ -0,0 +1 @@ +f6d27984abf50fb2d054b8fda87b5e1a100b8863d3528c20835540dde34148cd
\ No newline at end of file diff --git a/db/schema_migrations/20230810123044 b/db/schema_migrations/20230810123044 new file mode 100644 index 00000000000..3c1e3be4ae9 --- /dev/null +++ b/db/schema_migrations/20230810123044 @@ -0,0 +1 @@ +efb09d8b2631de0d65a4a1f35be58a5c81bacd9c462e5a7c7be348fa606ae89d
\ No newline at end of file diff --git a/db/schema_migrations/20230810132301 b/db/schema_migrations/20230810132301 new file mode 100644 index 00000000000..1ce50b71d72 --- /dev/null +++ b/db/schema_migrations/20230810132301 @@ -0,0 +1 @@ +51c1d8522abb41991ff3c05b1f6799bab24586c25efc6c2f5209a9a440475565
\ No newline at end of file diff --git a/db/schema_migrations/20230811103654 b/db/schema_migrations/20230811103654 new file mode 100644 index 00000000000..2a2e193774d --- /dev/null +++ b/db/schema_migrations/20230811103654 @@ -0,0 +1 @@ +07526a26b92d6a6948dc9fe7a685498d0f1eff69d740b5820cbceb05d7f910bd
\ No newline at end of file diff --git a/db/schema_migrations/20230811103941 b/db/schema_migrations/20230811103941 new file mode 100644 index 00000000000..6c5f3478362 --- /dev/null +++ b/db/schema_migrations/20230811103941 @@ -0,0 +1 @@ +d3e31a4a0428141813d5e43a87ce0c11913aac482b95360cf6ed110c6c2e8891
\ No newline at end of file diff --git a/db/schema_migrations/20230811145848 b/db/schema_migrations/20230811145848 new file mode 100644 index 00000000000..8aac90ce722 --- /dev/null +++ b/db/schema_migrations/20230811145848 @@ -0,0 +1 @@ +d97af224c290fa6a16b6c855e51e7f65a64301c70ec7e222e1db76a6501ca341
\ No newline at end of file diff --git a/db/schema_migrations/20230811150636 b/db/schema_migrations/20230811150636 new file mode 100644 index 00000000000..d0e166030aa --- /dev/null +++ b/db/schema_migrations/20230811150636 @@ -0,0 +1 @@ +311166d35fd7d55c27146309637e8ac8dafc1ad2988a6da7f6d1105f0368248d
\ No newline at end of file diff --git a/db/schema_migrations/20230814055259 b/db/schema_migrations/20230814055259 new file mode 100644 index 00000000000..efd8763f764 --- /dev/null +++ b/db/schema_migrations/20230814055259 @@ -0,0 +1 @@ +3edb1f4c37e521eae6c8434b3f5a2c9c0b31a556ca0148d4448c0e2803bb8cfc
\ No newline at end of file diff --git a/db/schema_migrations/20230814055310 b/db/schema_migrations/20230814055310 new file mode 100644 index 00000000000..c5892e40ce8 --- /dev/null +++ b/db/schema_migrations/20230814055310 @@ -0,0 +1 @@ +0192d99bedbcd66734bb268aa01d6e60bf16c602af81aa7e4568d6eed30ee34c
\ No newline at end of file diff --git a/db/schema_migrations/20230814143925 b/db/schema_migrations/20230814143925 new file mode 100644 index 00000000000..10c8735261c --- /dev/null +++ b/db/schema_migrations/20230814143925 @@ -0,0 +1 @@ +c989cd075bd3bc9a0da0b93c8c1f752dba99fdd6b10d9f40ce067e33acf073e6
\ No newline at end of file diff --git a/db/schema_migrations/20230814144045 b/db/schema_migrations/20230814144045 new file mode 100644 index 00000000000..77d5233f26d --- /dev/null +++ b/db/schema_migrations/20230814144045 @@ -0,0 +1 @@ +0e3bdf3e607f5b9a1d842b2958c663a7be490d0d283d32444bedc11ed3e8b712
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 408d9d851aa..9555b61a16e 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10,6 +10,19 @@ CREATE EXTENSION IF NOT EXISTS btree_gist; CREATE EXTENSION IF NOT EXISTS pg_trgm; +CREATE FUNCTION assign_p_ci_builds_id_value() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN +IF NEW."id" IS NOT NULL THEN + RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored'; +END IF; +NEW."id" := nextval('ci_builds_id_seq'::regclass); +RETURN NEW; + +END +$$; + CREATE FUNCTION delete_associated_project_namespace() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -249,6 +262,30 @@ RETURN NULL; END $$; +CREATE FUNCTION set_has_merge_request_on_vulnerability_reads() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN +UPDATE + vulnerability_reads +SET + has_merge_request = true +WHERE + vulnerability_id = NEW.vulnerability_id AND has_merge_request IS FALSE; +RETURN NULL; + +END +$$; + +CREATE FUNCTION trigger_07bc3c48f407() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."pipeline_id_convert_to_bigint" := NEW."pipeline_id"; + RETURN NEW; +END; +$$; + CREATE FUNCTION trigger_1a857e8db6cd() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -258,6 +295,34 @@ BEGIN END; $$; +CREATE FUNCTION trigger_1bd97da9c1a4() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."auto_canceled_by_id_convert_to_bigint" := NEW."auto_canceled_by_id"; + RETURN NEW; +END; +$$; + +CREATE FUNCTION trigger_239c8032a8d6() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."pipeline_id_convert_to_bigint" := NEW."pipeline_id"; + RETURN NEW; +END; +$$; + +CREATE FUNCTION trigger_68d7b6653c7d() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."pipeline_id_convert_to_bigint" := NEW."pipeline_id"; + NEW."source_pipeline_id_convert_to_bigint" := NEW."source_pipeline_id"; + RETURN NEW; +END; +$$; + CREATE FUNCTION trigger_7f3d66a7d7f5() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -276,11 +341,11 @@ BEGIN END; $$; -CREATE FUNCTION trigger_cd1aeb22b34a() RETURNS trigger +CREATE FUNCTION trigger_bfad0e2b9c86() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN - NEW."target_id_convert_to_bigint" := NEW."target_id"; + NEW."pipeline_id_convert_to_bigint" := NEW."pipeline_id"; RETURN NEW; END; $$; @@ -315,6 +380,36 @@ BEGIN END $$; +CREATE FUNCTION unset_has_merge_request_on_vulnerability_reads() RETURNS trigger + LANGUAGE plpgsql + AS $$ +DECLARE + has_merge_request_links integer; +BEGIN + PERFORM 1 + FROM + vulnerability_reads + WHERE + vulnerability_id = OLD.vulnerability_id + FOR UPDATE; + + SELECT 1 INTO has_merge_request_links FROM vulnerability_merge_request_links WHERE vulnerability_id = OLD.vulnerability_id LIMIT 1; + + IF (has_merge_request_links = 1) THEN + RETURN NULL; + END IF; + + UPDATE + vulnerability_reads + SET + has_merge_request = false + WHERE + vulnerability_id = OLD.vulnerability_id; + + RETURN NULL; +END +$$; + CREATE FUNCTION update_location_from_vulnerability_occurrences() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -501,6 +596,18 @@ CREATE TABLE loose_foreign_keys_deleted_records ( ) PARTITION BY LIST (partition); +CREATE TABLE p_batched_git_ref_updates_deletions ( + id bigint NOT NULL, + project_id bigint NOT NULL, + partition_id bigint DEFAULT 1 NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + status smallint DEFAULT 1 NOT NULL, + ref text NOT NULL, + CONSTRAINT check_f322d53b92 CHECK ((char_length(ref) <= 1024)) +) +PARTITION BY LIST (partition_id); + CREATE TABLE security_findings ( id bigint NOT NULL, scan_id bigint NOT NULL, @@ -1421,7 +1528,8 @@ CREATE TABLE issue_search_data ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ) PARTITION BY HASH (project_id); @@ -1430,7 +1538,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_00 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_00 FOR VALUES WITH (modulus 64, remainder 0); @@ -1439,7 +1548,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_01 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_01 FOR VALUES WITH (modulus 64, remainder 1); @@ -1448,7 +1558,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_02 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_02 FOR VALUES WITH (modulus 64, remainder 2); @@ -1457,7 +1568,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_03 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_03 FOR VALUES WITH (modulus 64, remainder 3); @@ -1466,7 +1578,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_04 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_04 FOR VALUES WITH (modulus 64, remainder 4); @@ -1475,7 +1588,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_05 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_05 FOR VALUES WITH (modulus 64, remainder 5); @@ -1484,7 +1598,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_06 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_06 FOR VALUES WITH (modulus 64, remainder 6); @@ -1493,7 +1608,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_07 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_07 FOR VALUES WITH (modulus 64, remainder 7); @@ -1502,7 +1618,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_08 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_08 FOR VALUES WITH (modulus 64, remainder 8); @@ -1511,7 +1628,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_09 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_09 FOR VALUES WITH (modulus 64, remainder 9); @@ -1520,7 +1638,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_10 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_10 FOR VALUES WITH (modulus 64, remainder 10); @@ -1529,7 +1648,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_11 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_11 FOR VALUES WITH (modulus 64, remainder 11); @@ -1538,7 +1658,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_12 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_12 FOR VALUES WITH (modulus 64, remainder 12); @@ -1547,7 +1668,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_13 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_13 FOR VALUES WITH (modulus 64, remainder 13); @@ -1556,7 +1678,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_14 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_14 FOR VALUES WITH (modulus 64, remainder 14); @@ -1565,7 +1688,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_15 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_15 FOR VALUES WITH (modulus 64, remainder 15); @@ -1574,7 +1698,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_16 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_16 FOR VALUES WITH (modulus 64, remainder 16); @@ -1583,7 +1708,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_17 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_17 FOR VALUES WITH (modulus 64, remainder 17); @@ -1592,7 +1718,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_18 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_18 FOR VALUES WITH (modulus 64, remainder 18); @@ -1601,7 +1728,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_19 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_19 FOR VALUES WITH (modulus 64, remainder 19); @@ -1610,7 +1738,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_20 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_20 FOR VALUES WITH (modulus 64, remainder 20); @@ -1619,7 +1748,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_21 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_21 FOR VALUES WITH (modulus 64, remainder 21); @@ -1628,7 +1758,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_22 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_22 FOR VALUES WITH (modulus 64, remainder 22); @@ -1637,7 +1768,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_23 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_23 FOR VALUES WITH (modulus 64, remainder 23); @@ -1646,7 +1778,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_24 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_24 FOR VALUES WITH (modulus 64, remainder 24); @@ -1655,7 +1788,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_25 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_25 FOR VALUES WITH (modulus 64, remainder 25); @@ -1664,7 +1798,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_26 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_26 FOR VALUES WITH (modulus 64, remainder 26); @@ -1673,7 +1808,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_27 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_27 FOR VALUES WITH (modulus 64, remainder 27); @@ -1682,7 +1818,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_28 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_28 FOR VALUES WITH (modulus 64, remainder 28); @@ -1691,7 +1828,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_29 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_29 FOR VALUES WITH (modulus 64, remainder 29); @@ -1700,7 +1838,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_30 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_30 FOR VALUES WITH (modulus 64, remainder 30); @@ -1709,7 +1848,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_31 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_31 FOR VALUES WITH (modulus 64, remainder 31); @@ -1718,7 +1858,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_32 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_32 FOR VALUES WITH (modulus 64, remainder 32); @@ -1727,7 +1868,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_33 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_33 FOR VALUES WITH (modulus 64, remainder 33); @@ -1736,7 +1878,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_34 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_34 FOR VALUES WITH (modulus 64, remainder 34); @@ -1745,7 +1888,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_35 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_35 FOR VALUES WITH (modulus 64, remainder 35); @@ -1754,7 +1898,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_36 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_36 FOR VALUES WITH (modulus 64, remainder 36); @@ -1763,7 +1908,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_37 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_37 FOR VALUES WITH (modulus 64, remainder 37); @@ -1772,7 +1918,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_38 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_38 FOR VALUES WITH (modulus 64, remainder 38); @@ -1781,7 +1928,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_39 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_39 FOR VALUES WITH (modulus 64, remainder 39); @@ -1790,7 +1938,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_40 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_40 FOR VALUES WITH (modulus 64, remainder 40); @@ -1799,7 +1948,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_41 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_41 FOR VALUES WITH (modulus 64, remainder 41); @@ -1808,7 +1958,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_42 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_42 FOR VALUES WITH (modulus 64, remainder 42); @@ -1817,7 +1968,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_43 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_43 FOR VALUES WITH (modulus 64, remainder 43); @@ -1826,7 +1978,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_44 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_44 FOR VALUES WITH (modulus 64, remainder 44); @@ -1835,7 +1988,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_45 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_45 FOR VALUES WITH (modulus 64, remainder 45); @@ -1844,7 +1998,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_46 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_46 FOR VALUES WITH (modulus 64, remainder 46); @@ -1853,7 +2008,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_47 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_47 FOR VALUES WITH (modulus 64, remainder 47); @@ -1862,7 +2018,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_48 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_48 FOR VALUES WITH (modulus 64, remainder 48); @@ -1871,7 +2028,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_49 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_49 FOR VALUES WITH (modulus 64, remainder 49); @@ -1880,7 +2038,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_50 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_50 FOR VALUES WITH (modulus 64, remainder 50); @@ -1889,7 +2048,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_51 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_51 FOR VALUES WITH (modulus 64, remainder 51); @@ -1898,7 +2058,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_52 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_52 FOR VALUES WITH (modulus 64, remainder 52); @@ -1907,7 +2068,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_53 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_53 FOR VALUES WITH (modulus 64, remainder 53); @@ -1916,7 +2078,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_54 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_54 FOR VALUES WITH (modulus 64, remainder 54); @@ -1925,7 +2088,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_55 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_55 FOR VALUES WITH (modulus 64, remainder 55); @@ -1934,7 +2098,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_56 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_56 FOR VALUES WITH (modulus 64, remainder 56); @@ -1943,7 +2108,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_57 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_57 FOR VALUES WITH (modulus 64, remainder 57); @@ -1952,7 +2118,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_58 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_58 FOR VALUES WITH (modulus 64, remainder 58); @@ -1961,7 +2128,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_59 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_59 FOR VALUES WITH (modulus 64, remainder 59); @@ -1970,7 +2138,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_60 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_60 FOR VALUES WITH (modulus 64, remainder 60); @@ -1979,7 +2148,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_61 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_61 FOR VALUES WITH (modulus 64, remainder 61); @@ -1988,7 +2158,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_62 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_62 FOR VALUES WITH (modulus 64, remainder 62); @@ -1997,7 +2168,8 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_63 ( issue_id bigint NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, - search_vector tsvector + search_vector tsvector, + namespace_id bigint ); ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_63 FOR VALUES WITH (modulus 64, remainder 63); @@ -11720,7 +11892,6 @@ CREATE TABLE application_settings ( lock_memberships_to_saml boolean DEFAULT false NOT NULL, gitlab_dedicated_instance boolean DEFAULT false NOT NULL, update_runner_versions_enabled boolean DEFAULT true NOT NULL, - database_apdex_settings jsonb, encrypted_openai_api_key bytea, encrypted_openai_api_key_iv bytea, database_max_running_batched_background_migrations integer DEFAULT 2 NOT NULL, @@ -11729,26 +11900,6 @@ CREATE TABLE application_settings ( silent_mode_enabled boolean DEFAULT false NOT NULL, package_metadata_purl_types smallint[] DEFAULT '{}'::smallint[], ci_max_includes integer DEFAULT 150 NOT NULL, - encrypted_tofa_host bytea, - encrypted_tofa_host_iv bytea, - encrypted_tofa_url bytea, - encrypted_tofa_url_iv bytea, - encrypted_tofa_response_json_keys bytea, - encrypted_tofa_response_json_keys_iv bytea, - encrypted_tofa_request_json_keys bytea, - encrypted_tofa_request_json_keys_iv bytea, - encrypted_tofa_request_payload bytea, - encrypted_tofa_request_payload_iv bytea, - encrypted_tofa_client_library_class bytea, - encrypted_tofa_client_library_class_iv bytea, - encrypted_tofa_client_library_args bytea, - encrypted_tofa_client_library_args_iv bytea, - encrypted_tofa_client_library_create_credentials_method bytea, - encrypted_tofa_client_library_create_credentials_method_iv bytea, - encrypted_tofa_client_library_fetch_access_token_method bytea, - encrypted_tofa_client_library_fetch_access_token_method_iv bytea, - encrypted_tofa_access_token_expires_in bytea, - encrypted_tofa_access_token_expires_in_iv bytea, remember_me_enabled boolean DEFAULT true NOT NULL, encrypted_anthropic_api_key bytea, encrypted_anthropic_api_key_iv bytea, @@ -11773,16 +11924,26 @@ CREATE TABLE application_settings ( elasticsearch_worker_number_of_shards integer DEFAULT 2 NOT NULL, relay_state_domain_allowlist text[] DEFAULT '{}'::text[] NOT NULL, namespace_storage_forks_cost_factor double precision DEFAULT 1.0 NOT NULL, + package_registry_allow_anyone_to_pull_option boolean DEFAULT true NOT NULL, + bulk_import_max_download_file_size bigint DEFAULT 5120 NOT NULL, + max_import_remote_file_size bigint DEFAULT 10240 NOT NULL, + sentry_clientside_traces_sample_rate double precision DEFAULT 0.0 NOT NULL, + protected_paths_for_get_request text[] DEFAULT '{}'::text[] NOT NULL, + max_decompressed_archive_size integer DEFAULT 25600 NOT NULL, + ci_max_total_yaml_size_bytes integer DEFAULT 157286400 NOT NULL, + prometheus_alert_db_indicators_settings jsonb, 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_git_rate_limit_users_alertlist_max_usernames CHECK ((cardinality(git_rate_limit_users_alertlist) <= 100)), CONSTRAINT app_settings_git_rate_limit_users_allowlist_max_usernames CHECK ((cardinality(git_rate_limit_users_allowlist) <= 100)), + CONSTRAINT app_settings_max_decompressed_archive_size_positive CHECK ((max_decompressed_archive_size >= 0)), CONSTRAINT app_settings_max_pages_custom_domains_per_project_check CHECK ((max_pages_custom_domains_per_project >= 0)), CONSTRAINT app_settings_max_terraform_state_size_bytes_check CHECK ((max_terraform_state_size_bytes >= 0)), CONSTRAINT app_settings_p_cleanup_package_file_worker_capacity_positive CHECK ((packages_cleanup_package_file_worker_capacity >= 0)), CONSTRAINT app_settings_pkg_registry_cleanup_pol_worker_capacity_gte_zero CHECK ((package_registry_cleanup_policies_worker_capacity >= 0)), + CONSTRAINT app_settings_protected_paths_max_length CHECK ((cardinality(protected_paths_for_get_request) <= 100)), CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), CONSTRAINT app_settings_registry_repair_worker_max_concurrency_positive CHECK ((container_registry_data_repair_detail_worker_max_concurrency >= 0)), CONSTRAINT app_settings_yaml_max_depth_positive CHECK ((max_yaml_depth > 0)), @@ -11817,6 +11978,7 @@ CREATE TABLE application_settings ( CONSTRAINT check_a5704163cc CHECK ((char_length(secret_detection_revocation_token_types_url) <= 255)), CONSTRAINT check_ae53cf7f82 CHECK ((char_length(vertex_ai_host) <= 255)), CONSTRAINT check_app_settings_namespace_storage_forks_cost_factor_range CHECK (((namespace_storage_forks_cost_factor >= (0)::double precision) AND (namespace_storage_forks_cost_factor <= (1)::double precision))), + CONSTRAINT check_app_settings_sentry_clientside_traces_sample_rate_range CHECK (((sentry_clientside_traces_sample_rate >= (0)::double precision) AND (sentry_clientside_traces_sample_rate <= (1)::double precision))), CONSTRAINT check_b8c74ea5b3 CHECK ((char_length(deactivation_email_additional_text) <= 1000)), CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)), CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)), @@ -12153,9 +12315,11 @@ CREATE TABLE audit_events_google_cloud_logging_configurations ( log_id_name text DEFAULT 'audit_events'::text, encrypted_private_key bytea NOT NULL, encrypted_private_key_iv bytea NOT NULL, + name text NOT NULL, CONSTRAINT check_0ef835c61e CHECK ((char_length(client_email) <= 254)), CONSTRAINT check_55783c7c19 CHECK ((char_length(google_project_id_name) <= 30)), - CONSTRAINT check_898a76b005 CHECK ((char_length(log_id_name) <= 511)) + CONSTRAINT check_898a76b005 CHECK ((char_length(log_id_name) <= 511)), + CONSTRAINT check_cdf6883cd6 CHECK ((char_length(name) <= 72)) ); CREATE SEQUENCE audit_events_google_cloud_logging_configurations_id_seq @@ -12222,6 +12386,7 @@ CREATE TABLE audit_events_streaming_headers ( external_audit_event_destination_id bigint NOT NULL, key text NOT NULL, value text NOT NULL, + active boolean DEFAULT true NOT NULL, CONSTRAINT check_53c3152034 CHECK ((char_length(key) <= 255)), CONSTRAINT check_ac213cca22 CHECK ((char_length(value) <= 255)) ); @@ -12934,6 +13099,44 @@ CREATE SEQUENCE bulk_imports_id_seq ALTER SEQUENCE bulk_imports_id_seq OWNED BY bulk_imports.id; +CREATE TABLE catalog_resource_components ( + id bigint NOT NULL, + catalog_resource_id bigint NOT NULL, + version_id bigint NOT NULL, + project_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + resource_type smallint DEFAULT 1 NOT NULL, + inputs jsonb DEFAULT '{}'::jsonb NOT NULL, + name text NOT NULL, + CONSTRAINT check_ddca729980 CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE catalog_resource_components_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE catalog_resource_components_id_seq OWNED BY catalog_resource_components.id; + +CREATE TABLE catalog_resource_versions ( + id bigint NOT NULL, + release_id bigint NOT NULL, + catalog_resource_id bigint NOT NULL, + project_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE catalog_resource_versions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE catalog_resource_versions_id_seq OWNED BY catalog_resource_versions.id; + CREATE TABLE catalog_resources ( id bigint NOT NULL, project_id bigint NOT NULL, @@ -12959,8 +13162,7 @@ CREATE TABLE chat_names ( chat_name character varying, last_used_at timestamp without time zone, created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - integration_id integer + updated_at timestamp without time zone NOT NULL ); CREATE SEQUENCE chat_names_id_seq @@ -13116,15 +13318,6 @@ CREATE TABLE p_ci_builds ( ) PARTITION BY LIST (partition_id); -CREATE SEQUENCE ci_builds_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE ci_builds_id_seq OWNED BY p_ci_builds.id; - CREATE TABLE ci_builds ( status character varying, finished_at timestamp without time zone, @@ -13167,13 +13360,22 @@ CREATE TABLE ci_builds ( waiting_for_resource_at timestamp with time zone, processed boolean, scheduling_type smallint, - id bigint DEFAULT nextval('ci_builds_id_seq'::regclass) NOT NULL, + id bigint NOT NULL, stage_id bigint, partition_id bigint NOT NULL, CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)) ); ALTER TABLE ONLY p_ci_builds ATTACH PARTITION ci_builds FOR VALUES IN ('100'); +CREATE SEQUENCE ci_builds_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_builds_id_seq OWNED BY p_ci_builds.id; + CREATE TABLE p_ci_builds_metadata ( project_id integer NOT NULL, timeout integer, @@ -13595,7 +13797,8 @@ CREATE TABLE ci_pipeline_chat_data ( id bigint NOT NULL, pipeline_id integer NOT NULL, chat_name_id integer NOT NULL, - response_url text NOT NULL + response_url text NOT NULL, + pipeline_id_convert_to_bigint bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE ci_pipeline_chat_data_id_seq @@ -13612,6 +13815,7 @@ CREATE TABLE ci_pipeline_messages ( severity smallint DEFAULT 0 NOT NULL, pipeline_id integer NOT NULL, content text NOT NULL, + pipeline_id_convert_to_bigint bigint DEFAULT 0 NOT NULL, CONSTRAINT check_58ca2981b2 CHECK ((char_length(content) <= 10000)) ); @@ -13733,6 +13937,7 @@ CREATE TABLE ci_pipelines ( locked smallint DEFAULT 1 NOT NULL, partition_id bigint NOT NULL, id_convert_to_bigint bigint DEFAULT 0 NOT NULL, + auto_canceled_by_id_convert_to_bigint bigint, CONSTRAINT check_d7e99a025e CHECK ((lock_version IS NOT NULL)) ); @@ -14040,7 +14245,9 @@ CREATE TABLE ci_sources_pipelines ( source_pipeline_id integer, source_job_id bigint, partition_id bigint NOT NULL, - source_partition_id bigint NOT NULL + source_partition_id bigint NOT NULL, + pipeline_id_convert_to_bigint bigint, + source_pipeline_id_convert_to_bigint bigint ); CREATE SEQUENCE ci_sources_pipelines_id_seq @@ -14078,6 +14285,7 @@ CREATE TABLE ci_stages ( "position" integer, id bigint NOT NULL, partition_id bigint NOT NULL, + pipeline_id_convert_to_bigint bigint, CONSTRAINT check_81b431e49b CHECK ((lock_version IS NOT NULL)) ); @@ -15048,6 +15256,8 @@ CREATE TABLE dependency_list_exports ( status smallint DEFAULT 0 NOT NULL, file text, group_id bigint, + pipeline_id bigint, + export_type smallint DEFAULT 0 NOT NULL, CONSTRAINT check_fff6fc9b2f CHECK ((char_length(file) <= 255)) ); @@ -15699,6 +15909,8 @@ CREATE TABLE environments ( merge_request_id bigint, cluster_agent_id bigint, kubernetes_namespace text, + flux_resource_path text, + CONSTRAINT check_23b1eb18a2 CHECK ((char_length(flux_resource_path) <= 255)), CONSTRAINT check_b5373a1804 CHECK ((char_length(kubernetes_namespace) <= 63)) ); @@ -15887,7 +16099,6 @@ ALTER SEQUENCE error_tracking_errors_id_seq OWNED BY error_tracking_errors.id; CREATE TABLE events ( project_id integer, author_id integer NOT NULL, - target_id integer, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, action smallint NOT NULL, @@ -15895,7 +16106,7 @@ CREATE TABLE events ( group_id bigint, fingerprint bytea, id bigint NOT NULL, - target_id_convert_to_bigint bigint, + target_id bigint, CONSTRAINT check_97e06e05ad CHECK ((octet_length(fingerprint) <= 128)) ); @@ -16733,6 +16944,26 @@ CREATE SEQUENCE group_repository_storage_moves_id_seq ALTER SEQUENCE group_repository_storage_moves_id_seq OWNED BY group_repository_storage_moves.id; +CREATE TABLE group_ssh_certificates ( + id bigint NOT NULL, + namespace_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + fingerprint bytea NOT NULL, + title text NOT NULL, + key text NOT NULL, + CONSTRAINT check_480296705f CHECK ((char_length(title) <= 256)), + CONSTRAINT check_6c1d920167 CHECK ((char_length(key) <= 524288)) +); + +CREATE SEQUENCE group_ssh_certificates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE group_ssh_certificates_id_seq OWNED BY group_ssh_certificates.id; + CREATE TABLE group_wiki_repositories ( shard_id bigint NOT NULL, group_id bigint NOT NULL, @@ -17132,6 +17363,7 @@ CREATE TABLE instance_audit_events_streaming_headers ( instance_external_audit_event_destination_id bigint NOT NULL, key text NOT NULL, value text NOT NULL, + active boolean DEFAULT true NOT NULL, CONSTRAINT check_d52adbbabb CHECK ((char_length(value) <= 255)), CONSTRAINT check_e92010d531 CHECK ((char_length(key) <= 255)) ); @@ -17482,7 +17714,6 @@ CREATE TABLE issues ( health_status smallint, external_key character varying(255), sprint_id bigint, - issue_type smallint DEFAULT 0 NOT NULL, blocking_issues_count integer DEFAULT 0 NOT NULL, upvotes_count integer DEFAULT 0 NOT NULL, work_item_type_id bigint, @@ -17723,7 +17954,8 @@ CREATE TABLE labels ( description_html text, type character varying, group_id integer, - cached_markdown_version integer + cached_markdown_version integer, + lock_on_merge boolean DEFAULT false NOT NULL ); CREATE SEQUENCE labels_id_seq @@ -17910,7 +18142,11 @@ CREATE TABLE member_roles ( read_code boolean DEFAULT false, read_vulnerability boolean DEFAULT false NOT NULL, admin_vulnerability boolean DEFAULT false NOT NULL, - read_dependency boolean DEFAULT false NOT NULL + read_dependency boolean DEFAULT false NOT NULL, + name text DEFAULT 'Custom'::text NOT NULL, + description text, + CONSTRAINT check_4364846f58 CHECK ((char_length(description) <= 255)), + CONSTRAINT check_9907916995 CHECK ((char_length(name) <= 255)) ); CREATE SEQUENCE member_roles_id_seq @@ -17962,6 +18198,7 @@ CREATE TABLE members ( invite_email_success boolean DEFAULT true NOT NULL, member_namespace_id bigint, member_role_id bigint, + expiry_notified_at timestamp with time zone, CONSTRAINT check_508774aac0 CHECK ((member_namespace_id IS NOT NULL)) ); @@ -18188,6 +18425,7 @@ CREATE TABLE merge_request_diffs ( files_count smallint, sorted boolean DEFAULT false NOT NULL, diff_type smallint DEFAULT 1 NOT NULL, + patch_id_sha bytea, CONSTRAINT check_93ee616ac9 CHECK ((external_diff_store IS NOT NULL)) ); @@ -18737,7 +18975,6 @@ CREATE TABLE namespace_details ( cached_markdown_version integer, description text, description_html text, - free_user_cap_over_limt_notified_at timestamp with time zone, free_user_cap_over_limit_notified_at timestamp with time zone, dashboard_notification_at timestamp with time zone, dashboard_enforcement_at timestamp with time zone, @@ -18778,8 +19015,11 @@ CREATE TABLE namespace_package_settings ( lock_pypi_package_requests_forwarding boolean DEFAULT false NOT NULL, npm_package_requests_forwarding boolean, lock_npm_package_requests_forwarding boolean DEFAULT false NOT NULL, + nuget_duplicates_allowed boolean DEFAULT true NOT NULL, + nuget_duplicate_exception_regex text DEFAULT ''::text NOT NULL, CONSTRAINT check_31340211b1 CHECK ((char_length(generic_duplicate_exception_regex) <= 255)), - CONSTRAINT check_d63274b2b6 CHECK ((char_length(maven_duplicate_exception_regex) <= 255)) + CONSTRAINT check_d63274b2b6 CHECK ((char_length(maven_duplicate_exception_regex) <= 255)), + CONSTRAINT check_eedcf85c48 CHECK ((char_length(nuget_duplicate_exception_regex) <= 255)) ); CREATE TABLE namespace_root_storage_statistics ( @@ -19024,7 +19264,8 @@ CREATE TABLE notes ( confidential boolean, last_edited_at timestamp with time zone, internal boolean DEFAULT false NOT NULL, - id bigint NOT NULL + id bigint NOT NULL, + namespace_id bigint ); CREATE SEQUENCE notes_id_seq @@ -19381,6 +19622,15 @@ CREATE SEQUENCE organizations_id_seq ALTER SEQUENCE organizations_id_seq OWNED BY organizations.id; +CREATE SEQUENCE p_batched_git_ref_updates_deletions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE p_batched_git_ref_updates_deletions_id_seq OWNED BY p_batched_git_ref_updates_deletions.id; + CREATE SEQUENCE p_ci_job_annotations_id_seq START WITH 1 INCREMENT BY 1 @@ -19858,6 +20108,8 @@ CREATE TABLE packages_nuget_metadata ( icon_url text, authors text, description text, + normalized_version text, + CONSTRAINT check_9973c0cc33 CHECK ((char_length(normalized_version) <= 255)), CONSTRAINT check_d39a5fe9ee CHECK ((char_length(description) <= 4000)), CONSTRAINT check_e2fc129ebd CHECK ((char_length(authors) <= 255)), CONSTRAINT packages_nuget_metadata_icon_url_constraint CHECK ((char_length(icon_url) <= 255)), @@ -19922,7 +20174,8 @@ CREATE TABLE packages_packages ( package_type smallint NOT NULL, creator_id integer, status smallint DEFAULT 0 NOT NULL, - last_downloaded_at timestamp with time zone + last_downloaded_at timestamp with time zone, + status_message text ); CREATE SEQUENCE packages_packages_id_seq @@ -20086,8 +20339,12 @@ CREATE TABLE pages_deployments ( file_sha256 bytea NOT NULL, size bigint, root_directory text DEFAULT 'public'::text, + path_prefix text, + build_ref text, + CONSTRAINT check_4d04b8dc9a CHECK ((char_length(path_prefix) <= 128)), CONSTRAINT check_5f9132a958 CHECK ((size IS NOT NULL)), CONSTRAINT check_7e938c810a CHECK ((char_length(root_directory) <= 255)), + CONSTRAINT check_b44e900e5c CHECK ((char_length(build_ref) <= 512)), CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255)) ); @@ -20201,7 +20458,6 @@ ALTER SEQUENCE personal_access_tokens_id_seq OWNED BY personal_access_tokens.id; CREATE TABLE plan_limits ( id bigint NOT NULL, plan_id bigint NOT NULL, - ci_active_pipelines integer DEFAULT 0 NOT NULL, ci_pipeline_size integer DEFAULT 0 NOT NULL, ci_active_jobs integer DEFAULT 0 NOT NULL, project_hooks integer DEFAULT 100 NOT NULL, @@ -20284,7 +20540,12 @@ CREATE TABLE plan_limits ( project_access_token_limit integer DEFAULT 0 NOT NULL, google_cloud_logging_configurations integer DEFAULT 5 NOT NULL, ml_model_max_file_size bigint DEFAULT '10737418240'::bigint NOT NULL, - limits_history jsonb DEFAULT '{}'::jsonb NOT NULL + limits_history jsonb DEFAULT '{}'::jsonb NOT NULL, + updated_at timestamp with time zone DEFAULT now() NOT NULL, + ci_max_artifact_size_annotations integer DEFAULT 0 NOT NULL, + ci_job_annotations_size integer DEFAULT 81920 NOT NULL, + ci_job_annotations_num integer DEFAULT 20 NOT NULL, + file_size_limit_mb double precision DEFAULT 100.0 NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -20355,6 +20616,7 @@ CREATE TABLE pm_affected_packages ( affected_range text NOT NULL, fixed_versions text[] DEFAULT '{}'::text[], overridden_advisory_fields jsonb DEFAULT '{}'::jsonb NOT NULL, + versions jsonb DEFAULT '[]'::jsonb NOT NULL, CONSTRAINT check_5dd528a2be CHECK ((char_length(package_name) <= 256)), CONSTRAINT check_80dea16c7b CHECK ((char_length(affected_range) <= 512)), CONSTRAINT check_d1d4646298 CHECK ((char_length(solution) <= 2048)), @@ -20857,7 +21119,8 @@ ALTER SEQUENCE project_aliases_id_seq OWNED BY project_aliases.id; CREATE TABLE project_authorizations ( user_id integer NOT NULL, project_id integer NOT NULL, - access_level integer NOT NULL + access_level integer NOT NULL, + is_unique boolean ); CREATE TABLE project_auto_devops ( @@ -20913,7 +21176,8 @@ CREATE TABLE project_ci_cd_settings ( runner_token_expiration_interval integer, separated_caches boolean DEFAULT true NOT NULL, allow_fork_pipelines_to_run_in_parent_project boolean DEFAULT true NOT NULL, - inbound_job_token_scope_enabled boolean DEFAULT true NOT NULL + inbound_job_token_scope_enabled boolean DEFAULT true NOT NULL, + forward_deployment_rollback_allowed boolean DEFAULT true NOT NULL ); CREATE SEQUENCE project_ci_cd_settings_id_seq @@ -21996,6 +22260,9 @@ CREATE TABLE remote_development_agent_configs ( cluster_agent_id bigint NOT NULL, enabled boolean NOT NULL, dns_zone text NOT NULL, + network_policy_enabled boolean DEFAULT true NOT NULL, + gitlab_workspaces_proxy_namespace text DEFAULT 'gitlab-workspaces'::text NOT NULL, + CONSTRAINT check_72947a4495 CHECK ((char_length(gitlab_workspaces_proxy_namespace) <= 63)), CONSTRAINT check_9f5cd54d1c CHECK ((char_length(dns_zone) <= 256)) ); @@ -22378,7 +22645,13 @@ CREATE TABLE sbom_occurrences ( source_id bigint, commit_sha bytea NOT NULL, component_id bigint NOT NULL, - uuid uuid NOT NULL + uuid uuid NOT NULL, + package_manager text, + component_name text, + input_file_path text, + CONSTRAINT check_3f2d2c7ffc CHECK ((char_length(package_manager) <= 255)), + CONSTRAINT check_9b29021fa8 CHECK ((char_length(component_name) <= 255)), + CONSTRAINT check_bd1367d4c1 CHECK ((char_length(input_file_path) <= 255)) ); CREATE SEQUENCE sbom_occurrences_id_seq @@ -22421,7 +22694,9 @@ CREATE TABLE scan_result_policies ( age_interval smallint, vulnerability_attributes jsonb DEFAULT '{}'::jsonb, project_id bigint, - CONSTRAINT age_value_null_or_positive CHECK (((age_value IS NULL) OR (age_value >= 0))) + rule_idx smallint, + CONSTRAINT age_value_null_or_positive CHECK (((age_value IS NULL) OR (age_value >= 0))), + CONSTRAINT check_scan_result_policies_rule_idx_positive CHECK (((rule_idx IS NULL) OR (rule_idx >= 0))) ); CREATE SEQUENCE scan_result_policies_id_seq @@ -22433,30 +22708,6 @@ CREATE SEQUENCE scan_result_policies_id_seq ALTER SEQUENCE scan_result_policies_id_seq OWNED BY scan_result_policies.id; -CREATE TABLE schema_inconsistencies ( - id bigint NOT NULL, - issue_id bigint NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - object_name text NOT NULL, - table_name text NOT NULL, - valitador_name text NOT NULL, - diff text NOT NULL, - CONSTRAINT check_001d186ac7 CHECK ((char_length(diff) <= 6144)), - CONSTRAINT check_120b6c86d0 CHECK ((char_length(valitador_name) <= 63)), - CONSTRAINT check_a0411f31fd CHECK ((char_length(object_name) <= 63)), - CONSTRAINT check_d96408dfd2 CHECK ((char_length(table_name) <= 63)) -); - -CREATE SEQUENCE schema_inconsistencies_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE schema_inconsistencies_id_seq OWNED BY schema_inconsistencies.id; - CREATE TABLE schema_migrations ( version character varying NOT NULL, finished_at timestamp with time zone DEFAULT now() @@ -23126,7 +23377,7 @@ CREATE TABLE subscription_add_on_purchases ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, subscription_add_on_id bigint NOT NULL, - namespace_id bigint NOT NULL, + namespace_id bigint, quantity integer NOT NULL, expires_on date NOT NULL, purchase_xid text NOT NULL, @@ -23319,6 +23570,25 @@ CREATE SEQUENCE tags_id_seq ALTER SEQUENCE tags_id_seq OWNED BY tags.id; +CREATE TABLE target_branch_rules ( + 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, + name text NOT NULL, + target_branch text NOT NULL, + CONSTRAINT check_3a0b12cf8c CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE target_branch_rules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE target_branch_rules_id_seq OWNED BY target_branch_rules.id; + CREATE TABLE term_agreements ( id integer NOT NULL, term_id integer NOT NULL, @@ -23710,6 +23980,7 @@ CREATE TABLE user_details ( discord text DEFAULT ''::text NOT NULL, enterprise_group_id bigint, enterprise_group_associated_at timestamp with time zone, + email_reset_offered_at timestamp with time zone, CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)), CONSTRAINT check_444573ee52 CHECK ((char_length(skype) <= 500)), CONSTRAINT check_466a25be35 CHECK ((char_length(twitter) <= 500)), @@ -24483,6 +24754,8 @@ CREATE TABLE vulnerability_reads ( casted_cluster_agent_id bigint, namespace_id bigint, dismissal_reason smallint, + has_merge_request boolean DEFAULT false, + has_remediations boolean DEFAULT false NOT NULL, CONSTRAINT check_380451bdbe CHECK ((char_length(location_image) <= 2048)), CONSTRAINT check_a105eb825a CHECK ((char_length(cluster_agent_id) <= 10)) ); @@ -24880,7 +25153,8 @@ CREATE TABLE x509_certificates ( email character varying(255) NOT NULL, serial_number bytea NOT NULL, certificate_status smallint DEFAULT 0 NOT NULL, - x509_issuer_id bigint NOT NULL + x509_issuer_id bigint NOT NULL, + emails character varying[] DEFAULT '{}'::character varying[] NOT NULL ); CREATE SEQUENCE x509_certificates_id_seq @@ -24958,7 +25232,8 @@ CREATE TABLE zoekt_indexed_namespaces ( zoekt_shard_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 + updated_at timestamp with time zone NOT NULL, + search boolean DEFAULT true NOT NULL ); CREATE SEQUENCE zoekt_indexed_namespaces_id_seq @@ -25160,6 +25435,10 @@ ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_ ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass); +ALTER TABLE ONLY catalog_resource_components ALTER COLUMN id SET DEFAULT nextval('catalog_resource_components_id_seq'::regclass); + +ALTER TABLE ONLY catalog_resource_versions ALTER COLUMN id SET DEFAULT nextval('catalog_resource_versions_id_seq'::regclass); + ALTER TABLE ONLY catalog_resources ALTER COLUMN id SET DEFAULT nextval('catalog_resources_id_seq'::regclass); ALTER TABLE ONLY chat_names ALTER COLUMN id SET DEFAULT nextval('chat_names_id_seq'::regclass); @@ -25472,6 +25751,8 @@ ALTER TABLE ONLY group_import_states ALTER COLUMN group_id SET DEFAULT nextval(' ALTER TABLE ONLY group_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('group_repository_storage_moves_id_seq'::regclass); +ALTER TABLE ONLY group_ssh_certificates ALTER COLUMN id SET DEFAULT nextval('group_ssh_certificates_id_seq'::regclass); + ALTER TABLE ONLY group_wiki_repository_states ALTER COLUMN id SET DEFAULT nextval('group_wiki_repository_states_id_seq'::regclass); ALTER TABLE ONLY historical_data ALTER COLUMN id SET DEFAULT nextval('historical_data_id_seq'::regclass); @@ -25698,7 +25979,7 @@ ALTER TABLE ONLY organization_users ALTER COLUMN id SET DEFAULT nextval('organiz ALTER TABLE ONLY organizations ALTER COLUMN id SET DEFAULT nextval('organizations_id_seq'::regclass); -ALTER TABLE ONLY p_ci_builds ALTER COLUMN id SET DEFAULT nextval('ci_builds_id_seq'::regclass); +ALTER TABLE ONLY p_batched_git_ref_updates_deletions ALTER COLUMN id SET DEFAULT nextval('p_batched_git_ref_updates_deletions_id_seq'::regclass); ALTER TABLE ONLY p_ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval('ci_builds_metadata_id_seq'::regclass); @@ -25932,8 +26213,6 @@ ALTER TABLE ONLY sbom_sources ALTER COLUMN id SET DEFAULT nextval('sbom_sources_ ALTER TABLE ONLY scan_result_policies ALTER COLUMN id SET DEFAULT nextval('scan_result_policies_id_seq'::regclass); -ALTER TABLE ONLY schema_inconsistencies ALTER COLUMN id SET DEFAULT nextval('schema_inconsistencies_id_seq'::regclass); - ALTER TABLE ONLY scim_identities ALTER COLUMN id SET DEFAULT nextval('scim_identities_id_seq'::regclass); ALTER TABLE ONLY scim_oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('scim_oauth_access_tokens_id_seq'::regclass); @@ -26014,6 +26293,8 @@ ALTER TABLE ONLY taggings ALTER COLUMN id SET DEFAULT nextval('taggings_id_seq': ALTER TABLE ONLY tags ALTER COLUMN id SET DEFAULT nextval('tags_id_seq'::regclass); +ALTER TABLE ONLY target_branch_rules ALTER COLUMN id SET DEFAULT nextval('target_branch_rules_id_seq'::regclass); + ALTER TABLE ONLY term_agreements ALTER COLUMN id SET DEFAULT nextval('term_agreements_id_seq'::regclass); ALTER TABLE ONLY terraform_state_versions ALTER COLUMN id SET DEFAULT nextval('terraform_state_versions_id_seq'::regclass); @@ -26988,6 +27269,12 @@ ALTER TABLE ONLY bulk_import_trackers ALTER TABLE ONLY bulk_imports ADD CONSTRAINT bulk_imports_pkey PRIMARY KEY (id); +ALTER TABLE ONLY catalog_resource_components + ADD CONSTRAINT catalog_resource_components_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY catalog_resource_versions + ADD CONSTRAINT catalog_resource_versions_pkey PRIMARY KEY (id); + ALTER TABLE ONLY catalog_resources ADD CONSTRAINT catalog_resources_pkey PRIMARY KEY (id); @@ -27009,6 +27296,9 @@ ALTER TABLE sprints ALTER TABLE group_import_states ADD CONSTRAINT check_cda75c7c3f CHECK ((user_id IS NOT NULL)) NOT VALID; +ALTER TABLE packages_packages + ADD CONSTRAINT check_d6301aedeb CHECK ((char_length(status_message) <= 255)) NOT VALID; + ALTER TABLE sprints ADD CONSTRAINT check_df3816aed7 CHECK ((due_date IS NOT NULL)) NOT VALID; @@ -27579,6 +27869,9 @@ ALTER TABLE ONLY group_merge_request_approval_settings ALTER TABLE ONLY group_repository_storage_moves ADD CONSTRAINT group_repository_storage_moves_pkey PRIMARY KEY (id); +ALTER TABLE ONLY group_ssh_certificates + ADD CONSTRAINT group_ssh_certificates_pkey PRIMARY KEY (id); + ALTER TABLE ONLY group_wiki_repositories ADD CONSTRAINT group_wiki_repositories_pkey PRIMARY KEY (group_id); @@ -27975,6 +28268,9 @@ ALTER TABLE ONLY organization_users ALTER TABLE ONLY organizations ADD CONSTRAINT organizations_pkey PRIMARY KEY (id); +ALTER TABLE ONLY p_batched_git_ref_updates_deletions + ADD CONSTRAINT p_batched_git_ref_updates_deletions_pkey PRIMARY KEY (id, partition_id); + ALTER TABLE ONLY p_ci_job_annotations ADD CONSTRAINT p_ci_job_annotations_pkey PRIMARY KEY (id, partition_id); @@ -28383,9 +28679,6 @@ ALTER TABLE ONLY sbom_sources ALTER TABLE ONLY scan_result_policies ADD CONSTRAINT scan_result_policies_pkey PRIMARY KEY (id); -ALTER TABLE ONLY schema_inconsistencies - ADD CONSTRAINT schema_inconsistencies_pkey PRIMARY KEY (id); - ALTER TABLE ONLY schema_migrations ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); @@ -28527,6 +28820,9 @@ ALTER TABLE ONLY taggings ALTER TABLE ONLY tags ADD CONSTRAINT tags_pkey PRIMARY KEY (id); +ALTER TABLE ONLY target_branch_rules + ADD CONSTRAINT target_branch_rules_pkey PRIMARY KEY (id); + ALTER TABLE ONLY term_agreements ADD CONSTRAINT term_agreements_pkey PRIMARY KEY (id); @@ -28792,12 +29088,18 @@ CREATE INDEX index_061fe00461 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_070cef72c3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_issue_search_data_on_namespace_id ON ONLY issue_search_data USING btree (namespace_id); + +CREATE INDEX index_08b7071d9b ON gitlab_partitions_static.issue_search_data_41 USING btree (namespace_id); + CREATE INDEX index_08e3cfc564 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_merge_request_stage_events_group_in_progress_duration ON ONLY analytics_cycle_analytics_merge_request_stage_events USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_09af45dd6f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_09fe0c1886 ON gitlab_partitions_static.issue_search_data_01 USING btree (namespace_id); + CREATE INDEX index_0c153e2eae ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_issue_stage_events_group_in_progress_duration ON ONLY analytics_cycle_analytics_issue_stage_events USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -28814,6 +29116,10 @@ CREATE INDEX index_0f28a65451 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_10588dbff0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_106d7d97e8 ON gitlab_partitions_static.issue_search_data_27 USING btree (namespace_id); + +CREATE INDEX index_1076a9a98a ON gitlab_partitions_static.issue_search_data_10 USING btree (namespace_id); + CREATE INDEX index_107e123e17 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_1230a7a402 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -28830,6 +29136,10 @@ CREATE INDEX index_16627b455e ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_17fa2812c5 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_19aa18ccc9 ON gitlab_partitions_static.issue_search_data_45 USING btree (namespace_id); + +CREATE INDEX index_19f4ed8614 ON gitlab_partitions_static.issue_search_data_33 USING btree (namespace_id); + CREATE INDEX index_1a0388713a ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_1a349ed064 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -28838,6 +29148,8 @@ CREATE INDEX index_1af932a3c7 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_1b0ea30bdb ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_1b47bbbb6a ON gitlab_partitions_static.issue_search_data_52 USING btree (namespace_id); + CREATE INDEX index_1f6c3faabe ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_1f8af04ed1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -28852,8 +29164,12 @@ CREATE INDEX index_203dd694bc ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_206349925b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_208e7ef042 ON gitlab_partitions_static.issue_search_data_48 USING btree (namespace_id); + CREATE INDEX index_2098118748 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_20c6491c6e ON gitlab_partitions_static.issue_search_data_29 USING btree (namespace_id); + CREATE INDEX index_21db459e34 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_21e262390a ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -28894,6 +29210,8 @@ CREATE INDEX index_2ad4b4fdbc ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_2b7c0a294e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_2bac9d64a0 ON gitlab_partitions_static.issue_search_data_38 USING btree (namespace_id); + CREATE INDEX index_2c6422f668 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_2dfcdbe81e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -28916,6 +29234,8 @@ CREATE INDEX index_3249505125 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_331eb67441 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_34a8b08081 ON gitlab_partitions_static.issue_search_data_40 USING btree (namespace_id); + CREATE INDEX index_3640194b77 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_372160a706 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -28930,10 +29250,18 @@ CREATE INDEX index_399dc06649 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_3a10b315c0 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_3a7d21a6ee ON gitlab_partitions_static.issue_search_data_19 USING btree (namespace_id); + CREATE INDEX index_3a8848c00b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_3b09ab5902 ON gitlab_partitions_static.issue_search_data_12 USING btree (namespace_id); + +CREATE INDEX index_3bc2eedca5 ON gitlab_partitions_static.issue_search_data_59 USING btree (namespace_id); + CREATE INDEX index_3c2a3a6ac9 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_3dbde77b8b ON gitlab_partitions_static.issue_search_data_58 USING btree (namespace_id); + CREATE INDEX index_3e6be332b7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_4137a6fac3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); @@ -28978,6 +29306,8 @@ CREATE INDEX index_4dead6f314 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_4e6ce1c371 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_4ea50d3a5b ON gitlab_partitions_static.issue_search_data_24 USING btree (namespace_id); + CREATE INDEX index_4f2eb7a06b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_4f6fc34e57 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -29006,6 +29336,8 @@ CREATE INDEX index_584c1e6fb0 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_5913107510 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_5968e77935 ON gitlab_partitions_static.issue_search_data_46 USING btree (namespace_id); + CREATE INDEX index_59a8209ab6 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_59ce40fcc4 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -29058,6 +29390,8 @@ CREATE INDEX index_6580ecb2db ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_66a736da09 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_680d7ab4a6 ON gitlab_partitions_static.issue_search_data_06 USING btree (namespace_id); + CREATE INDEX index_682eba05f6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_69bdcf213e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29068,6 +29402,10 @@ CREATE INDEX index_6add8e74cf ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_6b1ce61c8f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_6b431c9952 ON gitlab_partitions_static.issue_search_data_23 USING btree (namespace_id); + +CREATE INDEX index_6bf2b9282c ON gitlab_partitions_static.issue_search_data_22 USING btree (namespace_id); + CREATE INDEX index_6cfb391b86 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_6e560c1a4d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); @@ -29088,6 +29426,10 @@ CREATE INDEX index_708d792ae9 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_70c657954b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_713f462d76 ON gitlab_partitions_static.issue_search_data_57 USING btree (namespace_id); + +CREATE INDEX index_71c0e45eca ON gitlab_partitions_static.issue_search_data_39 USING btree (namespace_id); + CREATE INDEX index_71c2b26944 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_72027c157f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29104,6 +29446,12 @@ CREATE INDEX index_77096a1dc6 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_77c6293242 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_77f67bf238 ON gitlab_partitions_static.issue_search_data_02 USING btree (namespace_id); + +CREATE INDEX index_7822759674 ON gitlab_partitions_static.issue_search_data_56 USING btree (namespace_id); + +CREATE INDEX index_7a0b7ffadf ON gitlab_partitions_static.issue_search_data_07 USING btree (namespace_id); + CREATE INDEX index_7b7c85eceb ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_7da2307d2e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29114,16 +29462,28 @@ CREATE INDEX index_7ecb5b68b4 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_7f543eed8d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_7f8a80dd47 ON gitlab_partitions_static.issue_search_data_49 USING btree (namespace_id); + +CREATE INDEX index_80305b1eed ON gitlab_partitions_static.issue_search_data_42 USING btree (namespace_id); + CREATE INDEX index_807671c4be ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_807fa83fc0 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_80a81ac235 ON gitlab_partitions_static.issue_search_data_53 USING btree (namespace_id); + CREATE INDEX index_80c65daf20 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_81b31eafac ON gitlab_partitions_static.issue_search_data_63 USING btree (namespace_id); + CREATE INDEX index_81b9cf594f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_82c675952c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_831e7f124f ON gitlab_partitions_static.issue_search_data_43 USING btree (namespace_id); + +CREATE INDEX index_837a193bf2 ON gitlab_partitions_static.issue_search_data_55 USING btree (namespace_id); + CREATE INDEX index_837cc295f1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); CREATE INDEX index_83c5049b3e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29138,6 +29498,8 @@ CREATE INDEX index_8685d7c69c ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_8688b40056 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_876145d1d5 ON gitlab_partitions_static.issue_search_data_51 USING btree (namespace_id); + CREATE INDEX index_87d40fb9f9 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_88b40d6740 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -29156,12 +29518,18 @@ CREATE INDEX index_8b9f9a19a4 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_8fb48e72ce ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_907e12b7ba ON gitlab_partitions_static.issue_search_data_54 USING btree (namespace_id); + CREATE INDEX index_918bb2ebbb ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_91c432a4bd ON gitlab_partitions_static.issue_search_data_16 USING btree (namespace_id); + CREATE INDEX index_91d5e4e3df ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); CREATE INDEX index_9201b952a0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_927796f71d ON gitlab_partitions_static.issue_search_data_50 USING btree (namespace_id); + CREATE INDEX index_92c09e352b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_9490e0e0b7 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29172,14 +29540,20 @@ CREATE INDEX index_95a353f50b ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_971af9481e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_994aa245b7 ON gitlab_partitions_static.issue_search_data_61 USING btree (namespace_id); + CREATE INDEX index_9955b1dc59 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_9a2eb72a3b ON gitlab_partitions_static.issue_search_data_21 USING btree (namespace_id); + CREATE INDEX index_9b8e89ae41 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_9d0e953ab3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); CREATE INDEX index_9ee83b068b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_a016d4ed08 ON gitlab_partitions_static.issue_search_data_36 USING btree (namespace_id); + CREATE INDEX index_a1a9dc36c1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_a2d9f185a5 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29188,12 +29562,16 @@ CREATE INDEX index_a3feed3097 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_a46b7b7f26 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_a4f5106804 ON gitlab_partitions_static.issue_search_data_11 USING btree (namespace_id); + CREATE INDEX index_a6999c65c9 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_a6c68d16b2 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_a8276a450f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_a849f1bbcc ON gitlab_partitions_static.issue_search_data_62 USING btree (namespace_id); + CREATE INDEX index_a88f20fc98 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_a8fe03fe34 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); @@ -29208,12 +29586,16 @@ CREATE INDEX index_a9ba23c88e ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_a9deff2159 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_aa92d75d85 ON gitlab_partitions_static.issue_search_data_04 USING btree (namespace_id); + CREATE INDEX index_aabc184267 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_ab22231a16 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_abbdf80ab1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_aca42d7cff ON gitlab_partitions_static.issue_search_data_44 USING btree (namespace_id); + CREATE INDEX index_ad55e8b11c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); CREATE INDEX index_adc159c3fe ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29222,10 +29604,16 @@ CREATE INDEX index_aed7f7b10c ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_aee84adb5b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_af8368d587 ON gitlab_partitions_static.issue_search_data_31 USING btree (namespace_id); + CREATE INDEX index_b1dda405af ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_b24e8538c8 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_b286c595e8 ON gitlab_partitions_static.issue_search_data_05 USING btree (namespace_id); + +CREATE INDEX index_b377ac6784 ON gitlab_partitions_static.issue_search_data_20 USING btree (namespace_id); + CREATE INDEX index_b3b64068e7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); CREATE INDEX index_b3c4c9a53f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); @@ -29234,18 +29622,28 @@ CREATE INDEX index_b4b2bba753 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_b607012614 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_b6cc38a848 ON gitlab_partitions_static.issue_search_data_08 USING btree (namespace_id); + +CREATE INDEX index_b748a3e0a6 ON gitlab_partitions_static.issue_search_data_15 USING btree (namespace_id); + CREATE INDEX index_b7f21460bb ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_b83fe1306b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_bb6defaa27 ON gitlab_partitions_static.issue_search_data_34 USING btree (namespace_id); + CREATE INDEX index_bc189e47ab ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_bca83177ef ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_bcaa8dcd34 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_bcae2cf631 ON gitlab_partitions_static.issue_search_data_00 USING btree (namespace_id); + CREATE INDEX index_be0a028bcc ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_beaa329ca0 ON gitlab_partitions_static.issue_search_data_47 USING btree (namespace_id); + CREATE INDEX index_bedd7e160b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_bee2b94a80 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -29266,6 +29664,8 @@ CREATE INDEX index_c1cdd90d0d ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_c2b951bf20 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_c3a2cf8b3b ON gitlab_partitions_static.issue_search_data_32 USING btree (namespace_id); + CREATE INDEX index_c42b2e7eae ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_c435d904ce ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29282,6 +29682,8 @@ CREATE INDEX index_c6ea8a0e26 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_c7ac8595d3 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_c8bbf2b334 ON gitlab_partitions_static.issue_search_data_26 USING btree (namespace_id); + CREATE INDEX index_c8c4219c0a ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_c971e6c5ce ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -29314,12 +29716,16 @@ CREATE INDEX index_d17b82ddd9 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_d1c24d8199 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_d1c6c67ec1 ON gitlab_partitions_static.issue_search_data_60 USING btree (namespace_id); + CREATE INDEX index_d27b4c84e7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_d2fe918e83 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_d35c969634 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_d3b6418940 ON gitlab_partitions_static.issue_search_data_17 USING btree (namespace_id); + CREATE INDEX index_d493a5c171 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); CREATE INDEX index_d6047ee813 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); @@ -29328,12 +29734,16 @@ CREATE INDEX index_d69c2485f4 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_d70379e22c ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); +CREATE INDEX index_d87775b2e7 ON gitlab_partitions_static.issue_search_data_35 USING btree (namespace_id); + CREATE INDEX index_d8fa9793ad ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_d9384b768d ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_db2753330c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_db6477916f ON gitlab_partitions_static.issue_search_data_28 USING btree (namespace_id); + CREATE INDEX index_dc571ba649 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_de0334da63 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); @@ -29364,8 +29774,12 @@ CREATE INDEX index_ea0c2d3361 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_ea1b583157 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); +CREATE INDEX index_eadcc94c4e ON gitlab_partitions_static.issue_search_data_03 USING btree (namespace_id); + CREATE INDEX index_eb558957f0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_eb5a7f918a ON gitlab_partitions_static.issue_search_data_09 USING btree (namespace_id); + CREATE INDEX index_ec25d494e6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_ece25b5987 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id); @@ -29380,6 +29794,10 @@ CREATE INDEX index_ef6a48bd29 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_ef7be2ae94 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_efa25b26bd ON gitlab_partitions_static.issue_search_data_25 USING btree (namespace_id); + +CREATE INDEX index_f06b4c7a23 ON gitlab_partitions_static.issue_search_data_30 USING btree (namespace_id); + CREATE INDEX index_f0cdd09a5e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_f112fae8ac ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); @@ -29392,14 +29810,22 @@ CREATE INDEX index_f2848acfc7 ON gitlab_partitions_static.analytics_cycle_analyt CREATE INDEX index_f3d7d86e09 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_f402f6a388 ON gitlab_partitions_static.issue_search_data_14 USING btree (namespace_id); + +CREATE INDEX index_f415dc2abd ON gitlab_partitions_static.issue_search_data_18 USING btree (namespace_id); + CREATE INDEX index_f47327ec1f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); +CREATE INDEX index_f5f0e8eefd ON gitlab_partitions_static.issue_search_data_37 USING btree (namespace_id); + CREATE INDEX index_f6b0d458a3 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL); CREATE INDEX index_f705dc8541 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_f76e8a5304 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); +CREATE INDEX index_f836021e1e ON gitlab_partitions_static.issue_search_data_13 USING btree (namespace_id); + CREATE INDEX index_f86acdc2ff ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1)); CREATE INDEX index_f86f73056d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id); @@ -29890,6 +30316,8 @@ CREATE INDEX i_compliance_violations_on_project_id_severity_and_id ON merge_requ CREATE INDEX i_compliance_violations_on_project_id_title_and_id ON merge_requests_compliance_violations USING btree (target_project_id, title, id); +CREATE INDEX i_custom_email_verifications_on_triggered_at_and_state_started ON service_desk_custom_email_verifications USING btree (triggered_at) WHERE (state = 0); + CREATE INDEX i_dast_pre_scan_verification_steps_on_pre_scan_verification_id ON dast_pre_scan_verification_steps USING btree (dast_pre_scan_verification_id); CREATE INDEX i_dast_profiles_tags_on_scanner_profiles_id ON dast_profiles_tags USING btree (dast_profile_id); @@ -29934,6 +30362,8 @@ CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON con CREATE INDEX idx_container_repos_on_exp_cleanup_status_project_id_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, project_id, expiration_policy_started_at); +CREATE INDEX idx_deletions_on_project_id_and_id_where_pending ON ONLY p_batched_git_ref_updates_deletions USING btree (project_id, id) WHERE (status = 1); + CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); CREATE INDEX idx_devops_adoption_segments_namespace_end_time ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time); @@ -29952,6 +30382,8 @@ CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_me 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_external_status_checks_on_id_and_project_id ON external_status_checks USING btree (id, project_id); + CREATE INDEX idx_headers_instance_external_audit_event_destination_id ON instance_audit_events_streaming_headers USING btree (instance_external_audit_event_destination_id); CREATE INDEX idx_installable_conan_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id) WHERE ((package_type = 3) AND (status = ANY (ARRAY[0, 1]))); @@ -30020,6 +30452,8 @@ CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON pac CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON packages_debian_project_component_files USING btree (architecture_id); +CREATE INDEX idx_packages_nuget_metadata_on_pkg_id_and_normalized_version ON packages_nuget_metadata USING btree (package_id, normalized_version); + CREATE INDEX idx_packages_on_project_id_name_id_version_when_installable_npm ON packages_packages USING btree (project_id, name, id, version) WHERE ((package_type = 2) AND (status = ANY (ARRAY[0, 1]))); CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 7) AND (status <> 4)); @@ -30030,6 +30464,8 @@ CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_helm ON CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_npm ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 2) AND (status <> 4)); +CREATE INDEX idx_packages_packages_on_npm_scope_and_project_id ON packages_packages USING btree (split_part((name)::text, '/'::text, 1), project_id) WHERE ((package_type = 2) AND ("position"((name)::text, '/'::text) > 0) AND (status = ANY (ARRAY[0, 3])) AND (version IS NOT NULL)); + CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); CREATE INDEX idx_personal_access_tokens_on_previous_personal_access_token_id ON personal_access_tokens USING btree (previous_personal_access_token_id); @@ -30090,7 +30526,7 @@ CREATE UNIQUE INDEX idx_uniq_analytics_dashboards_pointers_on_project_id ON anal 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); +CREATE INDEX idx_vuln_reads_for_filtering ON vulnerability_reads USING btree (project_id, state, dismissal_reason, severity DESC, vulnerability_id DESC NULLS LAST); CREATE UNIQUE INDEX idx_vuln_signatures_uniqueness_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, algorithm_type, signature_sha); @@ -30420,6 +30856,18 @@ CREATE INDEX index_bulk_import_failures_on_correlation_id_value ON bulk_import_f CREATE INDEX index_bulk_imports_on_user_id ON bulk_imports USING btree (user_id); +CREATE INDEX index_catalog_resource_components_on_catalog_resource_id ON catalog_resource_components USING btree (catalog_resource_id); + +CREATE INDEX index_catalog_resource_components_on_project_id ON catalog_resource_components USING btree (project_id); + +CREATE INDEX index_catalog_resource_components_on_version_id ON catalog_resource_components USING btree (version_id); + +CREATE INDEX index_catalog_resource_versions_on_catalog_resource_id ON catalog_resource_versions USING btree (catalog_resource_id); + +CREATE INDEX index_catalog_resource_versions_on_project_id ON catalog_resource_versions USING btree (project_id); + +CREATE UNIQUE INDEX index_catalog_resource_versions_on_release_id ON catalog_resource_versions USING btree (release_id); + CREATE UNIQUE INDEX index_catalog_resources_on_project_id ON catalog_resources USING btree (project_id); CREATE INDEX index_chat_names_on_team_id_and_chat_id ON chat_names USING btree (team_id, chat_id); @@ -30654,6 +31102,8 @@ CREATE INDEX index_ci_pipeline_schedules_on_project_id ON ci_pipeline_schedules CREATE UNIQUE INDEX index_ci_pipeline_variables_on_pipeline_id_and_key ON ci_pipeline_variables USING btree (pipeline_id, key); +CREATE UNIQUE INDEX index_ci_pipeline_variables_on_pipeline_id_bigint_and_key ON ci_pipeline_variables USING btree (pipeline_id_convert_to_bigint, key); + CREATE INDEX index_ci_pipelines_config_on_pipeline_id ON ci_pipelines_config USING btree (pipeline_id); CREATE INDEX index_ci_pipelines_for_ondemand_dast_scans ON ci_pipelines USING btree (id) WHERE (source = 13); @@ -30988,6 +31438,8 @@ CREATE UNIQUE INDEX index_dep_prox_manifests_on_group_id_file_name_and_status ON CREATE INDEX index_dependency_list_exports_on_group_id ON dependency_list_exports USING btree (group_id); +CREATE INDEX index_dependency_list_exports_on_pipeline_id ON dependency_list_exports USING btree (pipeline_id); + CREATE INDEX index_dependency_list_exports_on_project_id ON dependency_list_exports USING btree (project_id); CREATE INDEX index_dependency_list_exports_on_user_id ON dependency_list_exports USING btree (user_id); @@ -31048,8 +31500,6 @@ CREATE INDEX index_deployments_on_deployable_type_and_deployable_id ON deploymen CREATE INDEX index_deployments_on_environment_id_and_id ON deployments USING btree (environment_id, id); -CREATE INDEX index_deployments_on_environment_id_and_iid_and_project_id ON deployments USING btree (environment_id, iid, project_id); - CREATE INDEX index_deployments_on_environment_id_and_ref ON deployments USING btree (environment_id, ref); CREATE INDEX index_deployments_on_environment_id_status_and_finished_at ON deployments USING btree (environment_id, status, finished_at); @@ -31072,14 +31522,10 @@ CREATE UNIQUE INDEX index_deployments_on_project_id_and_iid ON deployments USING CREATE INDEX index_deployments_on_project_id_and_ref ON deployments USING btree (project_id, ref); -CREATE INDEX index_deployments_on_project_id_and_status ON deployments USING btree (project_id, status); - CREATE INDEX index_deployments_on_project_id_and_status_and_created_at ON deployments USING btree (project_id, status, created_at); CREATE INDEX index_deployments_on_project_id_and_updated_at_and_id ON deployments USING btree (project_id, updated_at DESC, id DESC); -CREATE INDEX index_deployments_on_project_id_sha ON deployments USING btree (project_id, sha); - CREATE INDEX index_deployments_on_user_id_and_status_and_created_at ON deployments USING btree (user_id, status, created_at); CREATE INDEX index_description_versions_on_epic_id ON description_versions USING btree (epic_id) WHERE (epic_id IS NOT NULL); @@ -31436,6 +31882,10 @@ CREATE INDEX index_group_import_states_on_user_id ON group_import_states USING b CREATE INDEX index_group_repository_storage_moves_on_group_id ON group_repository_storage_moves USING btree (group_id); +CREATE UNIQUE INDEX index_group_ssh_certificates_on_fingerprint ON group_ssh_certificates USING btree (fingerprint); + +CREATE INDEX index_group_ssh_certificates_on_namespace_id ON group_ssh_certificates USING btree (namespace_id); + CREATE UNIQUE INDEX index_group_stages_on_group_id_group_value_stream_id_and_name ON analytics_cycle_analytics_group_stages USING btree (group_id, group_value_stream_id, name); CREATE INDEX index_group_stages_on_stage_event_hash_id ON analytics_cycle_analytics_group_stages USING btree (stage_event_hash_id); @@ -31626,8 +32076,6 @@ CREATE INDEX index_issues_on_duplicated_to_id ON issues USING btree (duplicated_ CREATE INDEX index_issues_on_id_and_weight ON issues USING btree (id, weight); -CREATE INDEX index_issues_on_incident_issue_type ON issues USING btree (issue_type) WHERE (issue_type = 1); - CREATE INDEX index_issues_on_last_edited_by_id ON issues USING btree (last_edited_by_id); CREATE INDEX index_issues_on_milestone_id ON issues USING btree (milestone_id); @@ -31640,8 +32088,6 @@ CREATE INDEX index_issues_on_project_health_status_asc_work_item_type ON issues CREATE INDEX index_issues_on_project_health_status_desc_work_item_type ON issues USING btree (project_id, health_status DESC NULLS LAST, id DESC, state_id, work_item_type_id); -CREATE INDEX index_issues_on_project_id_and_created_at_issue_type_incident ON issues USING btree (project_id, created_at) WHERE (issue_type = 1); - CREATE UNIQUE INDEX index_issues_on_project_id_and_external_key ON issues USING btree (project_id, external_key) WHERE (external_key IS NOT NULL); CREATE UNIQUE INDEX index_issues_on_project_id_and_iid ON issues USING btree (project_id, iid); @@ -31798,6 +32244,8 @@ CREATE INDEX index_members_on_access_level ON members USING btree (access_level) CREATE INDEX index_members_on_expires_at ON members USING btree (expires_at); +CREATE INDEX index_members_on_expiring_at_access_level_id ON members USING btree (expires_at, access_level, id) WHERE ((requested_at IS NULL) AND (expiry_notified_at IS NULL)); + CREATE INDEX index_members_on_invite_email ON members USING btree (invite_email); CREATE UNIQUE INDEX index_members_on_invite_token ON members USING btree (invite_token); @@ -31910,6 +32358,8 @@ CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING CREATE INDEX index_merge_requests_on_head_pipeline_id ON merge_requests USING btree (head_pipeline_id); +CREATE INDEX index_merge_requests_on_id_and_prepared_at ON merge_requests USING btree (id) WHERE (prepared_at IS NULL); + CREATE INDEX index_merge_requests_on_latest_merge_request_diff_id ON merge_requests USING btree (latest_merge_request_diff_id); CREATE INDEX index_merge_requests_on_merge_user_id ON merge_requests USING btree (merge_user_id) WHERE (merge_user_id IS NOT NULL); @@ -32010,8 +32460,6 @@ CREATE UNIQUE INDEX index_ml_experiments_on_project_id_and_name ON ml_experiment CREATE INDEX index_ml_experiments_on_user_id ON ml_experiments USING btree (user_id); -CREATE INDEX index_ml_model_versions_on_model_id ON ml_model_versions USING btree (model_id); - CREATE INDEX index_ml_model_versions_on_package_id ON ml_model_versions USING btree (package_id); CREATE INDEX index_ml_model_versions_on_project_id ON ml_model_versions USING btree (project_id); @@ -32126,6 +32574,8 @@ CREATE INDEX index_notes_on_id_where_internal ON notes USING btree (id) WHERE (i CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code); +CREATE INDEX index_notes_on_namespace_id ON notes USING btree (namespace_id); + CREATE INDEX index_notes_on_noteable_id_and_noteable_type_and_system ON notes USING btree (noteable_id, noteable_type, system); CREATE INDEX index_notes_on_project_id_and_id_and_system_false ON notes USING btree (project_id, id) WHERE (NOT system); @@ -32178,12 +32628,6 @@ CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON a CREATE INDEX index_on_issue_assignment_events_issue_id_action_created_at_id ON issue_assignment_events USING btree (issue_id, action, created_at, id); -CREATE INDEX index_on_issues_closed_incidents_by_project_id_and_closed_at ON issues USING btree (project_id, closed_at) WHERE ((issue_type = 1) AND (state_id = 2)); - -CREATE INDEX index_on_issues_health_status_asc_order ON issues USING btree (project_id, health_status, id DESC, state_id, issue_type); - -CREATE INDEX index_on_issues_health_status_desc_order ON issues USING btree (project_id, health_status DESC NULLS LAST, id DESC, state_id, issue_type); - CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type); CREATE INDEX index_on_merge_request_reviewers_user_id_and_state ON merge_request_reviewers USING btree (user_id, state) WHERE (state = 2); @@ -32346,6 +32790,8 @@ CREATE INDEX index_packages_packages_on_name_trigram ON packages_packages USING CREATE INDEX index_packages_packages_on_project_id_and_created_at ON packages_packages USING btree (project_id, created_at); +CREATE INDEX index_packages_packages_on_project_id_and_lower_name ON packages_packages USING btree (project_id, lower((name)::text)) WHERE (package_type = 4); + CREATE INDEX index_packages_packages_on_project_id_and_lower_version ON packages_packages USING btree (project_id, lower((version)::text)) WHERE (package_type = 4); CREATE INDEX index_packages_packages_on_project_id_and_package_type ON packages_packages USING btree (project_id, package_type); @@ -32380,6 +32826,8 @@ CREATE INDEX index_pages_deployments_on_file_store_and_id ON pages_deployments U CREATE INDEX index_pages_deployments_on_project_id ON pages_deployments USING btree (project_id); +CREATE UNIQUE INDEX index_pages_deployments_unique_path_prefix_by_project ON pages_deployments USING btree (project_id, path_prefix); + CREATE INDEX index_pages_domain_acme_orders_on_challenge_token ON pages_domain_acme_orders USING btree (challenge_token); CREATE INDEX index_pages_domain_acme_orders_on_pages_domain_id ON pages_domain_acme_orders USING btree (pages_domain_id); @@ -32660,6 +33108,8 @@ CREATE INDEX index_projects_on_name_trigram ON projects USING gin (name gin_trgm CREATE INDEX index_projects_on_namespace_id_and_id ON projects USING btree (namespace_id, id); +CREATE INDEX index_projects_on_namespace_id_and_repository_size_limit ON projects USING btree (namespace_id, repository_size_limit); + CREATE INDEX index_projects_on_path_and_id ON projects USING btree (path, id); CREATE INDEX index_projects_on_path_trigram ON projects USING gin (path gin_trgm_ops); @@ -32900,6 +33350,8 @@ CREATE UNIQUE INDEX index_sbom_component_versions_on_component_id_and_version ON CREATE UNIQUE INDEX index_sbom_components_on_component_type_name_and_purl_type ON sbom_components USING btree (name, purl_type, component_type); +CREATE INDEX index_sbom_occurrences_for_input_file_path_search ON sbom_occurrences USING btree (project_id, component_id, input_file_path); + CREATE INDEX index_sbom_occurrences_on_component_id ON sbom_occurrences USING btree (component_id); CREATE INDEX index_sbom_occurrences_on_component_version_id ON sbom_occurrences USING btree (component_version_id); @@ -32908,8 +33360,12 @@ CREATE INDEX index_sbom_occurrences_on_pipeline_id ON sbom_occurrences USING btr CREATE INDEX index_sbom_occurrences_on_project_id ON sbom_occurrences USING btree (project_id); +CREATE INDEX index_sbom_occurrences_on_project_id_and_component_id_and_id ON sbom_occurrences USING btree (project_id, component_id, id); + CREATE INDEX index_sbom_occurrences_on_project_id_and_id ON sbom_occurrences USING btree (project_id, id); +CREATE INDEX index_sbom_occurrences_on_project_id_and_package_manager ON sbom_occurrences USING btree (project_id, package_manager); + CREATE INDEX index_sbom_occurrences_on_project_id_component_id ON sbom_occurrences USING btree (project_id, component_id); CREATE INDEX index_sbom_occurrences_on_source_id ON sbom_occurrences USING btree (source_id); @@ -32920,9 +33376,9 @@ CREATE UNIQUE INDEX index_sbom_sources_on_source_type_and_source ON sbom_sources CREATE INDEX index_scan_result_policies_on_policy_configuration_id ON scan_result_policies USING btree (security_orchestration_policy_configuration_id); -CREATE INDEX index_scan_result_policies_on_project_id ON scan_result_policies USING btree (project_id); +CREATE UNIQUE INDEX index_scan_result_policies_on_position_in_configuration ON scan_result_policies USING btree (security_orchestration_policy_configuration_id, project_id, orchestration_policy_idx, rule_idx); -CREATE INDEX index_schema_inconsistencies_on_issue_id ON schema_inconsistencies USING btree (issue_id); +CREATE INDEX index_scan_result_policies_on_project_id ON scan_result_policies USING btree (project_id); CREATE INDEX index_scim_identities_on_group_id ON scim_identities USING btree (group_id); @@ -33130,6 +33586,8 @@ CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name); CREATE INDEX index_tags_on_name_trigram ON tags USING gin (name gin_trgm_ops); +CREATE INDEX index_target_branch_rules_on_project_id ON target_branch_rules USING btree (project_id); + CREATE INDEX index_term_agreements_on_term_id ON term_agreements USING btree (term_id); CREATE INDEX index_term_agreements_on_user_id ON term_agreements USING btree (user_id); @@ -33218,6 +33676,8 @@ CREATE UNIQUE INDEX index_unique_ci_runner_projects_on_runner_id_and_project_id CREATE UNIQUE INDEX index_unique_issue_metrics_issue_id ON issue_metrics USING btree (issue_id); +CREATE UNIQUE INDEX index_unique_project_authorizations_on_unique_project_user ON project_authorizations USING btree (project_id, user_id) WHERE is_unique; + CREATE INDEX index_unit_test_failures_failed_at ON ci_unit_test_failures USING btree (failed_at DESC); CREATE UNIQUE INDEX index_unit_test_failures_unique_columns ON ci_unit_test_failures USING btree (unit_test_id, failed_at DESC, build_id); @@ -33310,6 +33770,8 @@ CREATE UNIQUE INDEX index_user_synced_attributes_metadata_on_user_id ON user_syn CREATE INDEX index_users_for_active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND (user_type = ANY (ARRAY[0, 6, 4, 13])) AND (user_type = ANY (ARRAY[0, 4, 5]))); +CREATE INDEX index_users_for_auditors ON users USING btree (id) WHERE (auditor IS TRUE); + CREATE INDEX index_users_on_accepted_term_id ON users USING btree (accepted_term_id); CREATE INDEX index_users_on_admin ON users USING btree (admin); @@ -33380,6 +33842,8 @@ CREATE UNIQUE INDEX index_verification_codes_on_phone_and_visitor_id_code ON ONL COMMENT ON INDEX index_verification_codes_on_phone_and_visitor_id_code IS 'JiHu-specific index'; +CREATE UNIQUE INDEX index_vuln_findings_on_uuid_including_vuln_id ON vulnerability_occurrences USING btree (uuid) INCLUDE (vulnerability_id); + CREATE UNIQUE INDEX index_vuln_historical_statistics_on_project_id_and_date ON vulnerability_historical_statistics USING btree (project_id, date); CREATE INDEX index_vuln_reads_common_query_on_resolved_on_default_branch ON vulnerability_reads USING btree (project_id, state, report_type, vulnerability_id DESC) WHERE (resolved_on_default_branch IS TRUE); @@ -33514,6 +33978,8 @@ CREATE INDEX index_vulnerability_reads_on_location_image_trigram ON vulnerabilit CREATE INDEX index_vulnerability_reads_on_namespace_type_severity_id ON vulnerability_reads USING btree (namespace_id, report_type, severity, vulnerability_id); +CREATE INDEX index_vulnerability_reads_on_project_id_and_vulnerability_id ON vulnerability_reads USING btree (project_id, vulnerability_id); + 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); @@ -33720,12 +34186,14 @@ CREATE INDEX tmp_idx_for_feedback_comment_processing ON vulnerability_feedback U CREATE INDEX tmp_idx_for_vulnerability_feedback_migration ON vulnerability_feedback USING btree (id) WHERE ((migrated_to_state_transition = false) AND (feedback_type = 0)); +CREATE INDEX tmp_idx_orphaned_approval_merge_request_rules ON approval_merge_request_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL)); + +CREATE INDEX tmp_idx_orphaned_approval_project_rules ON approval_project_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL)); + CREATE INDEX tmp_idx_packages_on_project_id_when_npm_not_pending_destruction ON packages_packages USING btree (project_id) WHERE ((package_type = 2) AND (status <> 4)); CREATE INDEX tmp_idx_vuln_reads_where_dismissal_reason_null ON vulnerability_reads USING btree (id) WHERE ((state = 2) AND (dismissal_reason IS NULL)); -CREATE INDEX tmp_idx_vulnerability_occurrences_on_id_where_report_type_7_99 ON vulnerability_occurrences USING btree (id) WHERE (report_type = ANY (ARRAY[7, 99])); - CREATE INDEX tmp_idx_vulns_on_converted_uuid ON vulnerability_occurrences USING btree (id, uuid_convert_string_to_uuid) WHERE (uuid_convert_string_to_uuid = '00000000-0000-0000-0000-000000000000'::uuid); 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)); @@ -33742,12 +34210,16 @@ CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0); +CREATE INDEX tmp_index_project_statistics_pipeline_artifacts_size ON project_statistics USING btree (project_id) WHERE (pipeline_artifacts_size <> 0); + CREATE INDEX tmp_index_vulnerability_dismissal_info ON vulnerabilities USING btree (id) WHERE ((state = 2) AND ((dismissed_at IS NULL) OR (dismissed_by_id IS NULL))); CREATE INDEX tmp_index_vulnerability_overlong_title_html ON vulnerabilities USING btree (id) WHERE (length(title_html) > 800); CREATE UNIQUE INDEX u_project_compliance_standards_adherence_for_reporting ON project_compliance_standards_adherence USING btree (project_id, check_name, standard); +CREATE UNIQUE INDEX uniq_google_cloud_logging_configuration_namespace_id_and_name ON audit_events_google_cloud_logging_configurations USING btree (namespace_id, name); + CREATE UNIQUE INDEX uniq_idx_packages_packages_on_project_id_name_version_ml_model ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 14); CREATE UNIQUE INDEX uniq_idx_user_add_on_assignments_on_add_on_purchase_and_user ON subscription_user_add_on_assignments USING btree (add_on_purchase_id, user_id); @@ -33790,6 +34262,8 @@ CREATE UNIQUE INDEX unique_merge_request_diff_llm_summaries_on_mr_diff_id ON mer CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); +CREATE INDEX unique_ml_model_versions_on_model_id_and_id ON ml_model_versions USING btree (model_id, id DESC); + CREATE UNIQUE INDEX unique_organizations_on_path ON organizations USING btree (path); CREATE UNIQUE INDEX unique_packages_project_id_and_name_and_version_when_debian ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 9) AND (status <> 4)); @@ -33960,10 +34434,14 @@ ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION g ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_070cef72c3; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_08b7071d9b; + ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_08e3cfc564; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_09af45dd6f; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_09fe0c1886; + ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_0c153e2eae; ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_0ca85f3d71; @@ -33976,6 +34454,10 @@ ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH P ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_10588dbff0; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_106d7d97e8; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_1076a9a98a; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_107e123e17; ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1230a7a402; @@ -33990,6 +34472,10 @@ ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION git ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_17fa2812c5; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_19aa18ccc9; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_19f4ed8614; + ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_1a0388713a; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1a349ed064; @@ -33998,6 +34484,8 @@ ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH P ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1b0ea30bdb; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_1b47bbbb6a; + ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1f6c3faabe; ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1f8af04ed1; @@ -34010,8 +34498,12 @@ ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_ ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_206349925b; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_208e7ef042; + ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_2098118748; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_20c6491c6e; + ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_21db459e34; ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_21e262390a; @@ -34052,6 +34544,8 @@ ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2b7c0a294e; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_2bac9d64a0; + ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2c6422f668; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2dfcdbe81e; @@ -34074,6 +34568,8 @@ ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_331eb67441; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_34a8b08081; + ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_3640194b77; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_372160a706; @@ -34088,10 +34584,18 @@ ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_part ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_3a10b315c0; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3a7d21a6ee; + ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_3a8848c00b; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3b09ab5902; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3bc2eedca5; + ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_3c2a3a6ac9; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3dbde77b8b; + ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_3e6be332b7; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_4137a6fac3; @@ -34136,6 +34640,8 @@ ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH P ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4e6ce1c371; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_4ea50d3a5b; + ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4f2eb7a06b; ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_4f6fc34e57; @@ -34164,6 +34670,8 @@ ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_ ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5913107510; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_5968e77935; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_59a8209ab6; ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_59ce40fcc4; @@ -34216,6 +34724,8 @@ ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_66a736da09; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_680d7ab4a6; + ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_682eba05f6; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_69bdcf213e; @@ -34226,6 +34736,10 @@ ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITI ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6b1ce61c8f; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_6b431c9952; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_6bf2b9282c; + ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_6cfb391b86; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_6e560c1a4d; @@ -34246,6 +34760,10 @@ ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_ ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_70c657954b; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_713f462d76; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_71c0e45eca; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_71c2b26944; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_72027c157f; @@ -34262,6 +34780,12 @@ ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_pa ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_77c6293242; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_77f67bf238; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_7822759674; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_7a0b7ffadf; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_7b7c85eceb; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_7da2307d2e; @@ -34272,16 +34796,28 @@ ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_7f543eed8d; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_7f8a80dd47; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_80305b1eed; + ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_807671c4be; ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_807fa83fc0; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_80a81ac235; + ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_80c65daf20; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_81b31eafac; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_81b9cf594f; ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_82c675952c; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_831e7f124f; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_837a193bf2; + ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_837cc295f1; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_83c5049b3e; @@ -34296,6 +34832,8 @@ ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_8688b40056; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_876145d1d5; + ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_87d40fb9f9; ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_88b40d6740; @@ -34314,12 +34852,18 @@ ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION git ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_8fb48e72ce; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_907e12b7ba; + ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_918bb2ebbb; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_91c432a4bd; + ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_91d5e4e3df; ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_9201b952a0; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_927796f71d; + ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_92c09e352b; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_9490e0e0b7; @@ -34330,14 +34874,20 @@ ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_pa ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_971af9481e; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_994aa245b7; + ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_9955b1dc59; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_9a2eb72a3b; + ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_9b8e89ae41; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_9d0e953ab3; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_9ee83b068b; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_a016d4ed08; + ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a1a9dc36c1; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a2d9f185a5; @@ -34346,12 +34896,16 @@ ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH P ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_a46b7b7f26; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_a4f5106804; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a6999c65c9; ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_a6c68d16b2; ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_a8276a450f; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_a849f1bbcc; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a88f20fc98; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_a8fe03fe34; @@ -34366,12 +34920,16 @@ ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitl ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_a9deff2159; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_aa92d75d85; + ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_aabc184267; ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_ab22231a16; ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_abbdf80ab1; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_aca42d7cff; + ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ad55e8b11c; ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_adc159c3fe; @@ -34380,10 +34938,16 @@ ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION g ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_aee84adb5b; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_af8368d587; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_b1dda405af; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b24e8538c8; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b286c595e8; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b377ac6784; + ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b3b64068e7; ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b3c4c9a53f; @@ -34392,18 +34956,28 @@ ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_ ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_b607012614; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b6cc38a848; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b748a3e0a6; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_b7f21460bb; ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_b83fe1306b; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_bb6defaa27; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_bc189e47ab; ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_bca83177ef; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_bcaa8dcd34; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_bcae2cf631; + ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_be0a028bcc; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_beaa329ca0; + ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_bedd7e160b; ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_bee2b94a80; @@ -34424,6 +34998,8 @@ ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION g ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_c2b951bf20; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_c3a2cf8b3b; + ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c42b2e7eae; ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c435d904ce; @@ -34440,6 +35016,8 @@ ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_c7ac8595d3; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_c8bbf2b334; + ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c8c4219c0a; ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_c971e6c5ce; @@ -34472,12 +35050,16 @@ ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_ ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d1c24d8199; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_d1c6c67ec1; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d27b4c84e7; ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d2fe918e83; ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d35c969634; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_d3b6418940; + ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d493a5c171; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_d6047ee813; @@ -34486,12 +35068,16 @@ ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH P ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d70379e22c; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_d87775b2e7; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d8fa9793ad; ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_d9384b768d; ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_db2753330c; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_db6477916f; + ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_dc571ba649; ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_de0334da63; @@ -34522,8 +35108,12 @@ ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_pa ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ea1b583157; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_eadcc94c4e; + ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_eb558957f0; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_eb5a7f918a; + ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_ec25d494e6; ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ece25b5987; @@ -34538,6 +35128,10 @@ ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_ef7be2ae94; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_efa25b26bd; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f06b4c7a23; + ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f0cdd09a5e; ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f112fae8ac; @@ -34550,14 +35144,22 @@ ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_part ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f3d7d86e09; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f402f6a388; + +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f415dc2abd; + ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f47327ec1f; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f5f0e8eefd; + ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f6b0d458a3; ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f705dc8541; ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f76e8a5304; +ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f836021e1e; + ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f86acdc2ff; ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_f86f73056d; @@ -35282,6 +35884,8 @@ ALTER INDEX p_ci_builds_scheduled_at_idx ATTACH PARTITION partial_index_ci_build ALTER INDEX p_ci_builds_token_encrypted_partition_id_idx ATTACH PARTITION unique_ci_builds_token_encrypted_and_partition_id; +CREATE TRIGGER assign_p_ci_builds_id_trigger BEFORE INSERT ON ci_builds FOR EACH ROW EXECUTE FUNCTION assign_p_ci_builds_id_value(); + CREATE TRIGGER chat_names_loose_fk_trigger AFTER DELETE ON chat_names REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); CREATE TRIGGER ci_builds_loose_fk_trigger AFTER DELETE ON ci_builds REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); @@ -35312,13 +35916,21 @@ CREATE TRIGGER push_rules_loose_fk_trigger AFTER DELETE ON push_rules REFERENCIN CREATE TRIGGER tags_loose_fk_trigger AFTER DELETE ON tags REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); +CREATE TRIGGER trigger_07bc3c48f407 BEFORE INSERT OR UPDATE ON ci_stages FOR EACH ROW EXECUTE FUNCTION trigger_07bc3c48f407(); + CREATE TRIGGER trigger_1a857e8db6cd BEFORE INSERT OR UPDATE ON vulnerability_occurrences FOR EACH ROW EXECUTE FUNCTION trigger_1a857e8db6cd(); +CREATE TRIGGER trigger_1bd97da9c1a4 BEFORE INSERT OR UPDATE ON ci_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_1bd97da9c1a4(); + +CREATE TRIGGER trigger_239c8032a8d6 BEFORE INSERT OR UPDATE ON ci_pipeline_chat_data FOR EACH ROW EXECUTE FUNCTION trigger_239c8032a8d6(); + +CREATE TRIGGER trigger_68d7b6653c7d BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_68d7b6653c7d(); + CREATE TRIGGER trigger_7f3d66a7d7f5 BEFORE INSERT OR UPDATE ON ci_pipeline_variables FOR EACH ROW EXECUTE FUNCTION trigger_7f3d66a7d7f5(); CREATE TRIGGER trigger_b2d852e1e2cb BEFORE INSERT OR UPDATE ON ci_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_b2d852e1e2cb(); -CREATE TRIGGER trigger_cd1aeb22b34a BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_cd1aeb22b34a(); +CREATE TRIGGER trigger_bfad0e2b9c86 BEFORE INSERT OR UPDATE ON ci_pipeline_messages FOR EACH ROW EXECUTE FUNCTION trigger_bfad0e2b9c86(); CREATE TRIGGER trigger_delete_project_namespace_on_project_delete AFTER DELETE ON projects FOR EACH ROW WHEN ((old.project_namespace_id IS NOT NULL)) EXECUTE FUNCTION delete_associated_project_namespace(); @@ -35358,6 +35970,10 @@ CREATE TRIGGER trigger_update_has_issues_on_vulnerability_issue_links_delete AFT CREATE TRIGGER trigger_update_has_issues_on_vulnerability_issue_links_update AFTER INSERT ON vulnerability_issue_links FOR EACH ROW EXECUTE FUNCTION set_has_issues_on_vulnerability_reads(); +CREATE TRIGGER trigger_update_has_merge_request_on_vulnerability_mr_links_dele AFTER DELETE ON vulnerability_merge_request_links FOR EACH ROW EXECUTE FUNCTION unset_has_merge_request_on_vulnerability_reads(); + +CREATE TRIGGER trigger_update_has_merge_request_on_vulnerability_mr_links_upda AFTER INSERT ON vulnerability_merge_request_links FOR EACH ROW EXECUTE FUNCTION set_has_merge_request_on_vulnerability_reads(); + CREATE TRIGGER trigger_update_location_on_vulnerability_occurrences_update AFTER UPDATE ON vulnerability_occurrences FOR EACH ROW WHEN (((new.report_type = ANY (ARRAY[2, 7])) AND (((old.location ->> 'image'::text) IS DISTINCT FROM (new.location ->> 'image'::text)) OR (((old.location -> 'kubernetes_resource'::text) ->> 'agent_id'::text) IS DISTINCT FROM ((new.location -> 'kubernetes_resource'::text) ->> 'agent_id'::text))))) EXECUTE FUNCTION update_location_from_vulnerability_occurrences(); CREATE TRIGGER trigger_update_vulnerability_reads_on_vulnerability_update AFTER UPDATE ON vulnerabilities FOR EACH ROW WHEN (((old.present_on_default_branch IS TRUE) AND ((old.severity IS DISTINCT FROM new.severity) OR (old.state IS DISTINCT FROM new.state) OR (old.resolved_on_default_branch IS DISTINCT FROM new.resolved_on_default_branch)))) EXECUTE FUNCTION update_vulnerability_reads_from_vulnerability(); @@ -35448,6 +36064,9 @@ ALTER TABLE ONLY vulnerabilities ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_131d289c65 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; +ALTER TABLE ONLY catalog_resource_versions + ADD CONSTRAINT fk_15376d917e FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE; + ALTER TABLE ONLY sbom_occurrences ADD CONSTRAINT fk_157506c0e2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -35475,9 +36094,6 @@ ALTER TABLE ONLY ci_pipelines ALTER TABLE ONLY analytics_devops_adoption_segments ADD CONSTRAINT fk_190a24754d FOREIGN KEY (display_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; -ALTER TABLE ONLY user_details - ADD CONSTRAINT fk_190e4fcc88 FOREIGN KEY (provisioned_by_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; - ALTER TABLE ONLY agent_project_authorizations ADD CONSTRAINT fk_1d30bb4987 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -35826,6 +36442,9 @@ ALTER TABLE ONLY environments ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_76bc5f5455 FOREIGN KEY (resolved_by_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY notes + ADD CONSTRAINT fk_76db6d50c6 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY oauth_openid_requests ADD CONSTRAINT fk_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES oauth_access_grants(id) ON DELETE CASCADE; @@ -35853,6 +36472,9 @@ ALTER TABLE ONLY scan_result_policies ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_7ac31eacb9 FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY catalog_resource_versions + ADD CONSTRAINT fk_7ad8849db4 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY issue_customer_relations_contacts ADD CONSTRAINT fk_7b92f835bb FOREIGN KEY (contact_id) REFERENCES customer_relations_contacts(id) ON DELETE CASCADE; @@ -35892,6 +36514,9 @@ ALTER TABLE ONLY merge_request_diffs ALTER TABLE ONLY requirements ADD CONSTRAINT fk_85044baef0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY catalog_resource_components + ADD CONSTRAINT fk_85bb1d1e79 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_build_pending_states ADD CONSTRAINT fk_861cd17da3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; @@ -35919,6 +36544,9 @@ ALTER TABLE ONLY issues ALTER TABLE ONLY ci_build_trace_chunks ADD CONSTRAINT fk_89e29fa5ee_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE ONLY catalog_resource_components + ADD CONSTRAINT fk_89fd1a3e33 FOREIGN KEY (version_id) REFERENCES catalog_resource_versions(id) ON DELETE CASCADE; + ALTER TABLE ONLY protected_branch_merge_access_levels ADD CONSTRAINT fk_8a3072ccb3 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; @@ -36018,9 +36646,6 @@ ALTER TABLE p_ci_builds ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT fk_a44ff95be5 FOREIGN KEY (parent_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE; -ALTER TABLE ONLY users - ADD CONSTRAINT fk_a4b8fefe3e FOREIGN KEY (managing_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; - ALTER TABLE ONLY security_orchestration_policy_configurations ADD CONSTRAINT fk_a50430b375 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -36090,6 +36715,9 @@ ALTER TABLE ONLY issues ALTER TABLE ONLY protected_tag_create_access_levels ADD CONSTRAINT fk_b4eb82fe3c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY catalog_resource_versions + ADD CONSTRAINT fk_b670eae96b FOREIGN KEY (catalog_resource_id) REFERENCES catalog_resources(id) ON DELETE CASCADE; + ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT fk_b69fa2b2df FOREIGN KEY (bulk_import_id) REFERENCES bulk_imports(id) ON DELETE CASCADE; @@ -36174,9 +36802,6 @@ ALTER TABLE ONLY timelogs ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_c4b1c1f66e FOREIGN KEY (repository_deleted_event_id) REFERENCES geo_repository_deleted_events(id) ON DELETE CASCADE; -ALTER TABLE ONLY user_details - ADD CONSTRAINT fk_c53c794142 FOREIGN KEY (enterprise_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; - ALTER TABLE ONLY issues ADD CONSTRAINT fk_c63cbf6c25 FOREIGN KEY (closed_by_id) REFERENCES users(id) ON DELETE SET NULL; @@ -36351,6 +36976,9 @@ ALTER TABLE ONLY merge_request_diff_llm_summaries ALTER TABLE ONLY pages_domains ADD CONSTRAINT fk_ea2f6dfc6f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY catalog_resource_components + ADD CONSTRAINT fk_ec417536da FOREIGN KEY (catalog_resource_id) REFERENCES catalog_resources(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_requests_compliance_violations ADD CONSTRAINT fk_ec881c1c6f FOREIGN KEY (violating_user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -37122,6 +37750,9 @@ ALTER TABLE ONLY sbom_component_versions ALTER TABLE ONLY status_page_published_incidents ADD CONSTRAINT fk_rails_61e5493940 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY group_ssh_certificates + ADD CONSTRAINT fk_rails_61f9eafcdf FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY container_repository_states ADD CONSTRAINT fk_rails_63436c99ce FOREIGN KEY (container_repository_id) REFERENCES container_repositories(id) ON DELETE CASCADE; @@ -37227,6 +37858,9 @@ ALTER TABLE ONLY ci_builds_runner_session ALTER TABLE ONLY list_user_preferences ADD CONSTRAINT fk_rails_70b2ef5ce2 FOREIGN KEY (list_id) REFERENCES lists(id) ON DELETE CASCADE; +ALTER TABLE issue_search_data + ADD CONSTRAINT fk_rails_7149dd9eee FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_custom_attributes ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -37527,6 +38161,9 @@ ALTER TABLE ONLY badges ALTER TABLE ONLY vulnerability_finding_signatures ADD CONSTRAINT fk_rails_9e0baf9dcd FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; +ALTER TABLE ONLY target_branch_rules + ADD CONSTRAINT fk_rails_9e9cf81c8e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY timelog_categories ADD CONSTRAINT fk_rails_9f27b821a8 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -37950,9 +38587,6 @@ ALTER TABLE ONLY packages_debian_group_component_files ALTER TABLE ONLY incident_management_timeline_event_tags ADD CONSTRAINT fk_rails_dd5c91484e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; -ALTER TABLE ONLY schema_inconsistencies - ADD CONSTRAINT fk_rails_dd7d763602 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; - ALTER TABLE ONLY user_callouts ADD CONSTRAINT fk_rails_ddfdd80f3d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -38220,6 +38854,9 @@ ALTER TABLE issue_search_data ALTER TABLE product_analytics_events_experimental ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_pipeline_variables + ADD CONSTRAINT temp_fk_rails_8d3b04e3e1 FOREIGN KEY (pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE NOT VALID; + ALTER TABLE ONLY user_follow_users ADD CONSTRAINT user_follow_users_followee_id_fkey FOREIGN KEY (followee_id) REFERENCES users(id) ON DELETE CASCADE; |