diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 11:41:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 11:41:52 +0300 |
commit | 585826cb22ecea5998a2c2a4675735c94bdeedac (patch) | |
tree | 5b05f0b30d33cef48963609e8a18a4dff260eab3 /db | |
parent | df221d036e5d0c6c0ee4d55b9c97f481ee05dee8 (diff) |
Add latest changes from gitlab-org/gitlab@16-6-stable-eev16.6.0-rc42
Diffstat (limited to 'db')
338 files changed, 3775 insertions, 516 deletions
diff --git a/db/click_house/main/20230705124511_create_events.sql b/db/click_house/main/20230705124511_create_events.sql deleted file mode 100644 index 8af45443e4c..00000000000 --- a/db/click_house/main/20230705124511_create_events.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE events -( - id UInt64 DEFAULT 0, - path String DEFAULT '', - author_id UInt64 DEFAULT 0, - target_id UInt64 DEFAULT 0, - target_type LowCardinality(String) DEFAULT '', - action UInt8 DEFAULT 0, - deleted UInt8 DEFAULT 0, - created_at DateTime64(6, 'UTC') DEFAULT now(), - updated_at DateTime64(6, 'UTC') DEFAULT now() -) -ENGINE = ReplacingMergeTree(updated_at, deleted) -PRIMARY KEY (id) -ORDER BY (id) -PARTITION BY toYear(created_at) diff --git a/db/click_house/main/20230707151359_create_ci_finished_builds.sql b/db/click_house/main/20230707151359_create_ci_finished_builds.sql deleted file mode 100644 index 5c2cc0e8eb3..00000000000 --- a/db/click_house/main/20230707151359_create_ci_finished_builds.sql +++ /dev/null @@ -1,33 +0,0 @@ --- source table for CI analytics, almost useless on it's own, but it's a basis for creating materialized views -CREATE TABLE ci_finished_builds -( - id UInt64 DEFAULT 0, - project_id UInt64 DEFAULT 0, - pipeline_id UInt64 DEFAULT 0, - status LowCardinality(String) DEFAULT '', - - --- Fields to calculate timings - created_at DateTime64(6, 'UTC') DEFAULT now(), - queued_at DateTime64(6, 'UTC') DEFAULT now(), - finished_at DateTime64(6, 'UTC') DEFAULT now(), - started_at DateTime64(6, 'UTC') DEFAULT now(), - - runner_id UInt64 DEFAULT 0, - runner_manager_system_xid String DEFAULT '', - - --- Runner fields - runner_run_untagged Boolean DEFAULT FALSE, - runner_type UInt8 DEFAULT 0, - runner_manager_version LowCardinality(String) DEFAULT '', - runner_manager_revision LowCardinality(String) DEFAULT '', - runner_manager_platform LowCardinality(String) DEFAULT '', - runner_manager_architecture LowCardinality(String) DEFAULT '', - - --- Materialized columns - duration Int64 MATERIALIZED age('ms', started_at, finished_at), - queueing_duration Int64 MATERIALIZED age('ms', queued_at, started_at) - --- This table is incomplete, we'll add more fields before starting the data migration -) -ENGINE = ReplacingMergeTree -- Using ReplacingMergeTree just in case we accidentally insert the same data twice -ORDER BY (status, runner_type, project_id, finished_at, id) -PARTITION BY toYear(finished_at) diff --git a/db/click_house/main/20230719101806_create_ci_finished_builds_aggregated_queueing_delay_percentiles.sql b/db/click_house/main/20230719101806_create_ci_finished_builds_aggregated_queueing_delay_percentiles.sql deleted file mode 100644 index 56889ffc0d4..00000000000 --- a/db/click_house/main/20230719101806_create_ci_finished_builds_aggregated_queueing_delay_percentiles.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE ci_finished_builds_aggregated_queueing_delay_percentiles -( - status LowCardinality(String) DEFAULT '', - runner_type UInt8 DEFAULT 0, - started_at_bucket DateTime64(6, 'UTC') DEFAULT now(), - - count_builds AggregateFunction(count), - queueing_duration_quantile AggregateFunction(quantile, Int64) -) -ENGINE = AggregatingMergeTree() -ORDER BY (started_at_bucket, status, runner_type) diff --git a/db/click_house/main/20230724064832_create_contribution_analytics_events.sql b/db/click_house/main/20230724064832_create_contribution_analytics_events.sql deleted file mode 100644 index 7867897e897..00000000000 --- a/db/click_house/main/20230724064832_create_contribution_analytics_events.sql +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index 669b03ce0f3..00000000000 --- a/db/click_house/main/20230724064918_contribution_analytics_events_materialized_view.sql +++ /dev/null @@ -1,16 +0,0 @@ -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/click_house/main/20230808070520_create_events_cursor.sql b/db/click_house/main/20230808070520_create_events_cursor.sql deleted file mode 100644 index effc3c64f60..00000000000 --- a/db/click_house/main/20230808070520_create_events_cursor.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE sync_cursors -( - table_name LowCardinality(String) DEFAULT '', - primary_key_value UInt64 DEFAULT 0, - recorded_at DateTime64(6, 'UTC') DEFAULT now() -) -ENGINE = ReplacingMergeTree(recorded_at) -ORDER BY (table_name) -PRIMARY KEY (table_name) diff --git a/db/click_house/main/20230808140217_create_ci_finished_builds_aggregated_queueing_delay_percentiles_mv.sql b/db/click_house/main/20230808140217_create_ci_finished_builds_aggregated_queueing_delay_percentiles_mv.sql deleted file mode 100644 index 504e2d87609..00000000000 --- a/db/click_house/main/20230808140217_create_ci_finished_builds_aggregated_queueing_delay_percentiles_mv.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE MATERIALIZED VIEW ci_finished_builds_aggregated_queueing_delay_percentiles_mv -TO ci_finished_builds_aggregated_queueing_delay_percentiles -AS -SELECT - status, - runner_type, - toStartOfInterval(started_at, INTERVAL 5 minute) AS started_at_bucket, - - countState(*) as count_builds, - quantileState(queueing_duration) AS queueing_duration_quantile -FROM ci_finished_builds -GROUP BY status, runner_type, started_at_bucket diff --git a/db/click_house/migrate/20230705124511_create_events.rb b/db/click_house/migrate/20230705124511_create_events.rb new file mode 100644 index 00000000000..cd60ade5d4d --- /dev/null +++ b/db/click_house/migrate/20230705124511_create_events.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CreateEvents < ClickHouse::Migration + def up + execute <<~SQL + CREATE TABLE IF NOT EXISTS events + ( + id UInt64 DEFAULT 0, + path String DEFAULT '', + author_id UInt64 DEFAULT 0, + target_id UInt64 DEFAULT 0, + target_type LowCardinality(String) DEFAULT '', + action UInt8 DEFAULT 0, + deleted UInt8 DEFAULT 0, + created_at DateTime64(6, 'UTC') DEFAULT now(), + updated_at DateTime64(6, 'UTC') DEFAULT now() + ) + ENGINE = ReplacingMergeTree(updated_at, deleted) + PRIMARY KEY (id) + ORDER BY (id) + PARTITION BY toYear(created_at) + SQL + end + + def down + execute <<~SQL + DROP TABLE events + SQL + end +end diff --git a/db/click_house/migrate/20230707151359_create_ci_finished_builds.rb b/db/click_house/migrate/20230707151359_create_ci_finished_builds.rb new file mode 100644 index 00000000000..39521af8d99 --- /dev/null +++ b/db/click_house/migrate/20230707151359_create_ci_finished_builds.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +class CreateCiFinishedBuilds < ClickHouse::Migration + def up + execute <<~SQL + -- source table for CI analytics, almost useless on it's own, but it's a basis for creating materialized views + CREATE TABLE IF NOT EXISTS ci_finished_builds + ( + id UInt64 DEFAULT 0, + project_id UInt64 DEFAULT 0, + pipeline_id UInt64 DEFAULT 0, + status LowCardinality(String) DEFAULT '', + + --- Fields to calculate timings + created_at DateTime64(6, 'UTC') DEFAULT now(), + queued_at DateTime64(6, 'UTC') DEFAULT now(), + finished_at DateTime64(6, 'UTC') DEFAULT now(), + started_at DateTime64(6, 'UTC') DEFAULT now(), + + runner_id UInt64 DEFAULT 0, + runner_manager_system_xid String DEFAULT '', + + --- Runner fields + runner_run_untagged Boolean DEFAULT FALSE, + runner_type UInt8 DEFAULT 0, + runner_manager_version LowCardinality(String) DEFAULT '', + runner_manager_revision LowCardinality(String) DEFAULT '', + runner_manager_platform LowCardinality(String) DEFAULT '', + runner_manager_architecture LowCardinality(String) DEFAULT '', + + --- Materialized columns + duration Int64 MATERIALIZED age('ms', started_at, finished_at), + queueing_duration Int64 MATERIALIZED age('ms', queued_at, started_at) + --- This table is incomplete, we'll add more fields before starting the data migration + ) + ENGINE = ReplacingMergeTree -- Using ReplacingMergeTree just in case we accidentally insert the same data twice + ORDER BY (status, runner_type, project_id, finished_at, id) + PARTITION BY toYear(finished_at) + SQL + end + + def down + execute <<~SQL + DROP TABLE ci_finished_builds + SQL + end +end diff --git a/db/click_house/migrate/20230719101806_create_ci_finished_builds_aggregated_queueing_delay_percentiles.rb b/db/click_house/migrate/20230719101806_create_ci_finished_builds_aggregated_queueing_delay_percentiles.rb new file mode 100644 index 00000000000..47934d8fe02 --- /dev/null +++ b/db/click_house/migrate/20230719101806_create_ci_finished_builds_aggregated_queueing_delay_percentiles.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateCiFinishedBuildsAggregatedQueueingDelayPercentiles < ClickHouse::Migration + def up + execute <<~SQL + CREATE TABLE IF NOT EXISTS ci_finished_builds_aggregated_queueing_delay_percentiles + ( + status LowCardinality(String) DEFAULT '', + runner_type UInt8 DEFAULT 0, + started_at_bucket DateTime64(6, 'UTC') DEFAULT now(), + + count_builds AggregateFunction(count), + queueing_duration_quantile AggregateFunction(quantile, Int64) + ) + ENGINE = AggregatingMergeTree() + ORDER BY (started_at_bucket, status, runner_type) + SQL + end + + def down + execute <<~SQL + DROP TABLE ci_finished_builds_aggregated_queueing_delay_percentiles + SQL + end +end diff --git a/db/click_house/migrate/20230724064832_create_contribution_analytics_events.rb b/db/click_house/migrate/20230724064832_create_contribution_analytics_events.rb new file mode 100644 index 00000000000..2606ae3adc9 --- /dev/null +++ b/db/click_house/migrate/20230724064832_create_contribution_analytics_events.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class CreateContributionAnalyticsEvents < ClickHouse::Migration + def up + execute <<~SQL + CREATE TABLE IF NOT EXISTS 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); + SQL + end + + def down + execute <<~SQL + DROP TABLE contribution_analytics_events + SQL + end +end diff --git a/db/click_house/migrate/20230724064918_create_contribution_analytics_events_materialized_view.rb b/db/click_house/migrate/20230724064918_create_contribution_analytics_events_materialized_view.rb new file mode 100644 index 00000000000..956a26d80f3 --- /dev/null +++ b/db/click_house/migrate/20230724064918_create_contribution_analytics_events_materialized_view.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CreateContributionAnalyticsEventsMaterializedView < ClickHouse::Migration + def up + execute <<~SQL + CREATE MATERIALIZED VIEW IF NOT EXISTS 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 + SQL + end + + def down + execute <<~SQL + DROP VIEW contribution_analytics_events_mv + SQL + end +end diff --git a/db/click_house/migrate/20230808070520_create_sync_cursors.rb b/db/click_house/migrate/20230808070520_create_sync_cursors.rb new file mode 100644 index 00000000000..7583f8ec0c5 --- /dev/null +++ b/db/click_house/migrate/20230808070520_create_sync_cursors.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class CreateSyncCursors < ClickHouse::Migration + def up + execute <<~SQL + CREATE TABLE IF NOT EXISTS sync_cursors + ( + table_name LowCardinality(String) DEFAULT '', + primary_key_value UInt64 DEFAULT 0, + recorded_at DateTime64(6, 'UTC') DEFAULT now() + ) + ENGINE = ReplacingMergeTree(recorded_at) + ORDER BY (table_name) + PRIMARY KEY (table_name) + SQL + end + + def down + execute <<~SQL + DROP TABLE sync_cursors + SQL + end +end diff --git a/db/click_house/migrate/20230808140217_create_ci_finished_builds_aggregated_queueing_delay_percentiles_mv.rb b/db/click_house/migrate/20230808140217_create_ci_finished_builds_aggregated_queueing_delay_percentiles_mv.rb new file mode 100644 index 00000000000..cc029d48436 --- /dev/null +++ b/db/click_house/migrate/20230808140217_create_ci_finished_builds_aggregated_queueing_delay_percentiles_mv.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class CreateCiFinishedBuildsAggregatedQueueingDelayPercentilesMv < ClickHouse::Migration + def up + execute <<~SQL + CREATE MATERIALIZED VIEW IF NOT EXISTS ci_finished_builds_aggregated_queueing_delay_percentiles_mv + TO ci_finished_builds_aggregated_queueing_delay_percentiles + AS + SELECT + status, + runner_type, + toStartOfInterval(started_at, INTERVAL 5 minute) AS started_at_bucket, + + countState(*) as count_builds, + quantileState(queueing_duration) AS queueing_duration_quantile + FROM ci_finished_builds + GROUP BY status, runner_type, started_at_bucket + SQL + end + + def down + execute <<~SQL + DROP VIEW ci_finished_builds_aggregated_queueing_delay_percentiles_mv + SQL + end +end diff --git a/db/click_house/migrate/20231106202300_modify_ci_finished_builds_settings.rb b/db/click_house/migrate/20231106202300_modify_ci_finished_builds_settings.rb new file mode 100644 index 00000000000..d9951725c9b --- /dev/null +++ b/db/click_house/migrate/20231106202300_modify_ci_finished_builds_settings.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ModifyCiFinishedBuildsSettings < ClickHouse::Migration + def up + execute <<~SQL + ALTER TABLE ci_finished_builds MODIFY SETTING use_async_block_ids_cache = true + SQL + end + + def down + execute <<~SQL + ALTER TABLE ci_finished_builds MODIFY SETTING use_async_block_ids_cache = false + SQL + end +end diff --git a/db/docs/activity_pub_releases_subscriptions.yml b/db/docs/activity_pub_releases_subscriptions.yml new file mode 100644 index 00000000000..d759aada5a9 --- /dev/null +++ b/db/docs/activity_pub_releases_subscriptions.yml @@ -0,0 +1,11 @@ +--- +table_name: activity_pub_releases_subscriptions +classes: +- ActivityPub::ReleasesSubscription +feature_categories: +- release_orchestration +description: Stores subscriptions from external users through ActivityPub for project + releases +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132889 +milestone: '16.6' +gitlab_schema: gitlab_main diff --git a/db/docs/approval_group_rules.yml b/db/docs/approval_group_rules.yml new file mode 100644 index 00000000000..b9dab08c5df --- /dev/null +++ b/db/docs/approval_group_rules.yml @@ -0,0 +1,10 @@ +--- +table_name: approval_group_rules +classes: +- ApprovalRules::ApprovalGroupRule +feature_categories: +- source_code_management +description: Keeps approval group rules +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132651 +milestone: '16.5' +gitlab_schema: gitlab_main diff --git a/db/docs/approval_group_rules_groups.yml b/db/docs/approval_group_rules_groups.yml new file mode 100644 index 00000000000..0599af6ac15 --- /dev/null +++ b/db/docs/approval_group_rules_groups.yml @@ -0,0 +1,9 @@ +--- +table_name: approval_group_rules_groups +classes: [] +feature_categories: + - source_code_management +description: Keeps connection between group and a group approval rule +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132651 +milestone: '16.5' +gitlab_schema: gitlab_main diff --git a/db/docs/approval_group_rules_protected_branches.yml b/db/docs/approval_group_rules_protected_branches.yml new file mode 100644 index 00000000000..ac55f0980be --- /dev/null +++ b/db/docs/approval_group_rules_protected_branches.yml @@ -0,0 +1,9 @@ +--- +table_name: approval_group_rules_protected_branches +classes: [] +feature_categories: + - source_code_management +description: Keeps relation between approval group rules and protected branches. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132651 +milestone: '16.5' +gitlab_schema: gitlab_main diff --git a/db/docs/approval_group_rules_users.yml b/db/docs/approval_group_rules_users.yml new file mode 100644 index 00000000000..67271d2a35d --- /dev/null +++ b/db/docs/approval_group_rules_users.yml @@ -0,0 +1,9 @@ +--- +table_name: approval_group_rules_users +classes: [] +feature_categories: + - source_code_management +description: Keeps connection between user and a group approval rule +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132651 +milestone: '16.5' +gitlab_schema: gitlab_main diff --git a/db/docs/approval_project_rules.yml b/db/docs/approval_project_rules.yml index c970b86bb18..9208e49d49d 100644 --- a/db/docs/approval_project_rules.yml +++ b/db/docs/approval_project_rules.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps approval project rules introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497 milestone: '11.7' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/audit_events_external_audit_event_destinations.yml b/db/docs/audit_events_external_audit_event_destinations.yml index 91fb1e5a17a..534d3470e7b 100644 --- a/db/docs/audit_events_external_audit_event_destinations.yml +++ b/db/docs/audit_events_external_audit_event_destinations.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70706 milestone: '14.4' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/audit_events_google_cloud_logging_configurations.yml b/db/docs/audit_events_google_cloud_logging_configurations.yml index bd6c13a1fdf..e910071eaa3 100644 --- a/db/docs/audit_events_google_cloud_logging_configurations.yml +++ b/db/docs/audit_events_google_cloud_logging_configurations.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores Google Cloud Logging configurations associated with IAM service accounts, used for generating access tokens. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/409421 milestone: '16.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/audit_events_streaming_http_group_namespace_filters.yml b/db/docs/audit_events_streaming_http_group_namespace_filters.yml new file mode 100644 index 00000000000..df08e8b57d2 --- /dev/null +++ b/db/docs/audit_events_streaming_http_group_namespace_filters.yml @@ -0,0 +1,10 @@ +--- +table_name: audit_events_streaming_http_group_namespace_filters +classes: + - AuditEvents::Streaming::HTTP::NamespaceFilter +feature_categories: + - audit_events +description: Represents a subgroup or project filter for audit event streaming on groups +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135080 +milestone: '16.6' +gitlab_schema: gitlab_main diff --git a/db/docs/batched_background_migrations/backfill_packages_tags_project_id.yml b/db/docs/batched_background_migrations/backfill_packages_tags_project_id.yml new file mode 100644 index 00000000000..b8caef928bb --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_packages_tags_project_id.yml @@ -0,0 +1,9 @@ +--- +migration_job_name: BackfillPackagesTagsProjectId +description: Populates the new `packages_tags.project_id` column after joining with the `packages_packages` table +feature_category: package_registry +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135451 +milestone: 16.6 +queued_migration_version: 20231030071209 +finalize_after: '2023-12-23' +finalized_by: # version of the migration that ensured this bbm diff --git a/db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml b/db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml new file mode 100644 index 00000000000..cd85f7e4ab2 --- /dev/null +++ b/db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml @@ -0,0 +1,7 @@ +--- +migration_job_name: DeleteInvalidProtectedBranchMergeAccessLevels +description: Remove rows from protected_branch_merge_access_levels for groups that do not have project_group_links to the project for the associated protected branch +feature_category: source_code_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/427486 +milestone: 16.6 +queued_migration_version: 20231016173129 diff --git a/db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml b/db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml new file mode 100644 index 00000000000..dd92e35f26f --- /dev/null +++ b/db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml @@ -0,0 +1,7 @@ +--- +migration_job_name: DeleteInvalidProtectedBranchPushAccessLevels +description: Remove rows from protected_branch_push_access_levels for groups that do not have project_group_links to the project for the associated protected branch +feature_category: source_code_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/427486 +milestone: 16.6 +queued_migration_version: 20231016194927 diff --git a/db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml b/db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml new file mode 100644 index 00000000000..0c406c7650b --- /dev/null +++ b/db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml @@ -0,0 +1,7 @@ +--- +migration_job_name: DeleteInvalidProtectedTagCreateAccessLevels +description: Remove rows from protected_tag_create_access_levels for groups that do not have project_group_links to the project for the associated protected tag +feature_category: source_code_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/427486 +milestone: 16.6 +queued_migration_version: 20231016194943 diff --git a/db/docs/compliance_framework_security_policies.yml b/db/docs/compliance_framework_security_policies.yml new file mode 100644 index 00000000000..9f16b703a9d --- /dev/null +++ b/db/docs/compliance_framework_security_policies.yml @@ -0,0 +1,10 @@ +--- +table_name: compliance_framework_security_policies +classes: +- ComplianceManagement::ComplianceFramework::SecurityPolicy +feature_categories: +- security_policy_management +description: Persists the relation between compliance_frameworks and security_orchestration_policy_configurations +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135291 +milestone: '16.6' +gitlab_schema: gitlab_main diff --git a/db/docs/container_expiration_policies.yml b/db/docs/container_expiration_policies.yml index 8cc8c675cf9..b1c203134e7 100644 --- a/db/docs/container_expiration_policies.yml +++ b/db/docs/container_expiration_policies.yml @@ -7,4 +7,4 @@ feature_categories: description: Project level settings for container registry cleanup policies introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20412 milestone: '12.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/events.yml b/db/docs/events.yml index 04d90a24ec9..4e493fefea3 100644 --- a/db/docs/events.yml +++ b/db/docs/events.yml @@ -14,4 +14,4 @@ feature_categories: description: Stores events created by users interacting with various product features introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/a847501fd2ffc1c4becc7d0d352d80168d9b3568 milestone: "2.2" -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/fork_network_members.yml b/db/docs/fork_network_members.yml index c3dd193b4aa..a164593c5e1 100644 --- a/db/docs/fork_network_members.yml +++ b/db/docs/fork_network_members.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps track of fork relations between projects. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62186 milestone: '10.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/fork_networks.yml b/db/docs/fork_networks.yml index ca0960dd93a..65938326da7 100644 --- a/db/docs/fork_networks.yml +++ b/db/docs/fork_networks.yml @@ -7,4 +7,4 @@ feature_categories: description: When a project is first forked, a row is created in this table. Also referenced by the fork_network_members table. This is used to know which projects can send merge reqeusts to each other. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3098 milestone: '10.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/group_merge_request_approval_settings.yml b/db/docs/group_merge_request_approval_settings.yml index c3b6bb8877c..b81d6f3c165 100644 --- a/db/docs/group_merge_request_approval_settings.yml +++ b/db/docs/group_merge_request_approval_settings.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps merge request approval settings per group introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50256 milestone: '13.8' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/incident_management_timeline_event_tags.yml b/db/docs/incident_management_timeline_event_tags.yml index aba8f7db152..9243616d26a 100644 --- a/db/docs/incident_management_timeline_event_tags.yml +++ b/db/docs/incident_management_timeline_event_tags.yml @@ -7,4 +7,4 @@ feature_categories: description: Persists tags for timeline events in a project. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100271 milestone: '15.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/internal_ids.yml b/db/docs/internal_ids.yml index 5109a51802c..53e83142780 100644 --- a/db/docs/internal_ids.yml +++ b/db/docs/internal_ids.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps track of counters scoped to a certain context, e.g. a project-wide counter for issues. introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17580 milestone: '10.7' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/ip_restrictions.yml b/db/docs/ip_restrictions.yml index fbf90135d0a..dd7615dce24 100644 --- a/db/docs/ip_restrictions.yml +++ b/db/docs/ip_restrictions.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/12669 milestone: '12.0' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/labels.yml b/db/docs/labels.yml index f43814ced30..83956783891 100644 --- a/db/docs/labels.yml +++ b/db/docs/labels.yml @@ -11,4 +11,4 @@ description: Information related to labels, which can be associated with groups projects introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/03654a6abf47c88b8b980a6707874ff78080d2fe milestone: '7.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/lfs_file_locks.yml b/db/docs/lfs_file_locks.yml index 07850aedddb..c487fa3d42a 100644 --- a/db/docs/lfs_file_locks.yml +++ b/db/docs/lfs_file_locks.yml @@ -7,4 +7,4 @@ feature_categories: description: File locks for LFS objects introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4091 milestone: '10.5' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/ml_model_metadata.yml b/db/docs/ml_model_metadata.yml new file mode 100644 index 00000000000..0f48f71dcbb --- /dev/null +++ b/db/docs/ml_model_metadata.yml @@ -0,0 +1,10 @@ +--- +table_name: ml_model_metadata +classes: + - Ml::ModelMetadata +feature_categories: + - mlops +gitlab_schema: gitlab_main +description: A Model Metadata record holds extra information about the model +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134443 +milestone: 16.6 diff --git a/db/docs/namespace_aggregation_schedules.yml b/db/docs/namespace_aggregation_schedules.yml index d57311fff8f..a6434e5601c 100644 --- a/db/docs/namespace_aggregation_schedules.yml +++ b/db/docs/namespace_aggregation_schedules.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps update schedules for namespace_root_storage_statistics introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29570 milestone: '12.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/namespace_commit_emails.yml b/db/docs/namespace_commit_emails.yml index c19ff1c577b..c5afcfaaebd 100644 --- a/db/docs/namespace_commit_emails.yml +++ b/db/docs/namespace_commit_emails.yml @@ -7,4 +7,4 @@ feature_categories: description: User default email for commits from the GitLab UI introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101832 milestone: '15.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/namespaces.yml b/db/docs/namespaces.yml index ba3d345d8c7..8fa7c2a3d31 100644 --- a/db/docs/namespaces.yml +++ b/db/docs/namespaces.yml @@ -11,3 +11,10 @@ description: Storing namespaces records for groups, users and projects introduced_by_url: https://github.com/gitlabhq/gitlabhq/pull/2051 milestone: "<6.0" gitlab_schema: gitlab_main_cell +schema_inconsistencies: +- type: missing_indexes + object_name: index_namespaces_on_created_at + introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134948 +- type: missing_indexes + object_name: index_namespaces_on_ldap_sync_last_successful_update_at + introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135040 diff --git a/db/docs/namespaces_sync_events.yml b/db/docs/namespaces_sync_events.yml index fdac8accd7f..f654ca8657e 100644 --- a/db/docs/namespaces_sync_events.yml +++ b/db/docs/namespaces_sync_events.yml @@ -7,4 +7,4 @@ feature_categories: description: Used as a queue of data that needs to be synchronized between the `ci` and `main` database introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75517 milestone: '14.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/onboarding_progresses.yml b/db/docs/onboarding_progresses.yml index 805b674d44b..ff7a80a1db5 100644 --- a/db/docs/onboarding_progresses.yml +++ b/db/docs/onboarding_progresses.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50711 milestone: '13.8' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/p_ci_job_annotations.yml b/db/docs/p_ci_job_annotations.yml index 62a1b56abad..aae2ea67295 100644 --- a/db/docs/p_ci_job_annotations.yml +++ b/db/docs/p_ci_job_annotations.yml @@ -6,4 +6,5 @@ feature_categories: - build_artifacts description: Stores user provided annotations for jobs. Currently storing extra information for a given job feed by API. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117319 +milestone: '16.1' gitlab_schema: gitlab_ci diff --git a/db/docs/path_locks.yml b/db/docs/path_locks.yml index f27856d5dee..ba36f45ce4d 100644 --- a/db/docs/path_locks.yml +++ b/db/docs/path_locks.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores paths to repository blobs locked by users introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/684e9d1b5979e11d2edae11a3028a696bfcdedf8 milestone: '8.9' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_ci_cd_settings.yml b/db/docs/project_ci_cd_settings.yml index 265ec896247..0f7f59dbb15 100644 --- a/db/docs/project_ci_cd_settings.yml +++ b/db/docs/project_ci_cd_settings.yml @@ -9,4 +9,4 @@ feature_categories: description: Project-scoped settings related to the CI/CD domain introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/392c411bdc16386ef42c86afaf8c4d8e4cddb955 milestone: '10.8' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_compliance_standards_adherence.yml b/db/docs/project_compliance_standards_adherence.yml index c2f08e9f82c..78fbf8a8a46 100644 --- a/db/docs/project_compliance_standards_adherence.yml +++ b/db/docs/project_compliance_standards_adherence.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores the details about projects and their adherence to compliance standards introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122293 milestone: '16.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_group_links.yml b/db/docs/project_group_links.yml index aa981adb745..927fc05bf2a 100644 --- a/db/docs/project_group_links.yml +++ b/db/docs/project_group_links.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/3ac5a759e93e632539438d4564582c645a9f6799 milestone: "<6.0" -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_import_data.yml b/db/docs/project_import_data.yml index 283657a1dd3..d0ea6a3f2bc 100644 --- a/db/docs/project_import_data.yml +++ b/db/docs/project_import_data.yml @@ -7,4 +7,4 @@ feature_categories: description: Used to store credentials and configuration of external projects when using the Import/Export feature introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/7d98c8842d6bc9b14fb410f028db7ab651961b42 milestone: '7.10' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_pages_metadata.yml b/db/docs/project_pages_metadata.yml index d9b609d7784..e0d70015784 100644 --- a/db/docs/project_pages_metadata.yml +++ b/db/docs/project_pages_metadata.yml @@ -7,4 +7,4 @@ feature_categories: description: Store GitLab Pages metadata for projects. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17197 milestone: '12.4' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_repositories.yml b/db/docs/project_repositories.yml index 2a3e37098c7..fdad3bb3e4f 100644 --- a/db/docs/project_repositories.yml +++ b/db/docs/project_repositories.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps disk path to repositories and link to the shard introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8614 milestone: '11.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_security_settings.yml b/db/docs/project_security_settings.yml index af559d11164..dd098aef0bc 100644 --- a/db/docs/project_security_settings.yml +++ b/db/docs/project_security_settings.yml @@ -8,4 +8,4 @@ feature_categories: description: Project settings related to security features. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32577 milestone: '13.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_settings.yml b/db/docs/project_settings.yml index 63e96e34dc5..d9b1c68a0b9 100644 --- a/db/docs/project_settings.yml +++ b/db/docs/project_settings.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores settings per project introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/a2a7ad291f64a5db74c1bc21fb556e6e8862d0f3 milestone: '10.8' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_statistics.yml b/db/docs/project_statistics.yml index 9bc6175b45f..a9d47be3bb4 100644 --- a/db/docs/project_statistics.yml +++ b/db/docs/project_statistics.yml @@ -7,4 +7,4 @@ feature_categories: description: Records statistics about the usage of various product features introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/7754 milestone: '8.16' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_wiki_repositories.yml b/db/docs/project_wiki_repositories.yml index 7da09b7fffe..666b76aa498 100644 --- a/db/docs/project_wiki_repositories.yml +++ b/db/docs/project_wiki_repositories.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores information about project wiki repositories. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/103399 milestone: '15.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/projects_sync_events.yml b/db/docs/projects_sync_events.yml index 84b99fe6080..aca4b407902 100644 --- a/db/docs/projects_sync_events.yml +++ b/db/docs/projects_sync_events.yml @@ -7,4 +7,4 @@ feature_categories: description: Used as a queue of data that needs to be synchronized between the `ci` and `main` database introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75517 milestone: '14.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/protected_branch_merge_access_levels.yml b/db/docs/protected_branch_merge_access_levels.yml index 3a348825dce..f0a11ef5489 100644 --- a/db/docs/protected_branch_merge_access_levels.yml +++ b/db/docs/protected_branch_merge_access_levels.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores merge access settings for protected branches introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5081 milestone: '8.11' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/protected_branch_push_access_levels.yml b/db/docs/protected_branch_push_access_levels.yml index 24865372ad0..e614c3d4838 100644 --- a/db/docs/protected_branch_push_access_levels.yml +++ b/db/docs/protected_branch_push_access_levels.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores push access settings for protected branches introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5081 milestone: '8.11' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/protected_branches.yml b/db/docs/protected_branches.yml index 7c3132336e2..dcd1fc28cd3 100644 --- a/db/docs/protected_branches.yml +++ b/db/docs/protected_branches.yml @@ -8,4 +8,4 @@ feature_categories: description: Keeps a list of protected branches by project introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/37224dc9c1ee80ba9030b616e2bc87bd96919e09 milestone: "<6.0" -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/push_rules.yml b/db/docs/push_rules.yml index 85c609719b6..1579268a9bb 100644 --- a/db/docs/push_rules.yml +++ b/db/docs/push_rules.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1b98b5ab97ce3e9997df542059cbf3c6ce0bf0e1 milestone: '8.10' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/remote_mirrors.yml b/db/docs/remote_mirrors.yml index 2ae633eb023..4d32c94f257 100644 --- a/db/docs/remote_mirrors.yml +++ b/db/docs/remote_mirrors.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores push mirrors and their update statuses introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/249 milestone: '8.7' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/repository_languages.yml b/db/docs/repository_languages.yml index 506c607cf54..92786d7ec18 100644 --- a/db/docs/repository_languages.yml +++ b/db/docs/repository_languages.yml @@ -7,4 +7,4 @@ feature_categories: description: Keeps relation between projects and repository languages introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/19480 milestone: '11.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/security_orchestration_policy_configurations.yml b/db/docs/security_orchestration_policy_configurations.yml index c015de47123..388df529835 100644 --- a/db/docs/security_orchestration_policy_configurations.yml +++ b/db/docs/security_orchestration_policy_configurations.yml @@ -9,4 +9,4 @@ description: | Policies are stored in the repository as a YAML file. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53743 milestone: '13.9' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/service_access_tokens.yml b/db/docs/service_access_tokens.yml index 2acd0d33c7d..c75b62883b0 100644 --- a/db/docs/service_access_tokens.yml +++ b/db/docs/service_access_tokens.yml @@ -3,7 +3,7 @@ table_name: service_access_tokens classes: - Ai::ServiceAccessToken feature_categories: -- application_performance +- cloud_connector description: Persists JWT tokens for AI features (e.g. Code Suggestions) to authenticate the GitLab instance introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125383 diff --git a/db/docs/topics.yml b/db/docs/topics.yml index dcf988c58eb..42fc6a9f4e3 100644 --- a/db/docs/topics.yml +++ b/db/docs/topics.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores topics that can be assigned to projects introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67574 milestone: '14.3' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/web_hook_logs.yml b/db/docs/web_hook_logs.yml index d342c9a9ed0..2635b94f9e6 100644 --- a/db/docs/web_hook_logs.yml +++ b/db/docs/web_hook_logs.yml @@ -7,4 +7,4 @@ feature_categories: description: Webhooks logs data. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/330789c23c777d8ca646eba7c25f39cb7342cdee milestone: '9.3' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/zoekt_nodes.yml b/db/docs/zoekt_nodes.yml new file mode 100644 index 00000000000..2c0740d8b60 --- /dev/null +++ b/db/docs/zoekt_nodes.yml @@ -0,0 +1,10 @@ +--- +table_name: zoekt_nodes +classes: +- Search::Zoekt::Node +feature_categories: +- global_search +description: Describes a Zoekt server that will be used for indexing and search for some configured namespaces +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134901 +milestone: '16.6' +gitlab_schema: gitlab_main diff --git a/db/docs/zoekt_shards.yml b/db/docs/zoekt_shards.yml index 5fe3b469b19..31f918c2a7b 100644 --- a/db/docs/zoekt_shards.yml +++ b/db/docs/zoekt_shards.yml @@ -1,10 +1,11 @@ --- table_name: zoekt_shards classes: -- Zoekt::Shard +- Search::Zoekt::Node feature_categories: - global_search -description: Describes a Zoekt server that will be used for indexing and search for some configured namespaces +description: Describes a Zoekt server that will be used for indexing and search for + some configured namespaces introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105049 milestone: '15.9' gitlab_schema: gitlab_main diff --git a/db/migrate/20230529182720_recreate_billable_index.rb b/db/migrate/20230529182720_recreate_billable_index.rb index 5e56dd7005a..a983dc5f295 100644 --- a/db/migrate/20230529182720_recreate_billable_index.rb +++ b/db/migrate/20230529182720_recreate_billable_index.rb @@ -8,8 +8,10 @@ class RecreateBillableIndex < Gitlab::Database::Migration[2.1] def up remove_concurrent_index_by_name :users, INDEX_NAME + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, :id, name: INDEX_NAME, where: "state = 'active' AND (user_type IN (0, 6, 4, 13)) AND (user_type IN (0, 4, 5))" + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/migrate/20230529184716_recreated_activity_index.rb b/db/migrate/20230529184716_recreated_activity_index.rb index 2b949d39de1..c5c76b8ec14 100644 --- a/db/migrate/20230529184716_recreated_activity_index.rb +++ b/db/migrate/20230529184716_recreated_activity_index.rb @@ -8,9 +8,11 @@ class RecreatedActivityIndex < Gitlab::Database::Migration[2.1] def up remove_concurrent_index_by_name :users, INDEX_NAME + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, [:id, :last_activity_on], name: INDEX_NAME, where: "state = 'active' AND user_type IN (0, 4)" + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/migrate/20230605043258_add_unconfirmed_created_at_index_to_users.rb b/db/migrate/20230605043258_add_unconfirmed_created_at_index_to_users.rb index 65bd7a1266b..bd3a7006972 100644 --- a/db/migrate/20230605043258_add_unconfirmed_created_at_index_to_users.rb +++ b/db/migrate/20230605043258_add_unconfirmed_created_at_index_to_users.rb @@ -6,9 +6,11 @@ class AddUnconfirmedCreatedAtIndexToUsers < Gitlab::Database::Migration[2.1] INDEX_NAME = 'index_users_on_unconfirmed_and_created_at_for_active_humans' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, [:created_at, :id], name: INDEX_NAME, where: "confirmed_at IS NULL AND state = 'active' AND user_type IN (0)" + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/migrate/20230926092914_add_approval_group_rules.rb b/db/migrate/20230926092914_add_approval_group_rules.rb new file mode 100644 index 00000000000..c5f4a356df1 --- /dev/null +++ b/db/migrate/20230926092914_add_approval_group_rules.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class AddApprovalGroupRules < Gitlab::Database::Migration[2.1] + INDEX_GROUP_ID_TYPE_NAME = 'idx_on_approval_group_rules_group_id_type_name' + INDEX_ANY_APPROVER_TYPE = 'idx_on_approval_group_rules_any_approver_type' + INDEX_SECURITY_ORCHESTRATION_POLICY_CONFURATION = 'idx_on_approval_group_rules_security_orch_policy' + disable_ddl_transaction! + + def up + create_table :approval_group_rules do |t| + t.references :group, references: :namespaces, null: false, + foreign_key: { to_table: :namespaces, on_delete: :cascade }, index: false + t.timestamps_with_timezone + t.integer :approvals_required, limit: 2, null: false, default: 0 + t.integer :report_type, limit: 2, null: true, default: nil + t.integer :rule_type, limit: 2, null: false, default: 1 + t.integer :security_orchestration_policy_configuration_id, limit: 5 + t.integer :scan_result_policy_id, limit: 5, index: true + t.text :name, null: false, limit: 255 + + t.index [:group_id, :rule_type, :name], unique: true, name: INDEX_GROUP_ID_TYPE_NAME + t.index [:group_id, :rule_type], where: 'rule_type = 4', unique: true, name: INDEX_ANY_APPROVER_TYPE + t.index :security_orchestration_policy_configuration_id, name: INDEX_SECURITY_ORCHESTRATION_POLICY_CONFURATION + end + + add_text_limit :approval_group_rules, :name, 255 + end + + def down + with_lock_retries do + drop_table :approval_group_rules + end + end +end diff --git a/db/migrate/20230926092944_add_approval_group_rules_groups.rb b/db/migrate/20230926092944_add_approval_group_rules_groups.rb new file mode 100644 index 00000000000..52ac86737e6 --- /dev/null +++ b/db/migrate/20230926092944_add_approval_group_rules_groups.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddApprovalGroupRulesGroups < Gitlab::Database::Migration[2.1] + INDEX_RULE_GROUP = 'idx_on_approval_group_rules_groups_rule_group' + + def up + create_table :approval_group_rules_groups do |t| + t.bigint :approval_group_rule_id, null: false + t.bigint :group_id, null: false, index: true + + t.index [:approval_group_rule_id, :group_id], unique: true, name: INDEX_RULE_GROUP + end + end + + def down + drop_table :approval_group_rules_groups + end +end diff --git a/db/migrate/20230926093004_add_approval_group_rules_users.rb b/db/migrate/20230926093004_add_approval_group_rules_users.rb new file mode 100644 index 00000000000..8c6d14ce9ac --- /dev/null +++ b/db/migrate/20230926093004_add_approval_group_rules_users.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddApprovalGroupRulesUsers < Gitlab::Database::Migration[2.1] + INDEX_RULE_USER = 'idx_on_approval_group_rules_users_rule_user' + + def up + create_table :approval_group_rules_users do |t| + t.bigint :approval_group_rule_id, null: false + t.bigint :user_id, null: false, index: true + + t.index [:approval_group_rule_id, :user_id], unique: true, name: INDEX_RULE_USER + end + end + + def down + drop_table :approval_group_rules_users + end +end diff --git a/db/migrate/20230926093025_add_approval_group_rules_protected_branches.rb b/db/migrate/20230926093025_add_approval_group_rules_protected_branches.rb new file mode 100644 index 00000000000..5f623ec9edb --- /dev/null +++ b/db/migrate/20230926093025_add_approval_group_rules_protected_branches.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddApprovalGroupRulesProtectedBranches < Gitlab::Database::Migration[2.1] + INDEX_RULE_PROTECTED_BRANCH = 'idx_on_approval_group_rules_protected_branch' + INDEX_APPROVAL_GROUP_RULE = 'idx_on_approval_group_rules' + INDEX_PROTECTED_BRANCH = 'idx_on_protected_branch' + + def up + create_table :approval_group_rules_protected_branches do |t| + t.bigint :approval_group_rule_id, null: false + t.bigint :protected_branch_id, null: false + + t.index :protected_branch_id, name: INDEX_PROTECTED_BRANCH + t.index [:approval_group_rule_id, :protected_branch_id], unique: true, name: INDEX_RULE_PROTECTED_BRANCH + end + end + + def down + drop_table :approval_group_rules_protected_branches + end +end diff --git a/db/migrate/20230926093101_add_fk_to_approval_rule_on_approval_group_rules_users.rb b/db/migrate/20230926093101_add_fk_to_approval_rule_on_approval_group_rules_users.rb new file mode 100644 index 00000000000..4c11542e9e6 --- /dev/null +++ b/db/migrate/20230926093101_add_fk_to_approval_rule_on_approval_group_rules_users.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddFkToApprovalRuleOnApprovalGroupRulesUsers < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules_users, + :approval_group_rules, + column: :approval_group_rule_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules_users, column: :approval_group_rule_id + end + end +end diff --git a/db/migrate/20230926093144_add_fk_to_user_on_approval_group_rules_users.rb b/db/migrate/20230926093144_add_fk_to_user_on_approval_group_rules_users.rb new file mode 100644 index 00000000000..30c08c8966d --- /dev/null +++ b/db/migrate/20230926093144_add_fk_to_user_on_approval_group_rules_users.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddFkToUserOnApprovalGroupRulesUsers < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules_users, :users, column: :user_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules_users, column: :user_id + end + end +end diff --git a/db/migrate/20230926093211_add_fk_to_approval_rule_on_approval_group_rules_groups.rb b/db/migrate/20230926093211_add_fk_to_approval_rule_on_approval_group_rules_groups.rb new file mode 100644 index 00000000000..44526150266 --- /dev/null +++ b/db/migrate/20230926093211_add_fk_to_approval_rule_on_approval_group_rules_groups.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddFkToApprovalRuleOnApprovalGroupRulesGroups < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules_groups, :approval_group_rules, column: :approval_group_rule_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules_groups, column: :approval_group_rule_id + end + end +end diff --git a/db/migrate/20230926093251_add_fk_to_group_on_approval_group_rules_groups.rb b/db/migrate/20230926093251_add_fk_to_group_on_approval_group_rules_groups.rb new file mode 100644 index 00000000000..2052993af05 --- /dev/null +++ b/db/migrate/20230926093251_add_fk_to_group_on_approval_group_rules_groups.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddFkToGroupOnApprovalGroupRulesGroups < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules_groups, :namespaces, column: :group_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules_groups, column: :group_id + end + end +end diff --git a/db/migrate/20230926105440_add_fk_to_approval_rule_on_approval_group_rules_protected_branches.rb b/db/migrate/20230926105440_add_fk_to_approval_rule_on_approval_group_rules_protected_branches.rb new file mode 100644 index 00000000000..cd799656ac9 --- /dev/null +++ b/db/migrate/20230926105440_add_fk_to_approval_rule_on_approval_group_rules_protected_branches.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddFkToApprovalRuleOnApprovalGroupRulesProtectedBranches < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules_protected_branches, + :approval_group_rules, + column: :approval_group_rule_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules_protected_branches, column: :approval_group_rule_id + end + end +end diff --git a/db/migrate/20230926105931_add_fk_to_protected_branch_on_approval_group_rules_protected_branches.rb b/db/migrate/20230926105931_add_fk_to_protected_branch_on_approval_group_rules_protected_branches.rb new file mode 100644 index 00000000000..5804a8da4d8 --- /dev/null +++ b/db/migrate/20230926105931_add_fk_to_protected_branch_on_approval_group_rules_protected_branches.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddFkToProtectedBranchOnApprovalGroupRulesProtectedBranches < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules_protected_branches, :protected_branches, + column: :protected_branch_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules_protected_branches, column: :protected_branch_id + end + end +end diff --git a/db/migrate/20230927124202_add_mastodon_to_user_details.rb b/db/migrate/20230927124202_add_mastodon_to_user_details.rb new file mode 100644 index 00000000000..a1aa099087b --- /dev/null +++ b/db/migrate/20230927124202_add_mastodon_to_user_details.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddMastodonToUserDetails < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + USER_DETAILS_FIELD_LIMIT = 500 + + def up + with_lock_retries do + add_column :user_details, :mastodon, :text, default: '', null: false, if_not_exists: true + end + + add_text_limit :user_details, :mastodon, USER_DETAILS_FIELD_LIMIT + end + + def down + with_lock_retries do + remove_column :user_details, :mastodon + end + end +end diff --git a/db/migrate/20230928145555_add_fk_to_security_orchestration_policy_configuration_on_approval_group_rules.rb b/db/migrate/20230928145555_add_fk_to_security_orchestration_policy_configuration_on_approval_group_rules.rb new file mode 100644 index 00000000000..2630adcf81f --- /dev/null +++ b/db/migrate/20230928145555_add_fk_to_security_orchestration_policy_configuration_on_approval_group_rules.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddFkToSecurityOrchestrationPolicyConfigurationOnApprovalGroupRules < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules, :security_orchestration_policy_configurations, + column: :security_orchestration_policy_configuration_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules, + column: :security_orchestration_policy_configuration_id + end + end +end diff --git a/db/migrate/20230928145637_add_fk_to_scan_result_policy_on_approval_group_rules.rb b/db/migrate/20230928145637_add_fk_to_scan_result_policy_on_approval_group_rules.rb new file mode 100644 index 00000000000..f30d03e0f62 --- /dev/null +++ b/db/migrate/20230928145637_add_fk_to_scan_result_policy_on_approval_group_rules.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddFkToScanResultPolicyOnApprovalGroupRules < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :approval_group_rules, :scan_result_policies, + column: :scan_result_policy_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :approval_group_rules, column: :scan_result_policy_id + end + end +end diff --git a/db/migrate/20230929155123_migrate_disable_merge_trains_value.rb b/db/migrate/20230929155123_migrate_disable_merge_trains_value.rb new file mode 100644 index 00000000000..59eadd07733 --- /dev/null +++ b/db/migrate/20230929155123_migrate_disable_merge_trains_value.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +class MigrateDisableMergeTrainsValue < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class Gate < MigrationRecord + self.table_name = 'feature_gates' + end + + UPDATE_QUERY = <<-SQL + UPDATE project_ci_cd_settings SET merge_trains_enabled = :merge_trains_enabled + WHERE project_id IN (:project_ids) + SQL + + def update_merge_trains_enabled(project_ids, merge_trains_enabled) + ApplicationRecord.connection.execute( + ApplicationRecord.sanitize_sql([ + UPDATE_QUERY, + { + project_ids: project_ids, + merge_trains_enabled: merge_trains_enabled.to_s.upcase + } + ]) + ) + end + + def get_project_ids + project_ids = Gate.where(feature_key: :disable_merge_trains, key: 'actors').pluck('value') + + project_ids.filter_map do |project_id| + # ensure actor is a project formatted correctly + match = project_id.match(/Project:[0-9]+/)[0] + # Extract the project id if there is an actor + match ? project_id.gsub('Project:', '').to_i : nil + end + end + + def up + project_ids = get_project_ids + + return unless project_ids + + update_merge_trains_enabled(project_ids, false) + end + + def down + project_ids = get_project_ids + + return unless project_ids + + update_merge_trains_enabled(project_ids, true) + end +end diff --git a/db/migrate/20231002162941_add_enable_artifact_external_redirect_warning_page_to_application_settings.rb b/db/migrate/20231002162941_add_enable_artifact_external_redirect_warning_page_to_application_settings.rb new file mode 100644 index 00000000000..06fc4b6b313 --- /dev/null +++ b/db/migrate/20231002162941_add_enable_artifact_external_redirect_warning_page_to_application_settings.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddEnableArtifactExternalRedirectWarningPageToApplicationSettings < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column(:application_settings, :enable_artifact_external_redirect_warning_page, :boolean, default: true, + null: false) + end +end diff --git a/db/migrate/20231005151816_add_created_at_to_status_check_responses.rb b/db/migrate/20231005151816_add_created_at_to_status_check_responses.rb new file mode 100644 index 00000000000..118586f61a8 --- /dev/null +++ b/db/migrate/20231005151816_add_created_at_to_status_check_responses.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddCreatedAtToStatusCheckResponses < Gitlab::Database::Migration[2.1] + def change + add_column :status_check_responses, :created_at, :datetime_with_timezone, null: false, default: -> { 'NOW()' } + end +end diff --git a/db/migrate/20231009115713_remove_duplicate_index_rule_type_four.rb b/db/migrate/20231009115713_remove_duplicate_index_rule_type_four.rb new file mode 100644 index 00000000000..7fe69c30a81 --- /dev/null +++ b/db/migrate/20231009115713_remove_duplicate_index_rule_type_four.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class RemoveDuplicateIndexRuleTypeFour < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'any_approver_merge_request_rule_type_unique_index' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME + end + + def down + add_concurrent_index :approval_merge_request_rules, [:merge_request_id, :rule_type], where: 'rule_type = 4', + name: INDEX_NAME, unique: true + end +end diff --git a/db/migrate/20231013204933_remove_tasks_to_be_done_worker.rb b/db/migrate/20231013204933_remove_tasks_to_be_done_worker.rb new file mode 100644 index 00000000000..d5e8ecfe370 --- /dev/null +++ b/db/migrate/20231013204933_remove_tasks_to_be_done_worker.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveTasksToBeDoneWorker < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + DEPRECATED_JOB_CLASSES = %w[TasksToBeDone::CreateWorker] + + 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/20231017095738_create_activity_pub_releases_subscriptions.rb b/db/migrate/20231017095738_create_activity_pub_releases_subscriptions.rb new file mode 100644 index 00000000000..19693c29a33 --- /dev/null +++ b/db/migrate/20231017095738_create_activity_pub_releases_subscriptions.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateActivityPubReleasesSubscriptions < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + create_table :activity_pub_releases_subscriptions do |t| + t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false + t.timestamps_with_timezone null: false + t.integer :status, null: false, limit: 2, default: 1 + t.text :shared_inbox_url, limit: 1024 + t.text :subscriber_inbox_url, limit: 1024 + t.text :subscriber_url, limit: 1024, null: false + t.jsonb :payload, null: true + t.index 'project_id, LOWER(subscriber_url)', name: :index_activity_pub_releases_sub_on_project_id_sub_url, + unique: true + t.index 'project_id, LOWER(subscriber_inbox_url)', + name: :index_activity_pub_releases_sub_on_project_id_inbox_url, unique: true + end + end + + def down + drop_table :activity_pub_releases_subscriptions + end +end diff --git a/db/migrate/20231017114131_add_auto_canceled_by_partition_id_to_p_ci_builds.rb b/db/migrate/20231017114131_add_auto_canceled_by_partition_id_to_p_ci_builds.rb index ecc606ca1a8..afd3b60a244 100644 --- a/db/migrate/20231017114131_add_auto_canceled_by_partition_id_to_p_ci_builds.rb +++ b/db/migrate/20231017114131_add_auto_canceled_by_partition_id_to_p_ci_builds.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true class AddAutoCanceledByPartitionIdToPCiBuilds < Gitlab::Database::Migration[2.1] - include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum - - enable_lock_retries! - - def change - return unless can_execute_on?(:ci_builds) + def up + # no-op + # moved to db/migrate/20231020074227_add_auto_canceled_by_partition_id_to_p_ci_builds_self_managed.rb + end - add_column :p_ci_builds, :auto_canceled_by_partition_id, :bigint, default: 100, null: false, if_not_exists: true + def down + # no-op + # moved to db/migrate/20231020074227_add_auto_canceled_by_partition_id_to_p_ci_builds_self_managed.rb end end diff --git a/db/migrate/20231017134349_create_ml_model_metadata.rb b/db/migrate/20231017134349_create_ml_model_metadata.rb new file mode 100644 index 00000000000..f34ba729677 --- /dev/null +++ b/db/migrate/20231017134349_create_ml_model_metadata.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreateMlModelMetadata < Gitlab::Database::Migration[2.1] + ML_MODEL_METADATA_NAME_INDEX_NAME = "unique_index_ml_model_metadata_name" + + def change + create_table :ml_model_metadata do |t| + t.timestamps_with_timezone null: false + t.references :model, + foreign_key: { to_table: :ml_models, on_delete: :cascade }, + index: false, + null: false + t.text :name, limit: 255, null: false + t.text :value, limit: 5000, null: false + + t.index [:model_id, :name], unique: true, name: ML_MODEL_METADATA_NAME_INDEX_NAME + end + end +end diff --git a/db/migrate/20231017135207_add_fields_to_ml_model.rb b/db/migrate/20231017135207_add_fields_to_ml_model.rb new file mode 100644 index 00000000000..cb937e49491 --- /dev/null +++ b/db/migrate/20231017135207_add_fields_to_ml_model.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddFieldsToMlModel < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20231018152419_add_text_limit_to_ml_models.rb + add_column :ml_models, :description, :text + # rubocop:enable Migration/AddLimitToTextColumns + + add_column :ml_models, :user_id, :integer, null: true + add_concurrent_foreign_key :ml_models, :users, column: :user_id, on_delete: :nullify + + add_concurrent_index :ml_models, :user_id + end + + def down + remove_column :ml_models, :description + remove_column :ml_models, :user_id + remove_foreign_key_if_exists :ml_models, column: :user_id + end +end diff --git a/db/migrate/20231017154804_add_index_to_status_check_responses_on_id_and_status.rb b/db/migrate/20231017154804_add_index_to_status_check_responses_on_id_and_status.rb new file mode 100644 index 00000000000..77aa1a1bb0f --- /dev/null +++ b/db/migrate/20231017154804_add_index_to_status_check_responses_on_id_and_status.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddIndexToStatusCheckResponsesOnIdAndStatus < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'idx_status_check_responses_on_id_and_status' + disable_ddl_transaction! + + def up + add_concurrent_index :status_check_responses, [:id, :status], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :status_check_responses, name: INDEX_NAME + end +end diff --git a/db/migrate/20231017181403_add_generated_to_diff_files.rb b/db/migrate/20231017181403_add_generated_to_diff_files.rb new file mode 100644 index 00000000000..f93669381ef --- /dev/null +++ b/db/migrate/20231017181403_add_generated_to_diff_files.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddGeneratedToDiffFiles < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :merge_request_diff_files, :generated, :boolean + end +end diff --git a/db/migrate/20231018140154_remove_hashed_storage_migration_workers_job_instances.rb b/db/migrate/20231018140154_remove_hashed_storage_migration_workers_job_instances.rb new file mode 100644 index 00000000000..73105a76249 --- /dev/null +++ b/db/migrate/20231018140154_remove_hashed_storage_migration_workers_job_instances.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveHashedStorageMigrationWorkersJobInstances < Gitlab::Database::Migration[2.1] + DEPRECATED_JOB_CLASSES = %w[ + HashedStorage::MigratorWorker + HashedStorage::ProjectMigrateWorker + HashedStorage::ProjectRollbackWorker + HashedStorage::RollbackerWorker + HashedStorage::BaseWorker + ] + + 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/20231018152419_add_text_limit_to_ml_models.rb b/db/migrate/20231018152419_add_text_limit_to_ml_models.rb new file mode 100644 index 00000000000..179d6f20b53 --- /dev/null +++ b/db/migrate/20231018152419_add_text_limit_to_ml_models.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToMlModels < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_text_limit :ml_models, :description, 5000 + end + + def down + remove_text_limit :ml_models, :description + end +end diff --git a/db/migrate/20231019104211_add_file_sha256_to_packages_nuget_symbols.rb b/db/migrate/20231019104211_add_file_sha256_to_packages_nuget_symbols.rb new file mode 100644 index 00000000000..374fa91000d --- /dev/null +++ b/db/migrate/20231019104211_add_file_sha256_to_packages_nuget_symbols.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddFileSha256ToPackagesNugetSymbols < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :packages_nuget_symbols, :file_sha256, :binary + end + + def down + remove_column :packages_nuget_symbols, :file_sha256 + end +end diff --git a/db/migrate/20231019122855_add_semver_index_ci_runner_machines.rb b/db/migrate/20231019122855_add_semver_index_ci_runner_machines.rb new file mode 100644 index 00000000000..b09f3cda60e --- /dev/null +++ b/db/migrate/20231019122855_add_semver_index_ci_runner_machines.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddSemverIndexCiRunnerMachines < Gitlab::Database::Migration[2.1] + MAJOR_INDEX_NAME = 'index_ci_runner_machines_on_major_version_trigram' + MINOR_INDEX_NAME = 'index_ci_runner_machines_on_minor_version_trigram' + PATCH_INDEX_NAME = 'index_ci_runner_machines_on_patch_version_trigram' + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_runner_machines, %q[((substring(version from '^\d+\.'))), version, runner_id], + name: MAJOR_INDEX_NAME + add_concurrent_index :ci_runner_machines, %q[((substring(version from '^\d+\.\d+\.'))), version, runner_id], + name: MINOR_INDEX_NAME + add_concurrent_index :ci_runner_machines, %q[((substring(version from '^\d+\.\d+\.\d+'))), version, runner_id], + name: PATCH_INDEX_NAME + end + + def down + remove_concurrent_index_by_name :ci_runner_machines, MAJOR_INDEX_NAME + remove_concurrent_index_by_name :ci_runner_machines, MINOR_INDEX_NAME + remove_concurrent_index_by_name :ci_runner_machines, PATCH_INDEX_NAME + end +end diff --git a/db/migrate/20231019145202_add_status_to_packages_npm_metadata_caches.rb b/db/migrate/20231019145202_add_status_to_packages_npm_metadata_caches.rb new file mode 100644 index 00000000000..f3d910e9350 --- /dev/null +++ b/db/migrate/20231019145202_add_status_to_packages_npm_metadata_caches.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddStatusToPackagesNpmMetadataCaches < Gitlab::Database::Migration[2.1] + def change + add_column :packages_npm_metadata_caches, :status, :integer, default: 0, null: false, limit: 2 + end +end diff --git a/db/migrate/20231019180421_add_name_description_to_catalog_resources.rb b/db/migrate/20231019180421_add_name_description_to_catalog_resources.rb new file mode 100644 index 00000000000..391d56342be --- /dev/null +++ b/db/migrate/20231019180421_add_name_description_to_catalog_resources.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddNameDescriptionToCatalogResources < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + NAME_INDEX = 'index_catalog_resources_on_name_trigram' + DESCRIPTION_INDEX = 'index_catalog_resources_on_description_trigram' + + def up + # These columns must match the settings for the corresponding columns in the `projects` table + add_column :catalog_resources, :name, :varchar, null: true + add_column :catalog_resources, :description, :text, null: true # rubocop: disable Migration/AddLimitToTextColumns + + add_concurrent_index :catalog_resources, :name, name: NAME_INDEX, + using: :gin, opclass: { name: :gin_trgm_ops } + + add_concurrent_index :catalog_resources, :description, name: DESCRIPTION_INDEX, + using: :gin, opclass: { description: :gin_trgm_ops } + end + + def down + remove_column :catalog_resources, :name + remove_column :catalog_resources, :description + + remove_concurrent_index_by_name :catalog_resources, NAME_INDEX + remove_concurrent_index_by_name :catalog_resources, DESCRIPTION_INDEX + end +end diff --git a/db/migrate/20231020020732_add_user_phone_number_validation_telesign_reference_xid_index.rb b/db/migrate/20231020020732_add_user_phone_number_validation_telesign_reference_xid_index.rb new file mode 100644 index 00000000000..4a0343f5809 --- /dev/null +++ b/db/migrate/20231020020732_add_user_phone_number_validation_telesign_reference_xid_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddUserPhoneNumberValidationTelesignReferenceXidIndex < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_user_phone_number_validations_on_telesign_reference_xid' + + def up + add_concurrent_index(:user_phone_number_validations, :telesign_reference_xid, name: INDEX_NAME) + end + + def down + remove_concurrent_index_by_name(:user_phone_number_validations, INDEX_NAME) + end +end diff --git a/db/migrate/20231020074227_add_auto_canceled_by_partition_id_to_p_ci_builds_self_managed.rb b/db/migrate/20231020074227_add_auto_canceled_by_partition_id_to_p_ci_builds_self_managed.rb new file mode 100644 index 00000000000..5aa5d6c42ae --- /dev/null +++ b/db/migrate/20231020074227_add_auto_canceled_by_partition_id_to_p_ci_builds_self_managed.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddAutoCanceledByPartitionIdToPCiBuildsSelfManaged < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + add_column :p_ci_builds, :auto_canceled_by_partition_id, :bigint, default: 100, null: false, if_not_exists: true + end + + def down + remove_column :p_ci_builds, :auto_canceled_by_partition_id, if_exists: true + end +end diff --git a/db/migrate/20231020095624_create_audit_events_streaming_http_group_namespace_filters.rb b/db/migrate/20231020095624_create_audit_events_streaming_http_group_namespace_filters.rb new file mode 100644 index 00000000000..07a580a12b2 --- /dev/null +++ b/db/migrate/20231020095624_create_audit_events_streaming_http_group_namespace_filters.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class CreateAuditEventsStreamingHttpGroupNamespaceFilters < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + UNIQ_DESTINATION_INDEX_NAME = 'unique_audit_events_group_namespace_filters_destination_id' + UNIQ_NAMESPACE_INDEX_NAME = 'unique_audit_events_group_namespace_filters_namespace_id' + + def change + create_table :audit_events_streaming_http_group_namespace_filters do |t| + t.timestamps_with_timezone null: false + t.references :external_audit_event_destination, + null: false, + index: { unique: true, name: UNIQ_DESTINATION_INDEX_NAME }, + foreign_key: { to_table: 'audit_events_external_audit_event_destinations', on_delete: :cascade } + t.references :namespace, + null: false, + index: { unique: true, name: UNIQ_NAMESPACE_INDEX_NAME }, + foreign_key: { on_delete: :cascade } + end + end +end diff --git a/db/migrate/20231020112541_add_column_model_version_id_to_ml_candidates.rb b/db/migrate/20231020112541_add_column_model_version_id_to_ml_candidates.rb new file mode 100644 index 00000000000..7bfe78c4ebd --- /dev/null +++ b/db/migrate/20231020112541_add_column_model_version_id_to_ml_candidates.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddColumnModelVersionIdToMlCandidates < Gitlab::Database::Migration[2.1] + def change + add_column :ml_candidates, :model_version_id, :bigint, null: true + end +end diff --git a/db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb b/db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb new file mode 100644 index 00000000000..6350ad935ca --- /dev/null +++ b/db/migrate/20231020181652_add_index_packages_npm_metadata_caches_on_id_and_project_id_and_status.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexPackagesNpmMetadataCachesOnIdAndProjectIdAndStatus < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'idx_pkgs_npm_metadata_caches_on_id_and_project_id_and_status' + NPM_METADATA_CACHES_STATUS_DEFAULT = 0 + + def up + where = "project_id IS NULL AND status = #{NPM_METADATA_CACHES_STATUS_DEFAULT}" + + add_concurrent_index :packages_npm_metadata_caches, :id, name: INDEX_NAME, where: where + end + + def down + remove_concurrent_index_by_name :packages_npm_metadata_caches, name: INDEX_NAME + end +end diff --git a/db/migrate/20231023073841_add_indexes_to_project_compliance_standards_adherence.rb b/db/migrate/20231023073841_add_indexes_to_project_compliance_standards_adherence.rb new file mode 100644 index 00000000000..0a593547ddb --- /dev/null +++ b/db/migrate/20231023073841_add_indexes_to_project_compliance_standards_adherence.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexesToProjectComplianceStandardsAdherence < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAMESPACE_ID = 'index_project_compliance_standards_adherence_on_namespace_id' + INDEX_NAMESPACE_AND_PROJECT_ID_DESC = 'i_compliance_standards_adherence_on_namespace_id_and_proj_id' + + def up + add_concurrent_index :project_compliance_standards_adherence, [:namespace_id, :project_id, :id], + order: { project_id: :desc, id: :desc }, using: :btree, name: INDEX_NAMESPACE_AND_PROJECT_ID_DESC + + remove_concurrent_index_by_name :project_compliance_standards_adherence, INDEX_NAMESPACE_ID + end + + def down + add_concurrent_index :project_compliance_standards_adherence, :namespace_id, name: INDEX_NAMESPACE_ID + + remove_concurrent_index_by_name :project_compliance_standards_adherence, INDEX_NAMESPACE_AND_PROJECT_ID_DESC + end +end diff --git a/db/migrate/20231023114006_add_index_on_model_version_id_to_ml_candidates.rb b/db/migrate/20231023114006_add_index_on_model_version_id_to_ml_candidates.rb new file mode 100644 index 00000000000..598600b8539 --- /dev/null +++ b/db/migrate/20231023114006_add_index_on_model_version_id_to_ml_candidates.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIndexOnModelVersionIdToMlCandidates < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_ml_candidates_on_model_version_id' + + def up + add_concurrent_index :ml_candidates, :model_version_id, name: INDEX_NAME, unique: true + end + + def down + remove_concurrent_index_by_name :ml_candidates, name: INDEX_NAME + end +end diff --git a/db/migrate/20231023114551_add_fk_on_ml_candidates_to_ml_model_versions.rb b/db/migrate/20231023114551_add_fk_on_ml_candidates_to_ml_model_versions.rb new file mode 100644 index 00000000000..0d625a54656 --- /dev/null +++ b/db/migrate/20231023114551_add_fk_on_ml_candidates_to_ml_model_versions.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddFkOnMlCandidatesToMlModelVersions < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:ml_candidates, :ml_model_versions, column: :model_version_id, on_delete: :cascade) + end + + def down + with_lock_retries do + remove_foreign_key_if_exists(:ml_model_versions, column: :model_version_id, on_delete: :cascade) + end + end +end diff --git a/db/migrate/20231023121955_add_description_to_ml_model_versions.rb b/db/migrate/20231023121955_add_description_to_ml_model_versions.rb new file mode 100644 index 00000000000..4361477160a --- /dev/null +++ b/db/migrate/20231023121955_add_description_to_ml_model_versions.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddDescriptionToMlModelVersions < Gitlab::Database::Migration[2.1] + def change + # rubocop:disable Migration/AddLimitToTextColumns -- limit being added on 20231023122508 + add_column :ml_model_versions, :description, :text + # rubocop:enable Migration/AddLimitToTextColumns + end +end diff --git a/db/migrate/20231023122508_add_text_limit_to_descriptions_on_ml_model_versions.rb b/db/migrate/20231023122508_add_text_limit_to_descriptions_on_ml_model_versions.rb new file mode 100644 index 00000000000..9df61e4c2ef --- /dev/null +++ b/db/migrate/20231023122508_add_text_limit_to_descriptions_on_ml_model_versions.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToDescriptionsOnMlModelVersions < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_text_limit :ml_model_versions, :description, 500 + end + + def down + remove_text_limit :ml_model_versions, :description + end +end diff --git a/db/migrate/20231024123444_add_archive_project_to_member_roles.rb b/db/migrate/20231024123444_add_archive_project_to_member_roles.rb new file mode 100644 index 00000000000..27ff86450e8 --- /dev/null +++ b/db/migrate/20231024123444_add_archive_project_to_member_roles.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddArchiveProjectToMemberRoles < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + add_column :member_roles, :archive_project, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20231024133234_add_source_package_name_to_sbom_component.rb b/db/migrate/20231024133234_add_source_package_name_to_sbom_component.rb new file mode 100644 index 00000000000..41970429ca9 --- /dev/null +++ b/db/migrate/20231024133234_add_source_package_name_to_sbom_component.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddSourcePackageNameToSbomComponent < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + INDEX = 'index_source_package_names_on_component_and_purl' + + def up + with_lock_retries do + add_column :sbom_components, :source_package_name, :text, if_not_exists: true + end + + add_text_limit :sbom_components, :source_package_name, 255 + add_concurrent_index :sbom_components, + [:component_type, :source_package_name, :purl_type], + name: INDEX, + unique: true + end + + def down + with_lock_retries do + remove_column :sbom_components, :source_package_name, if_exists: true + end + + remove_concurrent_index_by_name :sbom_components, name: INDEX + end +end diff --git a/db/migrate/20231024142236_add_fields_to_bulk_import_failures.rb b/db/migrate/20231024142236_add_fields_to_bulk_import_failures.rb new file mode 100644 index 00000000000..670e42ba627 --- /dev/null +++ b/db/migrate/20231024142236_add_fields_to_bulk_import_failures.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddFieldsToBulkImportFailures < Gitlab::Database::Migration[2.2] + milestone '16.6' + + # rubocop:disable Migration/AddLimitToTextColumns + def change + add_column :bulk_import_failures, :source_url, :text + add_column :bulk_import_failures, :source_title, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20231024143457_add_text_limit_to_bulk_import_failures.rb b/db/migrate/20231024143457_add_text_limit_to_bulk_import_failures.rb new file mode 100644 index 00000000000..eeca88f22c9 --- /dev/null +++ b/db/migrate/20231024143457_add_text_limit_to_bulk_import_failures.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddTextLimitToBulkImportFailures < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + add_text_limit :bulk_import_failures, :source_url, 255 + add_text_limit :bulk_import_failures, :source_title, 255 + end + + def down + remove_text_limit :bulk_import_failures, :source_url + remove_text_limit :bulk_import_failures, :source_title + end +end diff --git a/db/migrate/20231024151916_add_index_unique_setting_type_on_vs_code_settings.rb b/db/migrate/20231024151916_add_index_unique_setting_type_on_vs_code_settings.rb new file mode 100644 index 00000000000..6eb34086299 --- /dev/null +++ b/db/migrate/20231024151916_add_index_unique_setting_type_on_vs_code_settings.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexUniqueSettingTypeOnVsCodeSettings < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'unique_user_id_and_setting_type' + PREVIOUS_INDEX_NAME = 'index_vs_code_settings_on_user_id' + + def up + remove_concurrent_index_by_name :vs_code_settings, name: PREVIOUS_INDEX_NAME + add_concurrent_index :vs_code_settings, [:user_id, :setting_type], name: INDEX_NAME, unique: true + end + + def down + remove_concurrent_index_by_name :vs_code_settings, name: INDEX_NAME + add_concurrent_index :vs_code_settings, [:user_id], name: PREVIOUS_INDEX_NAME + end +end diff --git a/db/migrate/20231024173744_add_path_to_catalog_resource_components.rb b/db/migrate/20231024173744_add_path_to_catalog_resource_components.rb new file mode 100644 index 00000000000..2473856faf1 --- /dev/null +++ b/db/migrate/20231024173744_add_path_to_catalog_resource_components.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddPathToCatalogResourceComponents < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + with_lock_retries do + add_column :catalog_resource_components, :path, :text, if_not_exists: true + end + + add_text_limit :catalog_resource_components, :path, 255 + end + + def down + with_lock_retries do + remove_column :catalog_resource_components, :path, :text, if_exists: true + end + end +end diff --git a/db/migrate/20231024212214_add_pipeline_cancel_role_restriction_enum.rb b/db/migrate/20231024212214_add_pipeline_cancel_role_restriction_enum.rb new file mode 100644 index 00000000000..ab26a1d783b --- /dev/null +++ b/db/migrate/20231024212214_add_pipeline_cancel_role_restriction_enum.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddPipelineCancelRoleRestrictionEnum < Gitlab::Database::Migration[2.1] + def up + add_column :project_ci_cd_settings, :restrict_pipeline_cancellation_role, + :integer, limit: 2, default: 0, null: false + end + + def down + remove_column :project_ci_cd_settings, :restrict_pipeline_cancellation_role + end +end diff --git a/db/migrate/20231025123238_create_compliance_framework_security_policies.rb b/db/migrate/20231025123238_create_compliance_framework_security_policies.rb new file mode 100644 index 00000000000..1cf970e0d6c --- /dev/null +++ b/db/migrate/20231025123238_create_compliance_framework_security_policies.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CreateComplianceFrameworkSecurityPolicies < Gitlab::Database::Migration[2.2] + UNIQUE_INDEX_NAME = 'unique_compliance_framework_security_policies_framework_id' + POLICY_CONFIGURATION_INDEX_NAME = 'idx_compliance_security_policies_on_policy_configuration_id' + + milestone '16.6' + enable_lock_retries! + + def change + create_table :compliance_framework_security_policies do |t| + t.bigint :framework_id, null: false + t.bigint :policy_configuration_id, null: false + t.timestamps_with_timezone null: false + t.integer :policy_index, limit: 2, null: false + + t.index :policy_configuration_id, name: POLICY_CONFIGURATION_INDEX_NAME + t.index [:framework_id, :policy_configuration_id, :policy_index], unique: true, name: UNIQUE_INDEX_NAME + end + end +end diff --git a/db/migrate/20231026050554_add_functions_for_primary_key_lookup.rb b/db/migrate/20231026050554_add_functions_for_primary_key_lookup.rb new file mode 100644 index 00000000000..ecf32f74e4b --- /dev/null +++ b/db/migrate/20231026050554_add_functions_for_primary_key_lookup.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class AddFunctionsForPrimaryKeyLookup < Gitlab::Database::Migration[2.2] + milestone '16.6' + + TABLES = %i[users namespaces projects].freeze + + def up + TABLES.each do |table| + execute <<~SQL + CREATE OR REPLACE FUNCTION find_#{table}_by_id(#{table}_id bigint) + RETURNS #{table} AS $$ + BEGIN + return (SELECT #{table} FROM #{table} WHERE id = #{table}_id LIMIT 1); + END; + $$ LANGUAGE plpgsql STABLE PARALLEL SAFE COST 1; + SQL + end + end + + def down + TABLES.each do |table| + execute "DROP FUNCTION IF EXISTS find_#{table}_by_id" + end + end +end diff --git a/db/migrate/20231027052949_initialize_conversion_of_system_note_metadata_to_bigint.rb b/db/migrate/20231027052949_initialize_conversion_of_system_note_metadata_to_bigint.rb new file mode 100644 index 00000000000..6dc840e8790 --- /dev/null +++ b/db/migrate/20231027052949_initialize_conversion_of_system_note_metadata_to_bigint.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class InitializeConversionOfSystemNoteMetadataToBigint < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + TABLE = :system_note_metadata + COLUMNS = %i[id] + + milestone '16.6' + + 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/20231027064352_add_service_access_tokens_expiration_application_setting.rb b/db/migrate/20231027064352_add_service_access_tokens_expiration_application_setting.rb new file mode 100644 index 00000000000..6ef85a353fb --- /dev/null +++ b/db/migrate/20231027064352_add_service_access_tokens_expiration_application_setting.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddServiceAccessTokensExpirationApplicationSetting < Gitlab::Database::Migration[2.2] + milestone '16.6' + + enable_lock_retries! + + def change + add_column :application_settings, :service_access_tokens_expiration_enforced, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20231027065205_add_service_access_tokens_expiration_namespace_setting.rb b/db/migrate/20231027065205_add_service_access_tokens_expiration_namespace_setting.rb new file mode 100644 index 00000000000..86df338c416 --- /dev/null +++ b/db/migrate/20231027065205_add_service_access_tokens_expiration_namespace_setting.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddServiceAccessTokensExpirationNamespaceSetting < Gitlab::Database::Migration[2.2] + milestone '16.6' + + enable_lock_retries! + + def change + add_column :namespace_settings, :service_access_tokens_expiration_enforced, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20231027084327_change_personal_access_tokens_remove_not_null_expires_at.rb b/db/migrate/20231027084327_change_personal_access_tokens_remove_not_null_expires_at.rb new file mode 100644 index 00000000000..0f7e3d53707 --- /dev/null +++ b/db/migrate/20231027084327_change_personal_access_tokens_remove_not_null_expires_at.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ChangePersonalAccessTokensRemoveNotNullExpiresAt < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + CONSTRAINT_NAME = 'check_b8d60815eb' + + def up + remove_not_null_constraint :personal_access_tokens, :expires_at + end + + def down + add_not_null_constraint :personal_access_tokens, :expires_at, validate: false, constraint_name: CONSTRAINT_NAME + end +end diff --git a/db/migrate/20231030051837_add_project_id_to_packages_tags.rb b/db/migrate/20231030051837_add_project_id_to_packages_tags.rb new file mode 100644 index 00000000000..b27e15cb648 --- /dev/null +++ b/db/migrate/20231030051837_add_project_id_to_packages_tags.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddProjectIdToPackagesTags < Gitlab::Database::Migration[2.2] + milestone '16.6' + enable_lock_retries! + + def change + add_column :packages_tags, :project_id, :bigint + end +end diff --git a/db/migrate/20231030051838_add_index_to_packages_tags_project_id.rb b/db/migrate/20231030051838_add_index_to_packages_tags_project_id.rb new file mode 100644 index 00000000000..17512137fff --- /dev/null +++ b/db/migrate/20231030051838_add_index_to_packages_tags_project_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIndexToPackagesTagsProjectId < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + INDEX_NAME = :index_packages_tags_on_project_id + + def up + add_concurrent_index :packages_tags, :project_id, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:packages_tags, INDEX_NAME) + end +end diff --git a/db/migrate/20231030051839_add_foreign_key_to_packages_tags_project_id.rb b/db/migrate/20231030051839_add_foreign_key_to_packages_tags_project_id.rb new file mode 100644 index 00000000000..6e3d6161582 --- /dev/null +++ b/db/migrate/20231030051839_add_foreign_key_to_packages_tags_project_id.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddForeignKeyToPackagesTagsProjectId < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :packages_tags, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :packages_tags, column: :project_id + end + end +end diff --git a/db/migrate/20231030205639_update_default_package_metadata_purl_types.rb b/db/migrate/20231030205639_update_default_package_metadata_purl_types.rb new file mode 100644 index 00000000000..1e2f1ccb578 --- /dev/null +++ b/db/migrate/20231030205639_update_default_package_metadata_purl_types.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class UpdateDefaultPackageMetadataPurlTypes < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + PARTIALLY_ENABLED_SYNC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].freeze + FULLY_ENABLED_SYNC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13].freeze + + def change + change_column_default :application_settings, :package_metadata_purl_types, + from: PARTIALLY_ENABLED_SYNC, to: FULLY_ENABLED_SYNC + end +end diff --git a/db/migrate/20231030205756_index_user_details_on_enterprise_group_id_and_user_id.rb b/db/migrate/20231030205756_index_user_details_on_enterprise_group_id_and_user_id.rb new file mode 100644 index 00000000000..a993944e152 --- /dev/null +++ b/db/migrate/20231030205756_index_user_details_on_enterprise_group_id_and_user_id.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class IndexUserDetailsOnEnterpriseGroupIdAndUserId < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + INDEX_NAME = 'index_user_details_on_enterprise_group_id_and_user_id' + INDEX_NAME_TO_REMOVE = 'index_user_details_on_enterprise_group_id' + + def up + add_concurrent_index(:user_details, [:enterprise_group_id, :user_id], name: INDEX_NAME) + + remove_concurrent_index_by_name :user_details, INDEX_NAME_TO_REMOVE + end + + def down + remove_concurrent_index_by_name :user_details, INDEX_NAME + + add_concurrent_index :user_details, :enterprise_group_id, name: INDEX_NAME_TO_REMOVE + end +end diff --git a/db/migrate/20231031141439_add_smtp_authentication_to_service_desk_custom_email_credentials.rb b/db/migrate/20231031141439_add_smtp_authentication_to_service_desk_custom_email_credentials.rb new file mode 100644 index 00000000000..e15e500af90 --- /dev/null +++ b/db/migrate/20231031141439_add_smtp_authentication_to_service_desk_custom_email_credentials.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddSmtpAuthenticationToServiceDeskCustomEmailCredentials < Gitlab::Database::Migration[2.2] + milestone '16.6' + + def change + add_column :service_desk_custom_email_credentials, :smtp_authentication, :integer, + limit: 2, null: true, default: nil + end +end diff --git a/db/migrate/20231031200433_add_framework_fk_to_compliance_framework_security_policies.rb b/db/migrate/20231031200433_add_framework_fk_to_compliance_framework_security_policies.rb new file mode 100644 index 00000000000..bb7fa924d15 --- /dev/null +++ b/db/migrate/20231031200433_add_framework_fk_to_compliance_framework_security_policies.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddFrameworkFkToComplianceFrameworkSecurityPolicies < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :compliance_framework_security_policies, + :compliance_management_frameworks, + column: :framework_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :compliance_framework_security_policies, column: :framework_id + end + end +end diff --git a/db/migrate/20231031200645_add_policy_configuration_fk_to_compliance_framework_security_policies.rb b/db/migrate/20231031200645_add_policy_configuration_fk_to_compliance_framework_security_policies.rb new file mode 100644 index 00000000000..cf6419c5128 --- /dev/null +++ b/db/migrate/20231031200645_add_policy_configuration_fk_to_compliance_framework_security_policies.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddPolicyConfigurationFkToComplianceFrameworkSecurityPolicies < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :compliance_framework_security_policies, + :security_orchestration_policy_configurations, + column: :policy_configuration_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :compliance_framework_security_policies, column: :policy_configuration_id + end + end +end diff --git a/db/migrate/20231102142553_add_zoekt_nodes.rb b/db/migrate/20231102142553_add_zoekt_nodes.rb new file mode 100644 index 00000000000..69a937ea4b0 --- /dev/null +++ b/db/migrate/20231102142553_add_zoekt_nodes.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddZoektNodes < Gitlab::Database::Migration[2.2] + milestone '16.6' + enable_lock_retries! + + def change + create_table :zoekt_nodes do |t| + t.uuid :uuid, index: { unique: true }, null: false + t.bigint :used_bytes, null: false, default: 0 + t.bigint :total_bytes, null: false, default: 0 + t.datetime_with_timezone :last_seen_at, index: true, null: false, default: '1970-01-01' + t.timestamps_with_timezone + t.text :index_base_url, limit: 1024, index: { unique: true }, null: false + t.text :search_base_url, limit: 1024, index: { unique: true }, null: false + t.jsonb :metadata, default: {}, null: false + end + end +end diff --git a/db/migrate/20231102142554_migrate_zoekt_shards_to_zoekt_nodes.rb b/db/migrate/20231102142554_migrate_zoekt_shards_to_zoekt_nodes.rb new file mode 100644 index 00000000000..23ae1231ae0 --- /dev/null +++ b/db/migrate/20231102142554_migrate_zoekt_shards_to_zoekt_nodes.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class MigrateZoektShardsToZoektNodes < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + SELECTED_COLUMNS = %w[ + index_base_url + search_base_url + uuid + used_bytes + total_bytes + metadata + last_seen_at + created_at + updated_at + ].join(',') + + def up + connection.execute(<<~SQL) + INSERT INTO zoekt_nodes (#{SELECTED_COLUMNS}) + SELECT #{SELECTED_COLUMNS} + FROM zoekt_shards + SQL + end + + def down + connection.execute(<<~SQL) + DELETE FROM zoekt_nodes + SQL + end +end diff --git a/db/migrate/20231102142555_add_zoekt_node_id_to_indexed_namespaces.rb b/db/migrate/20231102142555_add_zoekt_node_id_to_indexed_namespaces.rb new file mode 100644 index 00000000000..0b706cb0051 --- /dev/null +++ b/db/migrate/20231102142555_add_zoekt_node_id_to_indexed_namespaces.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddZoektNodeIdToIndexedNamespaces < Gitlab::Database::Migration[2.2] + milestone '16.6' + + def up + add_column :zoekt_indexed_namespaces, :zoekt_node_id, :bigint + end + + def down + remove_column :zoekt_indexed_namespaces, :zoekt_node_id + end +end diff --git a/db/migrate/20231102142565_add_zoekt_node_foreign_key_to_indexed_namespaces.rb b/db/migrate/20231102142565_add_zoekt_node_foreign_key_to_indexed_namespaces.rb new file mode 100644 index 00000000000..957a2e751fa --- /dev/null +++ b/db/migrate/20231102142565_add_zoekt_node_foreign_key_to_indexed_namespaces.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddZoektNodeForeignKeyToIndexedNamespaces < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + INDEX_NAME = 'index_zoekt_node_and_namespace' + + def up + add_concurrent_foreign_key :zoekt_indexed_namespaces, :zoekt_nodes, column: :zoekt_node_id, on_delete: :cascade + add_concurrent_index :zoekt_indexed_namespaces, [:zoekt_node_id, :namespace_id], unique: true, name: INDEX_NAME + end + + def down + remove_concurrent_index :zoekt_indexed_namespaces, [:zoekt_node_id, :namespace_id], name: INDEX_NAME + end +end diff --git a/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb b/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb new file mode 100644 index 00000000000..bdbe8aa3a63 --- /dev/null +++ b/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb @@ -0,0 +1,31 @@ +# 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 AddWolfiPurlTypeToPackageMetadataPurlTypes < Gitlab::Database::Migration[2.2] + milestone '16.6' + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class ApplicationSetting < MigrationRecord + end + + WOLFI_PURL_TYPE = 13 + + def up + application_setting = ApplicationSetting.last + return unless application_setting + + application_setting.package_metadata_purl_types |= [WOLFI_PURL_TYPE] + application_setting.save + end + + def down + application_setting = ApplicationSetting.last + return unless application_setting + + application_setting.package_metadata_purl_types.delete(WOLFI_PURL_TYPE) + application_setting.save + end +end diff --git a/db/migrate/20231103195309_remove_deprecated_package_metadata_sync_worker.rb b/db/migrate/20231103195309_remove_deprecated_package_metadata_sync_worker.rb new file mode 100644 index 00000000000..ae461d21799 --- /dev/null +++ b/db/migrate/20231103195309_remove_deprecated_package_metadata_sync_worker.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class RemoveDeprecatedPackageMetadataSyncWorker < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + DEPRECATED_JOB_CLASSES = %w[PackageMetadata::SyncWorker] + + 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/20231103223224_backfill_zoekt_node_id_on_indexed_namespaces.rb b/db/migrate/20231103223224_backfill_zoekt_node_id_on_indexed_namespaces.rb new file mode 100644 index 00000000000..7d6bb25f832 --- /dev/null +++ b/db/migrate/20231103223224_backfill_zoekt_node_id_on_indexed_namespaces.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class BackfillZoektNodeIdOnIndexedNamespaces < Gitlab::Database::Migration[2.2] + milestone '16.6' + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + sql = <<-SQL + UPDATE zoekt_indexed_namespaces + SET zoekt_node_id = (SELECT id FROM zoekt_nodes ORDER BY created_at DESC LIMIT 1) + SQL + + execute(sql) + end + + def down + # no-op + end +end diff --git a/db/migrate/20231106145853_add_product_analytics_enabled_to_namespace_settings.rb b/db/migrate/20231106145853_add_product_analytics_enabled_to_namespace_settings.rb new file mode 100644 index 00000000000..45b617be6ca --- /dev/null +++ b/db/migrate/20231106145853_add_product_analytics_enabled_to_namespace_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddProductAnalyticsEnabledToNamespaceSettings < Gitlab::Database::Migration[2.2] + milestone '16.6' + + def change + add_column :namespace_settings, :product_analytics_enabled, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20231106212340_add_visibility_level_to_catalog_resources.rb b/db/migrate/20231106212340_add_visibility_level_to_catalog_resources.rb new file mode 100644 index 00000000000..46150396c1e --- /dev/null +++ b/db/migrate/20231106212340_add_visibility_level_to_catalog_resources.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddVisibilityLevelToCatalogResources < Gitlab::Database::Migration[2.2] + milestone '16.6' + + enable_lock_retries! + + def change + # This column must match the settings of `visibility_level` in the `projects` table. + # Backfill will be done as part of https://gitlab.com/gitlab-org/gitlab/-/issues/429056. + add_column :catalog_resources, :visibility_level, :integer, default: 0, null: false + end +end diff --git a/db/migrate/20231107062104_add_network_policy_egress_to_agent.rb b/db/migrate/20231107062104_add_network_policy_egress_to_agent.rb new file mode 100644 index 00000000000..c7f9da1831c --- /dev/null +++ b/db/migrate/20231107062104_add_network_policy_egress_to_agent.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddNetworkPolicyEgressToAgent < Gitlab::Database::Migration[2.2] + milestone '16.6' + + NETWORK_POLICY_EGRESS_DEFAULT = [{ + allow: "0.0.0.0/0", + except: [ + - "10.0.0.0/8", + - "172.16.0.0/12", + - "192.168.0.0/16" + ] + }] + + def change + add_column :remote_development_agent_configs, + :network_policy_egress, + :jsonb, + null: false, + default: NETWORK_POLICY_EGRESS_DEFAULT + end +end diff --git a/db/migrate/20231107071201_add_project_authorizations_recalculated_at_to_user_details.rb b/db/migrate/20231107071201_add_project_authorizations_recalculated_at_to_user_details.rb new file mode 100644 index 00000000000..c7f0ca83695 --- /dev/null +++ b/db/migrate/20231107071201_add_project_authorizations_recalculated_at_to_user_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddProjectAuthorizationsRecalculatedAtToUserDetails < Gitlab::Database::Migration[2.2] + milestone '16.6' + enable_lock_retries! + + def change + add_column :user_details, :project_authorizations_recalculated_at, :datetime_with_timezone, + default: '2010-01-01', null: false + end +end diff --git a/db/migrate/20231107205734_add_update_namespace_name_to_application_settings.rb b/db/migrate/20231107205734_add_update_namespace_name_to_application_settings.rb new file mode 100644 index 00000000000..a812166ed9d --- /dev/null +++ b/db/migrate/20231107205734_add_update_namespace_name_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddUpdateNamespaceNameToApplicationSettings < Gitlab::Database::Migration[2.2] + milestone '16.6' + + def change + add_column :application_settings, :update_namespace_name_rate_limit, :smallint, default: 120, null: false + end +end diff --git a/db/migrate/20231108072342_add_display_time_format_preference.rb b/db/migrate/20231108072342_add_display_time_format_preference.rb new file mode 100644 index 00000000000..2f3773f73ef --- /dev/null +++ b/db/migrate/20231108072342_add_display_time_format_preference.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddDisplayTimeFormatPreference < Gitlab::Database::Migration[2.2] + milestone '16.6' + enable_lock_retries! + + def change + add_column :user_preferences, :time_display_format, :integer, limit: 2, default: 0, null: false + end +end diff --git a/db/migrate/20231108093031_add_allow_project_creation_for_guest_and_below_to_application_settings.rb b/db/migrate/20231108093031_add_allow_project_creation_for_guest_and_below_to_application_settings.rb new file mode 100644 index 00000000000..06e0a7fc000 --- /dev/null +++ b/db/migrate/20231108093031_add_allow_project_creation_for_guest_and_below_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddAllowProjectCreationForGuestAndBelowToApplicationSettings < Gitlab::Database::Migration[2.2] + milestone '16.6' + + def change + add_column(:application_settings, :allow_project_creation_for_guest_and_below, :boolean, default: true, null: false) + end +end diff --git a/db/migrate/20231109133153_drop_idx_namespaces_on_ldap_sync_last_successful_update_at_for_gitlab.rb b/db/migrate/20231109133153_drop_idx_namespaces_on_ldap_sync_last_successful_update_at_for_gitlab.rb new file mode 100644 index 00000000000..1d171e3285c --- /dev/null +++ b/db/migrate/20231109133153_drop_idx_namespaces_on_ldap_sync_last_successful_update_at_for_gitlab.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class DropIdxNamespacesOnLdapSyncLastSuccessfulUpdateAtForGitlab < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + TABLE_NAME = :namespaces + INDEX_NAME = :index_namespaces_on_ldap_sync_last_successful_update_at + + def up + return unless should_run? + + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end + + def down + return unless should_run? + + add_concurrent_index TABLE_NAME, :ldap_sync_last_successful_update_at, name: INDEX_NAME + end + + private + + def should_run? + Gitlab.com_except_jh? + end +end diff --git a/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb b/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb index b7b02e483df..26ae9aed5cc 100644 --- a/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb +++ b/db/post_migrate/20220531233600_remove_sse_usage_data_from_redis.rb @@ -3,6 +3,8 @@ class RemoveSseUsageDataFromRedis < Gitlab::Database::Migration[2.0] disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + def up Gitlab::Redis::SharedState.with { |r| r.del("USAGE_STATIC_SITE_EDITOR_VIEWS") } Gitlab::Redis::SharedState.with { |r| r.del("USAGE_STATIC_SITE_EDITOR_COMMITS") } diff --git a/db/post_migrate/20220617123022_add_unique_index_on_projects_on_runners_token.rb b/db/post_migrate/20220617123022_add_unique_index_on_projects_on_runners_token.rb index 1e0409b16ea..abd730685d7 100644 --- a/db/post_migrate/20220617123022_add_unique_index_on_projects_on_runners_token.rb +++ b/db/post_migrate/20220617123022_add_unique_index_on_projects_on_runners_token.rb @@ -6,10 +6,12 @@ class AddUniqueIndexOnProjectsOnRunnersToken < Gitlab::Database::Migration[2.0] INDEX_NAME = 'index_uniq_projects_on_runners_token' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :projects, :runners_token, name: INDEX_NAME, unique: true + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20220617123034_add_unique_index_on_projects_on_runners_token_encrypted.rb b/db/post_migrate/20220617123034_add_unique_index_on_projects_on_runners_token_encrypted.rb index b9ba570606e..51b630397dc 100644 --- a/db/post_migrate/20220617123034_add_unique_index_on_projects_on_runners_token_encrypted.rb +++ b/db/post_migrate/20220617123034_add_unique_index_on_projects_on_runners_token_encrypted.rb @@ -6,10 +6,12 @@ class AddUniqueIndexOnProjectsOnRunnersTokenEncrypted < Gitlab::Database::Migrat INDEX_NAME = 'index_uniq_projects_on_runners_token_encrypted' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :projects, :runners_token_encrypted, name: INDEX_NAME, unique: true + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb b/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb index 7b80b6a15bd..62511e0e616 100644 --- a/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb +++ b/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb @@ -147,7 +147,6 @@ class MoveSecurityFindingsTableToGitlabPartitionsDynamicSchema < Gitlab::Databas latest_partition.match(/security_findings_(\d+)/).captures.first end - # rubocop:disable Migration/DropTable (These methods are called from the `down` method) def create_non_partitioned_security_findings_with_data with_lock_retries do lock_tables @@ -227,6 +226,5 @@ class MoveSecurityFindingsTableToGitlabPartitionsDynamicSchema < Gitlab::Databas SQL end end - # rubocop:enable Migration/DropTable end # rubocop:enable Migration/WithLockRetriesDisallowedMethod diff --git a/db/post_migrate/20220920135356_tiebreak_user_type_index.rb b/db/post_migrate/20220920135356_tiebreak_user_type_index.rb index 778a957086f..489196c8eab 100644 --- a/db/post_migrate/20220920135356_tiebreak_user_type_index.rb +++ b/db/post_migrate/20220920135356_tiebreak_user_type_index.rb @@ -7,7 +7,9 @@ class TiebreakUserTypeIndex < Gitlab::Database::Migration[2.0] OLD_INDEX_NAME = 'index_users_on_user_type' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, [:user_type, :id], name: NEW_INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation remove_concurrent_index_by_name :users, OLD_INDEX_NAME end diff --git a/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb b/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb index b46b316981d..1cb93886ca3 100644 --- a/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb +++ b/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb @@ -6,6 +6,7 @@ class AddTempIndexForUserDetailsFields < Gitlab::Database::Migration[2.0] disable_ddl_transaction! def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, :id, name: INDEX_NAME, where: <<~QUERY (COALESCE(linkedin, '') IS DISTINCT FROM '') OR (COALESCE(twitter, '') IS DISTINCT FROM '') @@ -14,6 +15,7 @@ class AddTempIndexForUserDetailsFields < Gitlab::Database::Migration[2.0] OR (COALESCE(location, '') IS DISTINCT FROM '') OR (COALESCE(organization, '') IS DISTINCT FROM '') QUERY + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20221221150123_update_billable_users_index.rb b/db/post_migrate/20221221150123_update_billable_users_index.rb index d2f55e06b0b..d77669f6a69 100644 --- a/db/post_migrate/20221221150123_update_billable_users_index.rb +++ b/db/post_migrate/20221221150123_update_billable_users_index.rb @@ -16,7 +16,9 @@ class UpdateBillableUsersIndex < Gitlab::Database::Migration[2.1] QUERY def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index(:users, :id, where: NEW_INDEX_CONDITION, name: NEW_INDEX) + # rubocop:enable Migration/PreventIndexCreation remove_concurrent_index_by_name(:users, OLD_INDEX) end diff --git a/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb b/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb index e86a2476156..842c7295fcb 100644 --- a/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb +++ b/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb @@ -16,7 +16,9 @@ class UpdateBillableUsersIndexForServiceAccounts < Gitlab::Database::Migration[2 QUERY def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index(:users, :id, where: NEW_INDEX_CONDITION, name: NEW_INDEX) + # rubocop:enable Migration/PreventIndexCreation remove_concurrent_index_by_name(:users, OLD_INDEX) end diff --git a/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb b/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb index 8f9e193f0eb..d4f48c1c977 100644 --- a/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb +++ b/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb @@ -6,6 +6,7 @@ class AddUserTypeMigrationIndexes < Gitlab::Database::Migration[2.1] BILLABLE_INDEX = 'index_users_for_active_billable_users_migration' LAST_ACTIVITY_INDEX = 'i_users_on_last_activity_for_active_human_service_migration' + # rubocop:disable Migration/PreventIndexCreation def up # Temporary indexes to migrate human user_type. See https://gitlab.com/gitlab-org/gitlab/-/issues/386474 add_concurrent_index :users, :id, name: BILLABLE_INDEX, @@ -14,6 +15,7 @@ class AddUserTypeMigrationIndexes < Gitlab::Database::Migration[2.1] add_concurrent_index :users, [:id, :last_activity_on], name: LAST_ACTIVITY_INDEX, where: "((state)::text = 'active'::text) AND ((user_type IS NULL OR user_type = 0) OR (user_type = 4))" end + # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :users, BILLABLE_INDEX diff --git a/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb b/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb index 539ce99a319..147409bf5f0 100644 --- a/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb +++ b/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb @@ -8,9 +8,11 @@ class RecreateUserTypeMigrationIndexes < Gitlab::Database::Migration[2.1] def up # Temporary index to migrate human user_type. See https://gitlab.com/gitlab-org/gitlab/-/issues/386474 + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, :id, name: BILLABLE_INDEX, where: "state = 'active' AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[0, 6, 4, 13]))) " \ "AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[0, 4, 5])))" + # rubocop:enable Migration/PreventIndexCreation remove_concurrent_index_by_name :users, INCORRECT_BILLABLE_INDEX end diff --git a/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb b/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb index ebb6e53341f..01d5c3a79b0 100644 --- a/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb +++ b/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop: disable BackgroundMigration/MissingDictionaryFile +# rubocop: disable BackgroundMigration/DictionaryFile class RescheduleMigrationForRemediation < Gitlab::Database::Migration[2.1] MIGRATION = 'MigrateRemediationsForVulnerabilityFindings' @@ -29,4 +29,4 @@ class RescheduleMigrationForRemediation < Gitlab::Database::Migration[2.1] delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, []) end end -# rubocop: enable BackgroundMigration/MissingDictionaryFile +# rubocop: enable BackgroundMigration/DictionaryFile 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 59bff26f964..22ef3381c17 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,6 +3,8 @@ class MigrateDailyRedisHllEventsToWeeklyAggregation < Gitlab::Database::Migration[2.1] disable_ddl_transaction! + 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/20230328111013_re_migrate_redis_slot_keys.rb b/db/post_migrate/20230328111013_re_migrate_redis_slot_keys.rb index 17776d8e42e..a4061c3c7c6 100644 --- a/db/post_migrate/20230328111013_re_migrate_redis_slot_keys.rb +++ b/db/post_migrate/20230328111013_re_migrate_redis_slot_keys.rb @@ -3,6 +3,8 @@ class ReMigrateRedisSlotKeys < Gitlab::Database::Migration[2.1] disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + KEY_EXPIRY_LENGTH = 6.weeks DAILY_EVENTS = diff --git a/db/post_migrate/20230405200858_requeue_backfill_project_wiki_repositories.rb b/db/post_migrate/20230405200858_requeue_backfill_project_wiki_repositories.rb index 363a3099064..6c4792d0d6c 100644 --- a/db/post_migrate/20230405200858_requeue_backfill_project_wiki_repositories.rb +++ b/db/post_migrate/20230405200858_requeue_backfill_project_wiki_repositories.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop:disable BackgroundMigration/MissingDictionaryFile +# rubocop:disable BackgroundMigration/DictionaryFile class RequeueBackfillProjectWikiRepositories < Gitlab::Database::Migration[2.1] MIGRATION = "BackfillProjectWikiRepositories" DELAY_INTERVAL = 2.minutes @@ -26,4 +26,4 @@ class RequeueBackfillProjectWikiRepositories < Gitlab::Database::Migration[2.1] delete_batched_background_migration(MIGRATION, :projects, :id, []) end end -# rubocop:enable BackgroundMigration/MissingDictionaryFile +# rubocop:enable BackgroundMigration/DictionaryFile diff --git a/db/post_migrate/20230508150219_reschedule_evidences_handling_unicode.rb b/db/post_migrate/20230508150219_reschedule_evidences_handling_unicode.rb index 804db553f6f..ed23df4405e 100644 --- a/db/post_migrate/20230508150219_reschedule_evidences_handling_unicode.rb +++ b/db/post_migrate/20230508150219_reschedule_evidences_handling_unicode.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop:disable BackgroundMigration/MissingDictionaryFile +# rubocop:disable BackgroundMigration/DictionaryFile class RescheduleEvidencesHandlingUnicode < Gitlab::Database::Migration[2.1] restrict_gitlab_migration gitlab_schema: :gitlab_main @@ -29,4 +29,4 @@ class RescheduleEvidencesHandlingUnicode < Gitlab::Database::Migration[2.1] delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, []) end end -# rubocop:enable BackgroundMigration/MissingDictionaryFile +# rubocop:enable BackgroundMigration/DictionaryFile diff --git a/db/post_migrate/20230522111534_reschedule_migration_for_links_from_metadata.rb b/db/post_migrate/20230522111534_reschedule_migration_for_links_from_metadata.rb index d351d795ddf..f49b158593f 100644 --- a/db/post_migrate/20230522111534_reschedule_migration_for_links_from_metadata.rb +++ b/db/post_migrate/20230522111534_reschedule_migration_for_links_from_metadata.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop: disable BackgroundMigration/MissingDictionaryFile +# rubocop: disable BackgroundMigration/DictionaryFile class RescheduleMigrationForLinksFromMetadata < Gitlab::Database::Migration[2.1] MIGRATION = 'MigrateLinksForVulnerabilityFindings' @@ -29,4 +29,4 @@ class RescheduleMigrationForLinksFromMetadata < Gitlab::Database::Migration[2.1] delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, []) end end -# rubocop: enable BackgroundMigration/MissingDictionaryFile +# rubocop: enable BackgroundMigration/DictionaryFile diff --git a/db/post_migrate/20230619005223_change_unconfirmed_created_at_index_on_users.rb b/db/post_migrate/20230619005223_change_unconfirmed_created_at_index_on_users.rb index 5b9b4e36512..e299ce394a3 100644 --- a/db/post_migrate/20230619005223_change_unconfirmed_created_at_index_on_users.rb +++ b/db/post_migrate/20230619005223_change_unconfirmed_created_at_index_on_users.rb @@ -7,9 +7,11 @@ class ChangeUnconfirmedCreatedAtIndexOnUsers < Gitlab::Database::Migration[2.1] NEW_INDEX_NAME = 'index_users_on_unconfirmed_created_at_active_type_sign_in_count' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, [:created_at, :id], name: NEW_INDEX_NAME, where: "confirmed_at IS NULL AND state = 'active' AND user_type IN (0) AND sign_in_count = 0" + # rubocop:enable Migration/PreventIndexCreation remove_concurrent_index_by_name :users, OLD_INDEX_NAME 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 index b066cb248fb..fd2387e2bc4 100644 --- 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 @@ -9,7 +9,9 @@ class IndexProjectsOnNamespaceIdAndRepositorySizeLimit < Gitlab::Database::Migra disable_ddl_transaction! def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :projects, [:namespace_id, :repository_size_limit], name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation end def down 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 index 1a849e7b728..055174b9e32 100644 --- a/db/post_migrate/20230728151058_add_auditor_index_to_users_table.rb +++ b/db/post_migrate/20230728151058_add_auditor_index_to_users_table.rb @@ -5,7 +5,9 @@ class AddAuditorIndexToUsersTable < Gitlab::Database::Migration[2.1] disable_ddl_transaction! def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :users, :id, where: 'auditor IS true', name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20230913130629_index_org_id_on_projects.rb b/db/post_migrate/20230913130629_index_org_id_on_projects.rb index 45186b900c6..c4d3de6c172 100644 --- a/db/post_migrate/20230913130629_index_org_id_on_projects.rb +++ b/db/post_migrate/20230913130629_index_org_id_on_projects.rb @@ -6,7 +6,9 @@ class IndexOrgIdOnProjects < Gitlab::Database::Migration[2.1] INDEX_NAME = 'index_projects_on_organization_id' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :projects, :organization_id, name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb b/db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb new file mode 100644 index 00000000000..7d4d6876848 --- /dev/null +++ b/db/post_migrate/20231003045342_migrate_sidekiq_namespaced_jobs.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +class MigrateSidekiqNamespacedJobs < Gitlab::Database::Migration[2.1] + BATCH_SIZE = 1000 + SORTED_SET_NAMES = %w[schedule retry dead] + + def up + SORTED_SET_NAMES.each do |set_name| + sorted_set_migrate("resque:gitlab:#{set_name}", set_name) + end + + Sidekiq::Queue.all.each do |queue| + name = queue.name + sidekiq_queue_migrate("resque:gitlab:queue:#{name}", to: "queue:#{name}") + end + end + + def down + SORTED_SET_NAMES.each do |set_name| + sorted_set_migrate(set_name, "resque:gitlab:#{set_name}") + end + + Sidekiq::Queue.all.each do |queue| + name = queue.name + sidekiq_queue_migrate("queue:#{name}", to: "resque:gitlab:queue:#{name}") + end + end + + private + + def sidekiq_queue_migrate(queue_from, to:) + Gitlab::Redis::Queues.with do |conn| # rubocop:disable Cop/RedisQueueUsage + conn.rpoplpush(queue_from, to) while conn.llen(queue_from) > 0 + end + end + + def sorted_set_migrate(from, to) + cursor = '0' + + loop do + result = [] + + Gitlab::Redis::Queues.with do |redis| # rubocop:disable Cop/RedisQueueUsage + cursor, result = redis.zscan(from, cursor, count: BATCH_SIZE) + + next if result.empty? + + redis.multi do |multi| + multi.zadd(to, result.map { |k, v| [v, k] }) + multi.zrem(from, result.map { |k, _v| k }) + end + end + + sleep(0.01) + + break if cursor == '0' + end + end +end diff --git a/db/post_migrate/20231003142534_add_build_timeout_index.rb b/db/post_migrate/20231003142534_add_build_timeout_index.rb index 3a95c7cf748..5820a35eb8d 100644 --- a/db/post_migrate/20231003142534_add_build_timeout_index.rb +++ b/db/post_migrate/20231003142534_add_build_timeout_index.rb @@ -6,7 +6,9 @@ class AddBuildTimeoutIndex < Gitlab::Database::Migration[2.1] INDEX_NAME = 'index_projects_on_id_where_build_timeout_geq_than_2629746' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :projects, :id, where: 'build_timeout >= 2629746', name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20231009105056_index_users_on_email_domain_and_id.rb b/db/post_migrate/20231009105056_index_users_on_email_domain_and_id.rb index e6b750ca38b..61aab7cc2c4 100644 --- a/db/post_migrate/20231009105056_index_users_on_email_domain_and_id.rb +++ b/db/post_migrate/20231009105056_index_users_on_email_domain_and_id.rb @@ -6,7 +6,9 @@ class IndexUsersOnEmailDomainAndId < Gitlab::Database::Migration[2.1] INDEX_NAME = 'index_users_on_email_domain_and_id' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index(:users, "lower(split_part(email, '@', 2)), id", name: INDEX_NAME) + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20231016001000_fix_design_user_mentions_design_id_note_id_index_for_self_managed.rb b/db/post_migrate/20231016001000_fix_design_user_mentions_design_id_note_id_index_for_self_managed.rb new file mode 100644 index 00000000000..454158ecbee --- /dev/null +++ b/db/post_migrate/20231016001000_fix_design_user_mentions_design_id_note_id_index_for_self_managed.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class FixDesignUserMentionsDesignIdNoteIdIndexForSelfManaged < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::ConvertToBigint + + disable_ddl_transaction! + + TABLE_NAME = 'design_user_mentions' + INDEX_NAME = 'design_user_mentions_on_design_id_and_note_id_unique_index' + + def up + return if com_or_dev_or_test_but_not_jh? + return if index_exists?(TABLE_NAME, [:design_id, :note_id], unique: true, name: INDEX_NAME) + + add_concurrent_index TABLE_NAME, [:design_id, :note_id], unique: true, name: "#{INDEX_NAME}_int8" + + with_lock_retries(raise_on_exhaustion: true) do + execute "LOCK TABLE #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE" + + execute "DROP INDEX IF EXISTS #{INDEX_NAME}" + rename_index TABLE_NAME, "#{INDEX_NAME}_int8", INDEX_NAME + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb b/db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb new file mode 100644 index 00000000000..0d8fbdfea00 --- /dev/null +++ b/db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToMergeAccessLevels < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.6' + + INDEX_NAME = 'tmp_idx_protected_branch_merge_access_levels_on_id_with_group' + + def up + # Temporary index to be removed in 16.7 https://gitlab.com/gitlab-org/gitlab/-/issues/430843 + add_concurrent_index( + :protected_branch_merge_access_levels, + %i[id], + where: 'group_id IS NOT NULL', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :protected_branch_merge_access_levels, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb b/db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb new file mode 100644 index 00000000000..3f4009d783c --- /dev/null +++ b/db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class QueueDeleteInvalidProtectedBranchMergeAccessLevels < Gitlab::Database::Migration[2.1] + MIGRATION = "DeleteInvalidProtectedBranchMergeAccessLevels" + DELAY_INTERVAL = 2.minutes + MAX_BATCH_SIZE = 10_000 + BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 500 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :protected_branch_merge_access_levels, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231016173129', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :protected_branch_merge_access_levels, :id, []) + end +end diff --git a/db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb b/db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb new file mode 100644 index 00000000000..91599051fd4 --- /dev/null +++ b/db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToPushAccessLevels < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.6' + INDEX_NAME = 'tmp_idx_protected_branch_push_access_levels_on_id_with_group' + + def up + # Temporary index to be removed in 16.7 https://gitlab.com/gitlab-org/gitlab/-/issues/430843 + add_concurrent_index( + :protected_branch_push_access_levels, + %i[id], + where: 'group_id IS NOT NULL', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :protected_branch_push_access_levels, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb b/db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb new file mode 100644 index 00000000000..6accaa3296b --- /dev/null +++ b/db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class QueueDeleteInvalidProtectedBranchPushAccessLevels < Gitlab::Database::Migration[2.1] + MIGRATION = "DeleteInvalidProtectedBranchPushAccessLevels" + DELAY_INTERVAL = 2.minutes + MAX_BATCH_SIZE = 10_000 + BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 500 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :protected_branch_push_access_levels, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231016194927', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :protected_branch_push_access_levels, :id, []) + end +end diff --git a/db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb b/db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb new file mode 100644 index 00000000000..d28b664c517 --- /dev/null +++ b/db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToCreateAccessLevels < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.6' + + INDEX_NAME = 'tmp_idx_protected_tag_create_access_levels_on_id_with_group' + + def up + # Temporary index to be removed in 16.7 https://gitlab.com/gitlab-org/gitlab/-/issues/430843 + add_concurrent_index( + :protected_tag_create_access_levels, + %i[id], + where: 'group_id IS NOT NULL', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :protected_tag_create_access_levels, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb b/db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb new file mode 100644 index 00000000000..5880124d0a6 --- /dev/null +++ b/db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class QueueDeleteInvalidProtectedTagCreateAccessLevels < Gitlab::Database::Migration[2.1] + MIGRATION = "DeleteInvalidProtectedTagCreateAccessLevels" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10_000 + SUB_BATCH_SIZE = 500 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :protected_tag_create_access_levels, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231016194943', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :protected_tag_create_access_levels, :id, []) + end +end diff --git a/db/post_migrate/20231017172156_add_index_on_projects_for_adjourned_deletion.rb b/db/post_migrate/20231017172156_add_index_on_projects_for_adjourned_deletion.rb index 6a689a5e11a..9b73035471e 100644 --- a/db/post_migrate/20231017172156_add_index_on_projects_for_adjourned_deletion.rb +++ b/db/post_migrate/20231017172156_add_index_on_projects_for_adjourned_deletion.rb @@ -6,10 +6,12 @@ class AddIndexOnProjectsForAdjournedDeletion < Gitlab::Database::Migration[2.1] INDEX_NAME = 'index_projects_id_for_aimed_for_deletion' def up + # rubocop:disable Migration/PreventIndexCreation add_concurrent_index :projects, [:id, :marked_for_deletion_at], where: 'marked_for_deletion_at IS NOT NULL AND pending_delete = false', name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20231018083247_remove_users_email_opted_in_columns.rb b/db/post_migrate/20231018083247_remove_users_email_opted_in_columns.rb new file mode 100644 index 00000000000..a77ccb599df --- /dev/null +++ b/db/post_migrate/20231018083247_remove_users_email_opted_in_columns.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class RemoveUsersEmailOptedInColumns < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + remove_column :users, :email_opted_in + remove_column :users, :email_opted_in_ip + remove_column :users, :email_opted_in_source_id + remove_column :users, :email_opted_in_at + end + + # This migration removes columns. Disabling rule only for rollback action + # rubocop:disable Migration/AddColumnsToWideTables + def down + add_column :users, :email_opted_in, :boolean + add_column :users, :email_opted_in_ip, :string + add_column :users, :email_opted_in_source_id, :integer + add_column :users, :email_opted_in_at, :datetime_with_timezone + end + # rubocop:enable Migration/AddColumnsToWideTables +end diff --git a/db/post_migrate/20231018093625_drop_index_namespaces_on_shared_and_extra_runners_minutes_limit.rb b/db/post_migrate/20231018093625_drop_index_namespaces_on_shared_and_extra_runners_minutes_limit.rb new file mode 100644 index 00000000000..9b293b066d6 --- /dev/null +++ b/db/post_migrate/20231018093625_drop_index_namespaces_on_shared_and_extra_runners_minutes_limit.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropIndexNamespacesOnSharedAndExtraRunnersMinutesLimit < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = :namespaces + INDEX_NAME = :index_namespaces_on_shared_and_extra_runners_minutes_limit + + def up + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end + + def down + # no-op + # Since adding the same index will be time consuming, + # we have to create it asynchronously using 'prepare_async_index' helper (if needed). + end +end diff --git a/db/post_migrate/20231018105749_remove_application_settings_marketing_emails_enabled_column.rb b/db/post_migrate/20231018105749_remove_application_settings_marketing_emails_enabled_column.rb new file mode 100644 index 00000000000..ea7ef21f110 --- /dev/null +++ b/db/post_migrate/20231018105749_remove_application_settings_marketing_emails_enabled_column.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveApplicationSettingsMarketingEmailsEnabledColumn < Gitlab::Database::Migration[2.1] + def up + remove_column :application_settings, :in_product_marketing_emails_enabled + end + + def down + add_column :application_settings, :in_product_marketing_emails_enabled, :boolean, default: true, null: false + end +end diff --git a/db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb b/db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb new file mode 100644 index 00000000000..4065bad5fb5 --- /dev/null +++ b/db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +class SwapColumnsForCiPipelinesPipelineIdBigintV2 < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum + include Gitlab::Database::MigrationHelpers::Swapping + + disable_ddl_transaction! + + TABLE_NAME = :ci_pipelines + TRIGGER_FUNCTION_NAME = :trigger_1bd97da9c1a4 + COLUMN_NAME = :auto_canceled_by_id + BIGINT_COLUMN_NAME = :auto_canceled_by_id_convert_to_bigint + FK_NAME = :fk_262d4c2d19 + BIGINT_FK_NAME = :fk_67e4288f3a + INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id + BIGINT_INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id_bigint + + def up + return if should_skip? || column_type_of?(:bigint) + + swap + end + + def down + return if should_skip? || column_type_of?(:integer) + + swap + end + + private + + def should_skip? + !can_execute_on?(TABLE_NAME) + end + + def column_type_of?(type) + column_for(TABLE_NAME, COLUMN_NAME).sql_type.to_s == type.to_s + end + + def swap + # rubocop:disable Migration/WithLockRetriesDisallowedMethod + with_lock_retries(raise_on_exhaustion: true) do + # Lock the tables involved. + lock_tables(TABLE_NAME) + + # Rename the columns to swap names + swap_columns(TABLE_NAME, COLUMN_NAME, BIGINT_COLUMN_NAME) + + # Reset the trigger function + reset_trigger_function(TRIGGER_FUNCTION_NAME) + + # Swap fkey constraint + swap_foreign_keys(TABLE_NAME, FK_NAME, BIGINT_FK_NAME) + + # Swap index + swap_indexes(TABLE_NAME, INDEX_NAME, BIGINT_INDEX_NAME) + end + # rubocop:enable Migration/WithLockRetriesDisallowedMethod + end +end diff --git a/db/post_migrate/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2.rb b/db/post_migrate/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2.rb new file mode 100644 index 00000000000..d64d2ea737d --- /dev/null +++ b/db/post_migrate/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +class SwapColumnsForCiStagesPipelineIdBigintV2 < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum + include Gitlab::Database::MigrationHelpers::Swapping + + disable_ddl_transaction! + + TABLE_NAME = :ci_stages + TRIGGER_FUNCTION_NAME = :trigger_07bc3c48f407 + COLUMN_NAME = :pipeline_id + BIGINT_COLUMN_NAME = :pipeline_id_convert_to_bigint + FK_NAME = :fk_fb57e6cc56 + BIGINT_FK_NAME = :fk_c5ddde695f + INDEX_NAMES = %i[ + index_ci_stages_on_pipeline_id + index_ci_stages_on_pipeline_id_and_id + index_ci_stages_on_pipeline_id_and_name + index_ci_stages_on_pipeline_id_and_position + ] + BIGINT_INDEX_NAMES = %i[ + index_ci_stages_on_pipeline_id_convert_to_bigint + index_ci_stages_on_pipeline_id_convert_to_bigint_and_id + index_ci_stages_on_pipeline_id_convert_to_bigint_and_name + index_ci_stages_on_pipeline_id_convert_to_bigint_and_position + ] + + def up + return if should_skip? || column_type_of?(:bigint) + + swap + end + + def down + return if should_skip? || column_type_of?(:integer) + + swap + end + + private + + def should_skip? + !can_execute_on?(:ci_pipelines, :ci_stages) + end + + def column_type_of?(type) + column_for(TABLE_NAME, COLUMN_NAME).sql_type.to_s == type.to_s + end + + def swap + # rubocop:disable Migration/WithLockRetriesDisallowedMethod + with_lock_retries(raise_on_exhaustion: true) do + # Lock the tables involved. + lock_tables(:ci_pipelines, :ci_stages) + + # Rename the columns to swap names + swap_columns(TABLE_NAME, COLUMN_NAME, BIGINT_COLUMN_NAME) + + # Reset the trigger function + reset_trigger_function(TRIGGER_FUNCTION_NAME) + + # Swap fkey constraint + swap_foreign_keys(TABLE_NAME, FK_NAME, BIGINT_FK_NAME) + + # Swap index + INDEX_NAMES.each_with_index do |index_name, i| + swap_indexes(TABLE_NAME, index_name, BIGINT_INDEX_NAMES[i]) + end + end + # rubocop:enable Migration/WithLockRetriesDisallowedMethod + end +end diff --git a/db/post_migrate/20231019223224_backfill_catalog_resources_name_and_description.rb b/db/post_migrate/20231019223224_backfill_catalog_resources_name_and_description.rb new file mode 100644 index 00000000000..fd5db7621e3 --- /dev/null +++ b/db/post_migrate/20231019223224_backfill_catalog_resources_name_and_description.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class BackfillCatalogResourcesNameAndDescription < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + sql = <<-SQL + UPDATE catalog_resources + SET name = projects.name, + description = projects.description + FROM projects + WHERE catalog_resources.project_id = projects.id + SQL + + execute(sql) + end + + def down + # no-op + + # The `name` and `description` columns in `catalog_resources` are denormalized; + # they should always stay in sync with the corresponding data in `projects`. + end +end diff --git a/db/post_migrate/20231020082425_remove_force_full_reconciliation_from_workspaces.rb b/db/post_migrate/20231020082425_remove_force_full_reconciliation_from_workspaces.rb new file mode 100644 index 00000000000..85283183323 --- /dev/null +++ b/db/post_migrate/20231020082425_remove_force_full_reconciliation_from_workspaces.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RemoveForceFullReconciliationFromWorkspaces < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def change + remove_column :workspaces, :force_full_reconciliation, :boolean, default: false, null: false + end +end diff --git a/db/post_migrate/20231020150211_delete_duplicated_index_scan_result_policies_on_policy_configuration_id.rb b/db/post_migrate/20231020150211_delete_duplicated_index_scan_result_policies_on_policy_configuration_id.rb new file mode 100644 index 00000000000..8df7a7d5194 --- /dev/null +++ b/db/post_migrate/20231020150211_delete_duplicated_index_scan_result_policies_on_policy_configuration_id.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DeleteDuplicatedIndexScanResultPoliciesOnPolicyConfigurationId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_scan_result_policies_on_policy_configuration_id' + COLUMNS = %i[security_orchestration_policy_configuration_id] + + def up + remove_concurrent_index_by_name :scan_result_policies, INDEX_NAME + end + + def down + add_concurrent_index :scan_result_policies, COLUMNS, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20231023083349_init_conversion_for_p_ci_builds.rb b/db/post_migrate/20231023083349_init_conversion_for_p_ci_builds.rb new file mode 100644 index 00000000000..886e8c85599 --- /dev/null +++ b/db/post_migrate/20231023083349_init_conversion_for_p_ci_builds.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +class InitConversionForPCiBuilds < Gitlab::Database::Migration[2.1] + include ::Gitlab::Database::MigrationHelpers::WraparoundAutovacuum + + disable_ddl_transaction! + + TABLE_NAME = :p_ci_builds + COLUMN_NAMES = %i[ + auto_canceled_by_id + commit_id + erased_by_id + project_id + runner_id + trigger_request_id + upstream_pipeline_id + user_id + ] + + def up + return if should_skip? + + initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES) + end + + def down + return if should_skip? + + revert_initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES) + end + + private + + def should_skip? + !can_execute_on?(TABLE_NAME) + end +end diff --git a/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb b/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb new file mode 100644 index 00000000000..01fe32d6bd7 --- /dev/null +++ b/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.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 AddIndexStoppingEnvironmentsOnUpdatedAt < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_environments_on_updated_at_for_stopping_state' + + disable_ddl_transaction! + + def up + add_concurrent_index :environments, :updated_at, where: "state = 'stopping'", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :environments, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20231023164908_async_drop_index_users_on_accepted_term_id.rb b/db/post_migrate/20231023164908_async_drop_index_users_on_accepted_term_id.rb new file mode 100644 index 00000000000..a5688a9b196 --- /dev/null +++ b/db/post_migrate/20231023164908_async_drop_index_users_on_accepted_term_id.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AsyncDropIndexUsersOnAcceptedTermId < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + TABLE_NAME = 'users' + INDEX_NAME = 'index_users_on_accepted_term_id' + COLUMN = 'accepted_term_id' + + # TODO: Index to be destroyed synchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135293 + def up + prepare_async_index_removal TABLE_NAME, COLUMN, name: INDEX_NAME + end + + def down + prepare_async_index_removal TABLE_NAME, COLUMN, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb b/db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb new file mode 100644 index 00000000000..8f2f8a4064c --- /dev/null +++ b/db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class DropIndexNamespacesOnCreatedAtForGitlabCom < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = :namespaces + INDEX_NAME = :index_namespaces_on_created_at + + def up + return unless should_run? + + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end + + def down + return unless should_run? + + add_concurrent_index TABLE_NAME, :created_at, name: INDEX_NAME + end + + def should_run? + Gitlab.com_except_jh? + end +end diff --git a/db/post_migrate/20231024025457_cleanup_bigint_conversion_for_ci_project_monthly_usages_shared_runners_duration.rb b/db/post_migrate/20231024025457_cleanup_bigint_conversion_for_ci_project_monthly_usages_shared_runners_duration.rb new file mode 100644 index 00000000000..9528c00a1fd --- /dev/null +++ b/db/post_migrate/20231024025457_cleanup_bigint_conversion_for_ci_project_monthly_usages_shared_runners_duration.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class CleanupBigintConversionForCiProjectMonthlyUsagesSharedRunnersDuration < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + TABLE = :ci_project_monthly_usages + COLUMNS = [:shared_runners_duration] + + def up + cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + restore_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20231024025533_cleanup_bigint_conversion_for_ci_namespace_monthly_usages_shared_runners_duration.rb b/db/post_migrate/20231024025533_cleanup_bigint_conversion_for_ci_namespace_monthly_usages_shared_runners_duration.rb new file mode 100644 index 00000000000..792650130cd --- /dev/null +++ b/db/post_migrate/20231024025533_cleanup_bigint_conversion_for_ci_namespace_monthly_usages_shared_runners_duration.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class CleanupBigintConversionForCiNamespaceMonthlyUsagesSharedRunnersDuration < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + TABLE = :ci_namespace_monthly_usages + COLUMNS = [:shared_runners_duration] + + def up + cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + restore_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20231024025629_cleanup_ci_pipeline_chat_data_pipeline_id_bigint.rb b/db/post_migrate/20231024025629_cleanup_ci_pipeline_chat_data_pipeline_id_bigint.rb new file mode 100644 index 00000000000..e79f4eb43b7 --- /dev/null +++ b/db/post_migrate/20231024025629_cleanup_ci_pipeline_chat_data_pipeline_id_bigint.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CleanupCiPipelineChatDataPipelineIdBigint < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_pipeline_chat_data + COLUMNS = [:pipeline_id] + + def up + with_lock_retries(raise_on_exhaustion: true) do + cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) # rubocop:disable Migration/WithLockRetriesDisallowedMethod + end + end + + def down + restore_conversion_of_integer_to_bigint(TABLE, COLUMNS) + + add_concurrent_index( + TABLE, :pipeline_id_convert_to_bigint, + name: :index_ci_pipeline_chat_data_on_pipeline_id_convert_to_bigint, + unique: true + ) + add_concurrent_foreign_key( + TABLE, :ci_pipelines, + column: :pipeline_id_convert_to_bigint, + on_delete: :cascade, validate: true, reverse_lock_order: true + ) + end +end diff --git a/db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb b/db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb new file mode 100644 index 00000000000..6aa8019a182 --- /dev/null +++ b/db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CleanupCiSourcesPipelinesPipelineIdBigint < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_sources_pipelines + REFERENCING_TABLE = :ci_pipelines + COLUMNS = [:pipeline_id, :source_pipeline_id] + + def up + with_lock_retries(raise_on_exhaustion: true) do + lock_tables(:ci_pipelines, TABLE) + cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) # rubocop:disable Migration/WithLockRetriesDisallowedMethod + end + end + + def down + restore_conversion_of_integer_to_bigint(TABLE, COLUMNS) + + add_concurrent_index(TABLE, :pipeline_id_convert_to_bigint, + name: :index_ci_sources_pipelines_on_pipeline_id_bigint) + add_concurrent_index(TABLE, :source_pipeline_id_convert_to_bigint, + name: :index_ci_sources_pipelines_on_source_pipeline_id_bigint) + add_concurrent_foreign_key( + TABLE, REFERENCING_TABLE, + column: :pipeline_id_convert_to_bigint, + on_delete: :cascade, validate: true, reverse_lock_order: true + ) + add_concurrent_foreign_key( + TABLE, REFERENCING_TABLE, + column: :source_pipeline_id_convert_to_bigint, + on_delete: :cascade, validate: true, reverse_lock_order: true + ) + end +end diff --git a/db/post_migrate/20231024124856_remove_redundant_group_stages_index.rb b/db/post_migrate/20231024124856_remove_redundant_group_stages_index.rb new file mode 100644 index 00000000000..d9546597bd9 --- /dev/null +++ b/db/post_migrate/20231024124856_remove_redundant_group_stages_index.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveRedundantGroupStagesIndex < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.6' + + INDEX_NAME = 'index_analytics_ca_group_stages_on_group_id' + + def up + remove_concurrent_index_by_name(:analytics_cycle_analytics_group_stages, INDEX_NAME) + end + + def down + add_concurrent_index(:analytics_cycle_analytics_group_stages, :group_id, name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20231024125551_remove_redundant_mr_metrics_index_on_target_project_id.rb b/db/post_migrate/20231024125551_remove_redundant_mr_metrics_index_on_target_project_id.rb new file mode 100644 index 00000000000..2186402828d --- /dev/null +++ b/db/post_migrate/20231024125551_remove_redundant_mr_metrics_index_on_target_project_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveRedundantMrMetricsIndexOnTargetProjectId < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.6' + + INDEX_NAME = 'index_merge_request_metrics_on_target_project_id' + + def up + remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) + end + + def down + add_concurrent_index(:merge_request_metrics, :target_project_id, name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20231025025733_swap_columns_for_ci_pipelines_pipeline_id_bigint_for_self_host.rb b/db/post_migrate/20231025025733_swap_columns_for_ci_pipelines_pipeline_id_bigint_for_self_host.rb new file mode 100644 index 00000000000..a960258ff3d --- /dev/null +++ b/db/post_migrate/20231025025733_swap_columns_for_ci_pipelines_pipeline_id_bigint_for_self_host.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +class SwapColumnsForCiPipelinesPipelineIdBigintForSelfHost < Gitlab::Database::Migration[2.2] + include Gitlab::Database::MigrationHelpers::Swapping + + milestone '16.6' + disable_ddl_transaction! + + TABLE_NAME = :ci_pipelines + TRIGGER_FUNCTION_NAME = :trigger_1bd97da9c1a4 + COLUMN_NAME = :auto_canceled_by_id + BIGINT_COLUMN_NAME = :auto_canceled_by_id_convert_to_bigint + FK_NAME = :fk_262d4c2d19 + BIGINT_FK_NAME = :fk_67e4288f3a + INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id + BIGINT_INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id_bigint + + def up + return if column_type_of?(:bigint) + + swap + end + + def down + return if column_type_of?(:integer) + + swap + end + + private + + def column_type_of?(type) + column_for(TABLE_NAME, COLUMN_NAME).sql_type.to_s == type.to_s + end + + def swap + with_lock_retries(raise_on_exhaustion: true) do + # Lock the tables involved. + lock_tables(TABLE_NAME) + + # Rename the columns to swap names + swap_columns(TABLE_NAME, COLUMN_NAME, BIGINT_COLUMN_NAME) + + # Reset the trigger function + reset_trigger_function(TRIGGER_FUNCTION_NAME) + + # Swap fkey constraint + swap_foreign_keys(TABLE_NAME, FK_NAME, BIGINT_FK_NAME) + + # Swap index + swap_indexes(TABLE_NAME, INDEX_NAME, BIGINT_INDEX_NAME) + end + end +end diff --git a/db/post_migrate/20231025031337_cleanup_ci_pipeline_messages_pipeline_id_bigint.rb b/db/post_migrate/20231025031337_cleanup_ci_pipeline_messages_pipeline_id_bigint.rb new file mode 100644 index 00000000000..b9e44f8f2d0 --- /dev/null +++ b/db/post_migrate/20231025031337_cleanup_ci_pipeline_messages_pipeline_id_bigint.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CleanupCiPipelineMessagesPipelineIdBigint < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE = :ci_pipeline_messages + COLUMNS = [:pipeline_id] + + def up + with_lock_retries(raise_on_exhaustion: true) do + lock_tables(:ci_pipelines, TABLE) + cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) # rubocop:disable Migration/WithLockRetriesDisallowedMethod + end + end + + def down + restore_conversion_of_integer_to_bigint(TABLE, COLUMNS) + + add_concurrent_index( + TABLE, :pipeline_id_convert_to_bigint, + name: :index_ci_pipeline_messages_on_pipeline_id_convert_to_bigint + ) + add_concurrent_foreign_key( + TABLE, :ci_pipelines, + column: :pipeline_id_convert_to_bigint, + on_delete: :cascade, validate: true, reverse_lock_order: true + ) + end +end diff --git a/db/post_migrate/20231025031539_swap_columns_for_ci_stages_pipeline_id_bigint_for_self_host.rb b/db/post_migrate/20231025031539_swap_columns_for_ci_stages_pipeline_id_bigint_for_self_host.rb new file mode 100644 index 00000000000..c28f49899b6 --- /dev/null +++ b/db/post_migrate/20231025031539_swap_columns_for_ci_stages_pipeline_id_bigint_for_self_host.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +class SwapColumnsForCiStagesPipelineIdBigintForSelfHost < Gitlab::Database::Migration[2.2] + include Gitlab::Database::MigrationHelpers::Swapping + + milestone '16.6' + disable_ddl_transaction! + + TABLE_NAME = :ci_stages + TRIGGER_FUNCTION_NAME = :trigger_07bc3c48f407 + COLUMN_NAME = :pipeline_id + BIGINT_COLUMN_NAME = :pipeline_id_convert_to_bigint + FK_NAME = :fk_fb57e6cc56 + BIGINT_FK_NAME = :fk_c5ddde695f + INDEX_NAMES = %i[ + index_ci_stages_on_pipeline_id + index_ci_stages_on_pipeline_id_and_id + index_ci_stages_on_pipeline_id_and_name + index_ci_stages_on_pipeline_id_and_position + ] + BIGINT_INDEX_NAMES = %i[ + index_ci_stages_on_pipeline_id_convert_to_bigint + index_ci_stages_on_pipeline_id_convert_to_bigint_and_id + index_ci_stages_on_pipeline_id_convert_to_bigint_and_name + index_ci_stages_on_pipeline_id_convert_to_bigint_and_position + ] + + def up + return if column_type_of?(:bigint) + + swap + end + + def down + return if column_type_of?(:integer) + + swap + end + + private + + def column_type_of?(type) + column_for(TABLE_NAME, COLUMN_NAME).sql_type.to_s == type.to_s + end + + def swap + with_lock_retries(raise_on_exhaustion: true) do + # Lock the tables involved. + lock_tables(:ci_pipelines, :ci_stages) + + # Rename the columns to swap names + swap_columns(TABLE_NAME, COLUMN_NAME, BIGINT_COLUMN_NAME) + + # Reset the trigger function + reset_trigger_function(TRIGGER_FUNCTION_NAME) + + # Swap fkey constraint + swap_foreign_keys(TABLE_NAME, FK_NAME, BIGINT_FK_NAME) + + # Swap index + INDEX_NAMES.each_with_index do |index_name, i| + swap_indexes(TABLE_NAME, index_name, BIGINT_INDEX_NAMES[i]) + end + end + end +end diff --git a/db/post_migrate/20231026103346_drop_project_settings_jitsu_key.rb b/db/post_migrate/20231026103346_drop_project_settings_jitsu_key.rb new file mode 100644 index 00000000000..606648ca7fa --- /dev/null +++ b/db/post_migrate/20231026103346_drop_project_settings_jitsu_key.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class DropProjectSettingsJitsuKey < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_column :project_settings, :jitsu_key, if_exists: true + end + end + + def down + with_lock_retries do + add_column :project_settings, :jitsu_key, :text, if_not_exists: true + end + + add_text_limit :project_settings, :jitsu_key, 100 + end +end diff --git a/db/post_migrate/20231027013210_remove_partial_index_deployments_for_legacy_successful_deployments.rb b/db/post_migrate/20231027013210_remove_partial_index_deployments_for_legacy_successful_deployments.rb new file mode 100644 index 00000000000..2bd52fdc10a --- /dev/null +++ b/db/post_migrate/20231027013210_remove_partial_index_deployments_for_legacy_successful_deployments.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemovePartialIndexDeploymentsForLegacySuccessfulDeployments < Gitlab::Database::Migration[2.2] + INDEX_NAME = 'partial_index_deployments_for_legacy_successful_deployments' + + milestone '16.6' + + 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 partial_index_deployments_for_legacy_successful_deployments ON deployments + # USING btree (id) WHERE ((finished_at IS NULL) AND (status = 2)); + add_concurrent_index :deployments, :id, name: INDEX_NAME, where: '((finished_at IS NULL) AND (status = 2))' + end +end diff --git a/db/post_migrate/20231027060443_backfill_system_note_metadata_id_for_bigint_conversion.rb b/db/post_migrate/20231027060443_backfill_system_note_metadata_id_for_bigint_conversion.rb new file mode 100644 index 00000000000..d3c90134102 --- /dev/null +++ b/db/post_migrate/20231027060443_backfill_system_note_metadata_id_for_bigint_conversion.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class BackfillSystemNoteMetadataIdForBigintConversion < Gitlab::Database::Migration[2.2] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + TABLE = :system_note_metadata + COLUMNS = %i[id] + + milestone '16.6' + + def up + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS, sub_batch_size: 100) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/post_migrate/20231027083355_remove_projects_duplicated_indexes.rb b/db/post_migrate/20231027083355_remove_projects_duplicated_indexes.rb new file mode 100644 index 00000000000..7911a60df3f --- /dev/null +++ b/db/post_migrate/20231027083355_remove_projects_duplicated_indexes.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RemoveProjectsDuplicatedIndexes < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.6' + + INDEX_NAME = :index_on_projects_path + TABLE_NAME = :projects + + def up + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end + + def down + add_concurrent_index TABLE_NAME, :path, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20231030051840_add_not_null_to_packages_tags_project_id.rb b/db/post_migrate/20231030051840_add_not_null_to_packages_tags_project_id.rb new file mode 100644 index 00000000000..6541861cd45 --- /dev/null +++ b/db/post_migrate/20231030051840_add_not_null_to_packages_tags_project_id.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddNotNullToPackagesTagsProjectId < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + add_not_null_constraint :packages_tags, :project_id, validate: false + end + + def down + remove_not_null_constraint :packages_tags, :project_id + end +end diff --git a/db/post_migrate/20231030071209_queue_backfill_packages_tags_project_id.rb b/db/post_migrate/20231030071209_queue_backfill_packages_tags_project_id.rb new file mode 100644 index 00000000000..4984eb83263 --- /dev/null +++ b/db/post_migrate/20231030071209_queue_backfill_packages_tags_project_id.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class QueueBackfillPackagesTagsProjectId < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = "BackfillPackagesTagsProjectId" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1000 + SUB_BATCH_SIZE = 100 + + def up + queue_batched_background_migration( + MIGRATION, + :packages_tags, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231030071209', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :packages_tags, :id, []) + end +end diff --git a/db/post_migrate/20231030094755_add_index_to_catalog_resources_on_state.rb b/db/post_migrate/20231030094755_add_index_to_catalog_resources_on_state.rb new file mode 100644 index 00000000000..b7c6c8affdb --- /dev/null +++ b/db/post_migrate/20231030094755_add_index_to_catalog_resources_on_state.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToCatalogResourcesOnState < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + INDEX_NAME = 'index_catalog_resources_on_state' + + def up + add_concurrent_index :catalog_resources, :state, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :catalog_resources, INDEX_NAME + end +end diff --git a/db/post_migrate/20231030095419_remove_temp_index_to_packages_on_project_id_when_npm_and_not_pending_destruction.rb b/db/post_migrate/20231030095419_remove_temp_index_to_packages_on_project_id_when_npm_and_not_pending_destruction.rb new file mode 100644 index 00000000000..cd3fccf5f4d --- /dev/null +++ b/db/post_migrate/20231030095419_remove_temp_index_to_packages_on_project_id_when_npm_and_not_pending_destruction.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class RemoveTempIndexToPackagesOnProjectIdWhenNpmAndNotPendingDestruction < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.7' + + INDEX_NAME = 'tmp_idx_packages_on_project_id_when_npm_not_pending_destruction' + NPM_PACKAGE_TYPE = 2 + PENDING_DESTRUCTION_STATUS = 4 + + def up + remove_concurrent_index_by_name :packages_packages, INDEX_NAME + end + + def down + add_concurrent_index( + :packages_packages, + :project_id, + name: INDEX_NAME, + where: "package_type = #{NPM_PACKAGE_TYPE} AND status <> #{PENDING_DESTRUCTION_STATUS}" + ) + end +end diff --git a/db/post_migrate/20231030154117_insert_new_ultimate_trial_plan_into_plans.rb b/db/post_migrate/20231030154117_insert_new_ultimate_trial_plan_into_plans.rb new file mode 100644 index 00000000000..af589f6337a --- /dev/null +++ b/db/post_migrate/20231030154117_insert_new_ultimate_trial_plan_into_plans.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class InsertNewUltimateTrialPlanIntoPlans < Gitlab::Database::Migration[2.2] + milestone '16.6' + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + execute <<~SQL + INSERT INTO plans (name, title, created_at, updated_at) + VALUES ('ultimate_trial_paid_customer', 'Ultimate Trial for Paid Customer', current_timestamp, current_timestamp) + SQL + end + + def down + # NOTE: We have a uniqueness constraint for the 'name' column in 'plans' + execute <<~SQL + DELETE FROM plans + WHERE name = 'ultimate_trial_paid_customer' + SQL + end +end diff --git a/db/post_migrate/20231031134320_init_conversion_for_p_ci_builds_for_self_host.rb b/db/post_migrate/20231031134320_init_conversion_for_p_ci_builds_for_self_host.rb new file mode 100644 index 00000000000..d70ce00e9df --- /dev/null +++ b/db/post_migrate/20231031134320_init_conversion_for_p_ci_builds_for_self_host.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +class InitConversionForPCiBuildsForSelfHost < Gitlab::Database::Migration[2.2] + include ::Gitlab::Database::SchemaHelpers + + milestone '16.6' + disable_ddl_transaction! + + TABLE_NAME = :p_ci_builds + COLUMN_NAMES = %i[ + auto_canceled_by_id + commit_id + erased_by_id + project_id + runner_id + trigger_request_id + upstream_pipeline_id + user_id + ] + TRIGGER_NAME = :trigger_10ee1357e825 + + def up + return if should_skip? + + initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES) + end + + def down + return unless should_skip? + + revert_initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES) + end + + private + + def should_skip? + trigger_exists?(TABLE_NAME, TRIGGER_NAME) + end +end diff --git a/db/post_migrate/20231101130230_remove_in_product_marketing_emails_campaign_column.rb b/db/post_migrate/20231101130230_remove_in_product_marketing_emails_campaign_column.rb new file mode 100644 index 00000000000..8916a1e9729 --- /dev/null +++ b/db/post_migrate/20231101130230_remove_in_product_marketing_emails_campaign_column.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class RemoveInProductMarketingEmailsCampaignColumn < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.6' + + TARGET_TABLE = :in_product_marketing_emails + UNIQUE_INDEX_NAME = :index_in_product_marketing_emails_on_user_campaign + CONSTRAINT_NAME = :in_product_marketing_emails_track_and_series_or_campaign + TRACK_AND_SERIES_NOT_NULL_CONSTRAINT = 'track IS NOT NULL AND series IS NOT NULL AND campaign IS NULL' + CAMPAIGN_NOT_NULL_CONSTRAINT = 'track IS NULL AND series IS NULL AND campaign IS NOT NULL' + + def up + with_lock_retries do + remove_column :in_product_marketing_emails, :campaign, if_exists: true + end + end + + def down + with_lock_retries do + add_column :in_product_marketing_emails, :campaign, :text, if_not_exists: true + end + + add_text_limit :in_product_marketing_emails, :campaign, 255 + + add_concurrent_index TARGET_TABLE, [:user_id, :campaign], unique: true, name: UNIQUE_INDEX_NAME + add_check_constraint TARGET_TABLE, + "(#{TRACK_AND_SERIES_NOT_NULL_CONSTRAINT}) OR (#{CAMPAIGN_NOT_NULL_CONSTRAINT})", + CONSTRAINT_NAME + end +end diff --git a/db/post_migrate/20231102083539_backfill_p_ci_builds_pipeline_id.rb b/db/post_migrate/20231102083539_backfill_p_ci_builds_pipeline_id.rb new file mode 100644 index 00000000000..feada383fe4 --- /dev/null +++ b/db/post_migrate/20231102083539_backfill_p_ci_builds_pipeline_id.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class BackfillPCiBuildsPipelineId < Gitlab::Database::Migration[2.2] + restrict_gitlab_migration gitlab_schema: :gitlab_ci + milestone '16.6' + + TABLE_NAME = :ci_builds + COLUMN_NAMES = %i[ + auto_canceled_by_id + commit_id + erased_by_id + project_id + runner_id + trigger_request_id + upstream_pipeline_id + user_id + ] + SUB_BATCH_SIZE = 750 + BATCH_SIZE = 75_000 + PAUSE_MS = 0 + + def up + backfill_conversion_of_integer_to_bigint( + TABLE_NAME, COLUMN_NAMES, + sub_batch_size: SUB_BATCH_SIZE, + batch_size: BATCH_SIZE, + pause_ms: PAUSE_MS + ) + end + + def down + revert_backfill_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES) + end +end diff --git a/db/post_migrate/20231102142557_remove_zoekt_shard_null_constraint_from_indexed_namespaces.rb b/db/post_migrate/20231102142557_remove_zoekt_shard_null_constraint_from_indexed_namespaces.rb new file mode 100644 index 00000000000..08e76c749c7 --- /dev/null +++ b/db/post_migrate/20231102142557_remove_zoekt_shard_null_constraint_from_indexed_namespaces.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class RemoveZoektShardNullConstraintFromIndexedNamespaces < Gitlab::Database::Migration[2.2] + milestone '16.6' + disable_ddl_transaction! + + def up + change_column_null :zoekt_indexed_namespaces, :zoekt_shard_id, true + end + + def down + change_column_null :zoekt_indexed_namespaces, :zoekt_shard_id, false + end +end diff --git a/db/post_migrate/20231103132849_add_state_index_for_snippet_repository_storage_move.rb b/db/post_migrate/20231103132849_add_state_index_for_snippet_repository_storage_move.rb new file mode 100644 index 00000000000..3270a60acd8 --- /dev/null +++ b/db/post_migrate/20231103132849_add_state_index_for_snippet_repository_storage_move.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddStateIndexForSnippetRepositoryStorageMove < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.6' + + INDEX_NAME = 'index_snippet_repository_storage_moves_on_state' + + def up + # State 2 = scheduled and 3 = started + add_concurrent_index :snippet_repository_storage_moves, :state, where: 'state IN (2, 3)', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :snippet_repository_storage_moves, INDEX_NAME + end +end diff --git a/db/post_migrate/20231105165706_drop_repositories_columns_from_geo_node_status_table.rb b/db/post_migrate/20231105165706_drop_repositories_columns_from_geo_node_status_table.rb new file mode 100644 index 00000000000..69c9b54dc68 --- /dev/null +++ b/db/post_migrate/20231105165706_drop_repositories_columns_from_geo_node_status_table.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class DropRepositoriesColumnsFromGeoNodeStatusTable < Gitlab::Database::Migration[2.2] + enable_lock_retries! + milestone '16.6' + + def up + [ + :repositories_synced_count, + :repositories_failed_count, + :repositories_verified_count, + :repositories_verification_failed_count, + :repositories_checksummed_count, + :repositories_checksum_failed_count, + :repositories_checksum_mismatch_count, + :repositories_retrying_verification_count + ].each do |column_name| + remove_column :geo_node_statuses, column_name, if_exists: true + end + end + + def down + change_table(:geo_node_statuses) do |t| + t.integer :repositories_synced_count + t.integer :repositories_failed_count + t.integer :repositories_verified_count + t.integer :repositories_verification_failed_count + t.integer :repositories_checksummed_count + t.integer :repositories_checksum_failed_count + t.integer :repositories_checksum_mismatch_count + t.integer :repositories_retrying_verification_count + end + end +end diff --git a/db/post_migrate/20231109183438_drop_merge_request_assignees_on_merge_request_id_index.rb b/db/post_migrate/20231109183438_drop_merge_request_assignees_on_merge_request_id_index.rb new file mode 100644 index 00000000000..e1f96393031 --- /dev/null +++ b/db/post_migrate/20231109183438_drop_merge_request_assignees_on_merge_request_id_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class DropMergeRequestAssigneesOnMergeRequestIdIndex < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.6' + + INDEX_NAME = 'index_merge_request_assignees_on_merge_request_id' + TABLE_NAME = :merge_request_assignees + + def up + # Duplicated index. This index is covered by +index_merge_request_assignees_on_merge_request_id_and_user_id+ + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end + + def down + add_concurrent_index TABLE_NAME, :merge_request_id, name: INDEX_NAME + end +end diff --git a/db/schema_migrations/20230926092914 b/db/schema_migrations/20230926092914 new file mode 100644 index 00000000000..391ade3aab0 --- /dev/null +++ b/db/schema_migrations/20230926092914 @@ -0,0 +1 @@ +0018bc2180eeb632d75132b6d82e959e772ff1e7d8966310858e304d07d4ec34
\ No newline at end of file diff --git a/db/schema_migrations/20230926092944 b/db/schema_migrations/20230926092944 new file mode 100644 index 00000000000..1fe6c64634a --- /dev/null +++ b/db/schema_migrations/20230926092944 @@ -0,0 +1 @@ +e2b4cdafd6147740ad43c286d90f7feec9f70d66a510d58a3cc3c33b0d703b49
\ No newline at end of file diff --git a/db/schema_migrations/20230926093004 b/db/schema_migrations/20230926093004 new file mode 100644 index 00000000000..30407142a30 --- /dev/null +++ b/db/schema_migrations/20230926093004 @@ -0,0 +1 @@ +d3d90178100e92cffe263715cdfc3c9ddcb47ce804f3ffd92d5bc4326de0244c
\ No newline at end of file diff --git a/db/schema_migrations/20230926093025 b/db/schema_migrations/20230926093025 new file mode 100644 index 00000000000..6a5ef092c69 --- /dev/null +++ b/db/schema_migrations/20230926093025 @@ -0,0 +1 @@ +840bc159c277271b66f4348c31d912485c04b8ee1b15227c96dcc690f6b93311
\ No newline at end of file diff --git a/db/schema_migrations/20230926093101 b/db/schema_migrations/20230926093101 new file mode 100644 index 00000000000..2ce67dab37f --- /dev/null +++ b/db/schema_migrations/20230926093101 @@ -0,0 +1 @@ +9a560649866367e556cf841e20f981b6c09fe03d1054f0db37cb510fbfbaef13
\ No newline at end of file diff --git a/db/schema_migrations/20230926093144 b/db/schema_migrations/20230926093144 new file mode 100644 index 00000000000..b383692607f --- /dev/null +++ b/db/schema_migrations/20230926093144 @@ -0,0 +1 @@ +eba011de5a174a93e5159c765c093d3a6519111769a1ac09b2f996322cf3973e
\ No newline at end of file diff --git a/db/schema_migrations/20230926093211 b/db/schema_migrations/20230926093211 new file mode 100644 index 00000000000..9befd202129 --- /dev/null +++ b/db/schema_migrations/20230926093211 @@ -0,0 +1 @@ +f9659a07b4c7b2d4508f1de231e759cf4e15e684ecaa4231ff6069b4ba203e20
\ No newline at end of file diff --git a/db/schema_migrations/20230926093251 b/db/schema_migrations/20230926093251 new file mode 100644 index 00000000000..63bb045e437 --- /dev/null +++ b/db/schema_migrations/20230926093251 @@ -0,0 +1 @@ +9df85930f78c6fa9e02252877d136aab3167a8ac1134cbd321c26f5958899f06
\ No newline at end of file diff --git a/db/schema_migrations/20230926105440 b/db/schema_migrations/20230926105440 new file mode 100644 index 00000000000..957b7cbbbac --- /dev/null +++ b/db/schema_migrations/20230926105440 @@ -0,0 +1 @@ +0be5d3565d71dc9656fd90dbd404ea0314ff29f6da9ca9ef2d100bcc9515308b
\ No newline at end of file diff --git a/db/schema_migrations/20230926105931 b/db/schema_migrations/20230926105931 new file mode 100644 index 00000000000..f158665e529 --- /dev/null +++ b/db/schema_migrations/20230926105931 @@ -0,0 +1 @@ +021dbeb0a8c5ebecfa647344b1e99dd1698ae3fb72a8857409551070b23f9f49
\ No newline at end of file diff --git a/db/schema_migrations/20230927124202 b/db/schema_migrations/20230927124202 new file mode 100644 index 00000000000..a4089994e97 --- /dev/null +++ b/db/schema_migrations/20230927124202 @@ -0,0 +1 @@ +652375e6b7318fe85b4b23eac3cce88618136341cee7721522adacbe52a52c66
\ No newline at end of file diff --git a/db/schema_migrations/20230928145555 b/db/schema_migrations/20230928145555 new file mode 100644 index 00000000000..860364e57cc --- /dev/null +++ b/db/schema_migrations/20230928145555 @@ -0,0 +1 @@ +71e2f63bf9a327f62d21c2407b9ccebe779e0fd881266467f180cf285edc326f
\ No newline at end of file diff --git a/db/schema_migrations/20230928145637 b/db/schema_migrations/20230928145637 new file mode 100644 index 00000000000..47d4c9b0593 --- /dev/null +++ b/db/schema_migrations/20230928145637 @@ -0,0 +1 @@ +1e9bf34cc708dd8637e4e636894fb9b7894c6d54832b3b42c88af17c4ed87532
\ No newline at end of file diff --git a/db/schema_migrations/20230929155123 b/db/schema_migrations/20230929155123 new file mode 100644 index 00000000000..e2332c208aa --- /dev/null +++ b/db/schema_migrations/20230929155123 @@ -0,0 +1 @@ +91650c6c2dd7066036be3b276331361e7e514ec65a048aebabd43110e860e8ff
\ No newline at end of file diff --git a/db/schema_migrations/20231002162941 b/db/schema_migrations/20231002162941 new file mode 100644 index 00000000000..a6842b3f677 --- /dev/null +++ b/db/schema_migrations/20231002162941 @@ -0,0 +1 @@ +ddf75326b9bb04275bf48e9a2eb6c15af7a9ca6c00864a636d5e179c5881b20b
\ No newline at end of file diff --git a/db/schema_migrations/20231003045342 b/db/schema_migrations/20231003045342 new file mode 100644 index 00000000000..cf16a592ca6 --- /dev/null +++ b/db/schema_migrations/20231003045342 @@ -0,0 +1 @@ +a3a577992319a628fb7b1e8c492b1cb3ef1994d3e91e2af351c7b75a3900144d
\ No newline at end of file diff --git a/db/schema_migrations/20231005151816 b/db/schema_migrations/20231005151816 new file mode 100644 index 00000000000..93bf7686fab --- /dev/null +++ b/db/schema_migrations/20231005151816 @@ -0,0 +1 @@ +cc9ddab54a3e120e53e214c2d5cb689fda02810031c30da26d0fdc09921c1082
\ No newline at end of file diff --git a/db/schema_migrations/20231009115713 b/db/schema_migrations/20231009115713 new file mode 100644 index 00000000000..fc5cf7122d1 --- /dev/null +++ b/db/schema_migrations/20231009115713 @@ -0,0 +1 @@ +4c3129e96dd84ae715999edc7f53e3a001ebbfda28c79ef7108b74ad89d8afd4
\ No newline at end of file diff --git a/db/schema_migrations/20231013204933 b/db/schema_migrations/20231013204933 new file mode 100644 index 00000000000..d0e92a8935d --- /dev/null +++ b/db/schema_migrations/20231013204933 @@ -0,0 +1 @@ +1358c375db88b2d318448cc748eb233b63781fbcdfdbe18c23275b69a7cd794b
\ No newline at end of file diff --git a/db/schema_migrations/20231016001000 b/db/schema_migrations/20231016001000 new file mode 100644 index 00000000000..54c77e2a080 --- /dev/null +++ b/db/schema_migrations/20231016001000 @@ -0,0 +1 @@ +4b40cab24870578ece8648bb0c1e7e2ba4b118cf104ddb76eb0dd7599e51b320
\ No newline at end of file diff --git a/db/schema_migrations/20231016173128 b/db/schema_migrations/20231016173128 new file mode 100644 index 00000000000..6aa7c3f955e --- /dev/null +++ b/db/schema_migrations/20231016173128 @@ -0,0 +1 @@ +b720259efa4eb9fe75a3352a64b9e14ae7b048240daf34c40a66cc5ef409dcc0
\ No newline at end of file diff --git a/db/schema_migrations/20231016173129 b/db/schema_migrations/20231016173129 new file mode 100644 index 00000000000..acbf77968e9 --- /dev/null +++ b/db/schema_migrations/20231016173129 @@ -0,0 +1 @@ +f886678df9907d2bf60f98c0184c91604069cd613b541a0476e30789f327df15
\ No newline at end of file diff --git a/db/schema_migrations/20231016194926 b/db/schema_migrations/20231016194926 new file mode 100644 index 00000000000..4aa858f00f0 --- /dev/null +++ b/db/schema_migrations/20231016194926 @@ -0,0 +1 @@ +0f2e4b7fc2658b5063dbe8dea6c881fb59a9d99ed53332ae1bdb5578343c3e89
\ No newline at end of file diff --git a/db/schema_migrations/20231016194927 b/db/schema_migrations/20231016194927 new file mode 100644 index 00000000000..6d8d7d11191 --- /dev/null +++ b/db/schema_migrations/20231016194927 @@ -0,0 +1 @@ +44474805c7858d07d093650e43f3313746976e4c523b408d029e32829a5b7301
\ No newline at end of file diff --git a/db/schema_migrations/20231016194942 b/db/schema_migrations/20231016194942 new file mode 100644 index 00000000000..05862999a37 --- /dev/null +++ b/db/schema_migrations/20231016194942 @@ -0,0 +1 @@ +43de9dd5e63a80c51aa21e42b7f41d03b6d36143afa45cf45ead6ee0cc8152cc
\ No newline at end of file diff --git a/db/schema_migrations/20231016194943 b/db/schema_migrations/20231016194943 new file mode 100644 index 00000000000..df18251008c --- /dev/null +++ b/db/schema_migrations/20231016194943 @@ -0,0 +1 @@ +b17f7eaff454fab3e46e438d81fdebab14776322af261e0f2a12ceb69a5623a8
\ No newline at end of file diff --git a/db/schema_migrations/20231017095738 b/db/schema_migrations/20231017095738 new file mode 100644 index 00000000000..20feb63b199 --- /dev/null +++ b/db/schema_migrations/20231017095738 @@ -0,0 +1 @@ +730b861c660b96556969054402a7776f622d42ed98055b0f7099c940ecf03c32
\ No newline at end of file diff --git a/db/schema_migrations/20231017134349 b/db/schema_migrations/20231017134349 new file mode 100644 index 00000000000..ef53b4c0df9 --- /dev/null +++ b/db/schema_migrations/20231017134349 @@ -0,0 +1 @@ +9bec84c51111ba6d9fb685d043bdc002eed3d5089242b6f1ae6bb360b0b832ee
\ No newline at end of file diff --git a/db/schema_migrations/20231017135207 b/db/schema_migrations/20231017135207 new file mode 100644 index 00000000000..f27b16c2caa --- /dev/null +++ b/db/schema_migrations/20231017135207 @@ -0,0 +1 @@ +e32402af4e39d6e09e274c3b0bb4588f6c2f1a7bb3dce29b5ce82beda909e86b
\ No newline at end of file diff --git a/db/schema_migrations/20231017154804 b/db/schema_migrations/20231017154804 new file mode 100644 index 00000000000..61386d6ebf9 --- /dev/null +++ b/db/schema_migrations/20231017154804 @@ -0,0 +1 @@ +999c4fefec34812883cb458fe70b89247e3808e53441739ccfec5862b687977a
\ No newline at end of file diff --git a/db/schema_migrations/20231017181403 b/db/schema_migrations/20231017181403 new file mode 100644 index 00000000000..e8e1d282897 --- /dev/null +++ b/db/schema_migrations/20231017181403 @@ -0,0 +1 @@ +6d34316fdbe5a2c7e825e7abd9a817313c36ff7d6ef29f1bbee40f805e279ee3
\ No newline at end of file diff --git a/db/schema_migrations/20231018083247 b/db/schema_migrations/20231018083247 new file mode 100644 index 00000000000..1807921c388 --- /dev/null +++ b/db/schema_migrations/20231018083247 @@ -0,0 +1 @@ +ccf25454919c35e8275f48aca973fdd263e57d643640878aa776a7760b38e851
\ No newline at end of file diff --git a/db/schema_migrations/20231018093625 b/db/schema_migrations/20231018093625 new file mode 100644 index 00000000000..3d571c1667d --- /dev/null +++ b/db/schema_migrations/20231018093625 @@ -0,0 +1 @@ +655ef95f055a139776f0d1873415bff48d39cee243ffb467200b3b3938b3968a
\ No newline at end of file diff --git a/db/schema_migrations/20231018105749 b/db/schema_migrations/20231018105749 new file mode 100644 index 00000000000..fb443c9eb63 --- /dev/null +++ b/db/schema_migrations/20231018105749 @@ -0,0 +1 @@ +4289e51e278d842ec0a7344256ed5c3de2b0a3355de6437b079b75e3a607b7a8
\ No newline at end of file diff --git a/db/schema_migrations/20231018140154 b/db/schema_migrations/20231018140154 new file mode 100644 index 00000000000..7c9cb7eb276 --- /dev/null +++ b/db/schema_migrations/20231018140154 @@ -0,0 +1 @@ +7a80a42db1c6d44a034ea7f2cb27f919c099df2ca3e30e59d2b5b7cee3ebc610
\ No newline at end of file diff --git a/db/schema_migrations/20231018152419 b/db/schema_migrations/20231018152419 new file mode 100644 index 00000000000..db144b1f48e --- /dev/null +++ b/db/schema_migrations/20231018152419 @@ -0,0 +1 @@ +1342acaf87fdcd643d7be37ade7a789d8fd57026fab07cc7b48bb5c47b4a8d00
\ No newline at end of file diff --git a/db/schema_migrations/20231019003052 b/db/schema_migrations/20231019003052 new file mode 100644 index 00000000000..c12f6d1a9a5 --- /dev/null +++ b/db/schema_migrations/20231019003052 @@ -0,0 +1 @@ +baa0d627f26ff5d2cb773f724bc08eca03b80f59553f6706388429194844b5dc
\ No newline at end of file diff --git a/db/schema_migrations/20231019084731 b/db/schema_migrations/20231019084731 new file mode 100644 index 00000000000..5c7275172d6 --- /dev/null +++ b/db/schema_migrations/20231019084731 @@ -0,0 +1 @@ +dd4575590153280219bff3b7f37047c67c1a16219c2b6ba18322cb7e295665f7
\ No newline at end of file diff --git a/db/schema_migrations/20231019104211 b/db/schema_migrations/20231019104211 new file mode 100644 index 00000000000..cce6cc892da --- /dev/null +++ b/db/schema_migrations/20231019104211 @@ -0,0 +1 @@ +e2ee8bcb49b470bbea1874f6a63c9b7a2fd67ef4223cf5d358de1fca4e3f36be
\ No newline at end of file diff --git a/db/schema_migrations/20231019122855 b/db/schema_migrations/20231019122855 new file mode 100644 index 00000000000..30a6774ec1b --- /dev/null +++ b/db/schema_migrations/20231019122855 @@ -0,0 +1 @@ +17039c530b6f85b46b014aa0c0f3d0e9340419a89b78581ca9ad4865d567929d
\ No newline at end of file diff --git a/db/schema_migrations/20231019145202 b/db/schema_migrations/20231019145202 new file mode 100644 index 00000000000..726093ee4dc --- /dev/null +++ b/db/schema_migrations/20231019145202 @@ -0,0 +1 @@ +c6a94dda004fccc8b3c8b5f59c7730a9243fe5d33a287997dae98748f3ad3bb4
\ No newline at end of file diff --git a/db/schema_migrations/20231019180421 b/db/schema_migrations/20231019180421 new file mode 100644 index 00000000000..f7cd8f99b10 --- /dev/null +++ b/db/schema_migrations/20231019180421 @@ -0,0 +1 @@ +9098a39552648a1a2b6439bc26b3e987fc604c0b3bd149d08049b376a09f5ebb
\ No newline at end of file diff --git a/db/schema_migrations/20231019223224 b/db/schema_migrations/20231019223224 new file mode 100644 index 00000000000..0a35a48222b --- /dev/null +++ b/db/schema_migrations/20231019223224 @@ -0,0 +1 @@ +d2bd2f99340f7653cec908c4c41c0326d7bf4765fd4e4287ae914ed3025cd690
\ No newline at end of file diff --git a/db/schema_migrations/20231020020732 b/db/schema_migrations/20231020020732 new file mode 100644 index 00000000000..d53dd4c91c7 --- /dev/null +++ b/db/schema_migrations/20231020020732 @@ -0,0 +1 @@ +6f28ddf4aa999419cd6a1cf05027161f002ffc28a299ea6f7281b6a7672ee180
\ No newline at end of file diff --git a/db/schema_migrations/20231020074227 b/db/schema_migrations/20231020074227 new file mode 100644 index 00000000000..48185f79937 --- /dev/null +++ b/db/schema_migrations/20231020074227 @@ -0,0 +1 @@ +0dcf5a04af59563c58a658cb3c99619d2b671f3e78960859f3ed6053a9e96994
\ No newline at end of file diff --git a/db/schema_migrations/20231020082425 b/db/schema_migrations/20231020082425 new file mode 100644 index 00000000000..7e72d043d05 --- /dev/null +++ b/db/schema_migrations/20231020082425 @@ -0,0 +1 @@ +9d808ab1739e61d1c80f8b0563191ce31e7766fdb24c993791be4850f7164041
\ No newline at end of file diff --git a/db/schema_migrations/20231020095624 b/db/schema_migrations/20231020095624 new file mode 100644 index 00000000000..b5c91fb6f9b --- /dev/null +++ b/db/schema_migrations/20231020095624 @@ -0,0 +1 @@ +8a69cad1fba51cbec7e296d985dbecae214fcc98edb32c9d3da78070fbf7b47d
\ No newline at end of file diff --git a/db/schema_migrations/20231020112541 b/db/schema_migrations/20231020112541 new file mode 100644 index 00000000000..f385bb06bd6 --- /dev/null +++ b/db/schema_migrations/20231020112541 @@ -0,0 +1 @@ +16a0b32619e6b28c49fc2e9e609970ac61582c295c2ed281c531e407de2af216
\ No newline at end of file diff --git a/db/schema_migrations/20231020150211 b/db/schema_migrations/20231020150211 new file mode 100644 index 00000000000..47a22d6c9f9 --- /dev/null +++ b/db/schema_migrations/20231020150211 @@ -0,0 +1 @@ +0ef5c4756854bead328fe61e51a78a86076870844edb7a8dba0941788736a12f
\ No newline at end of file diff --git a/db/schema_migrations/20231020181652 b/db/schema_migrations/20231020181652 new file mode 100644 index 00000000000..3b0faf6040f --- /dev/null +++ b/db/schema_migrations/20231020181652 @@ -0,0 +1 @@ +ec632fbf61f89a45cb4f011117af10c26d847f822c2edcce637cbf18cb6a2b67
\ No newline at end of file diff --git a/db/schema_migrations/20231023073841 b/db/schema_migrations/20231023073841 new file mode 100644 index 00000000000..64b0c1cf4d0 --- /dev/null +++ b/db/schema_migrations/20231023073841 @@ -0,0 +1 @@ +007e2a09c9d8519ea7bb4868ce20b1a57b14a7f694bd477796584fcafc7f3c58
\ No newline at end of file diff --git a/db/schema_migrations/20231023083349 b/db/schema_migrations/20231023083349 new file mode 100644 index 00000000000..d3d7e4e45fc --- /dev/null +++ b/db/schema_migrations/20231023083349 @@ -0,0 +1 @@ +1b0cd52ccf99a477f39168cdb6b719d5b64f6110a7fd9df0a6f200c6ff9c0237
\ No newline at end of file diff --git a/db/schema_migrations/20231023113908 b/db/schema_migrations/20231023113908 new file mode 100644 index 00000000000..bf05644a5ab --- /dev/null +++ b/db/schema_migrations/20231023113908 @@ -0,0 +1 @@ +63d7eb49469273cef193dd7c80f1bac042893f5da544f5066d00175f9e026d48
\ No newline at end of file diff --git a/db/schema_migrations/20231023114006 b/db/schema_migrations/20231023114006 new file mode 100644 index 00000000000..bc17ae9b852 --- /dev/null +++ b/db/schema_migrations/20231023114006 @@ -0,0 +1 @@ +030809f5519906dbdcdf3b8fd35a7181ca2c9ec1bdca745997aa14f24ee6ac6d
\ No newline at end of file diff --git a/db/schema_migrations/20231023114551 b/db/schema_migrations/20231023114551 new file mode 100644 index 00000000000..a53b51b53bd --- /dev/null +++ b/db/schema_migrations/20231023114551 @@ -0,0 +1 @@ +df2937c8e70fde85677ef150ed6c2445d06b8a2f7113f58a8908a81ece449d75
\ No newline at end of file diff --git a/db/schema_migrations/20231023121955 b/db/schema_migrations/20231023121955 new file mode 100644 index 00000000000..3c559afe5ea --- /dev/null +++ b/db/schema_migrations/20231023121955 @@ -0,0 +1 @@ +912289edbed417e2e552e8d0c6d44d37b1066531d3dd28a6960fce47a8fcbe52
\ No newline at end of file diff --git a/db/schema_migrations/20231023122508 b/db/schema_migrations/20231023122508 new file mode 100644 index 00000000000..2ef64fd5b26 --- /dev/null +++ b/db/schema_migrations/20231023122508 @@ -0,0 +1 @@ +b4850d28d0000d9dd7f81df26a5b9f4b5a38c2f0d33a48037ab5c097789345d8
\ No newline at end of file diff --git a/db/schema_migrations/20231023164908 b/db/schema_migrations/20231023164908 new file mode 100644 index 00000000000..f94a5e457bf --- /dev/null +++ b/db/schema_migrations/20231023164908 @@ -0,0 +1 @@ +4d742e6f54307710370453fdd72313c0a0f6928bdf2e4812bc5c16ec1043dd3f
\ No newline at end of file diff --git a/db/schema_migrations/20231024015915 b/db/schema_migrations/20231024015915 new file mode 100644 index 00000000000..7f6eac81c71 --- /dev/null +++ b/db/schema_migrations/20231024015915 @@ -0,0 +1 @@ +8ad5065584f72084ee929e479725593330d0d13542dc4939476d62f831c6f2e8
\ No newline at end of file diff --git a/db/schema_migrations/20231024025457 b/db/schema_migrations/20231024025457 new file mode 100644 index 00000000000..81dc3359183 --- /dev/null +++ b/db/schema_migrations/20231024025457 @@ -0,0 +1 @@ +1bd136e7d4fb7c34030cea6c915a2eeae619ea5ae1a701cb4d5d4bb069df7113
\ No newline at end of file diff --git a/db/schema_migrations/20231024025533 b/db/schema_migrations/20231024025533 new file mode 100644 index 00000000000..3adea905aa3 --- /dev/null +++ b/db/schema_migrations/20231024025533 @@ -0,0 +1 @@ +bf03b09c6247d2f5c3543f4046b48763dfc7e6fb2cdaedc52d8cfc8777f70e71
\ No newline at end of file diff --git a/db/schema_migrations/20231024025629 b/db/schema_migrations/20231024025629 new file mode 100644 index 00000000000..30d63a84636 --- /dev/null +++ b/db/schema_migrations/20231024025629 @@ -0,0 +1 @@ +4c90d6df75ddb93f8fd8fb89131256fc97bac990f024576fa57a3a8c6b60fee9
\ No newline at end of file diff --git a/db/schema_migrations/20231024080150 b/db/schema_migrations/20231024080150 new file mode 100644 index 00000000000..582b17c4325 --- /dev/null +++ b/db/schema_migrations/20231024080150 @@ -0,0 +1 @@ +13b70e77df1309a1b0d93239b6deff9d34fd5e67650baa0b7495528c6521283d
\ No newline at end of file diff --git a/db/schema_migrations/20231024123444 b/db/schema_migrations/20231024123444 new file mode 100644 index 00000000000..578f1cef1bd --- /dev/null +++ b/db/schema_migrations/20231024123444 @@ -0,0 +1 @@ +db84d40c9afd9121aa24617167fa82b86cabc98bf274e61057eef02e1fafd7c3
\ No newline at end of file diff --git a/db/schema_migrations/20231024124856 b/db/schema_migrations/20231024124856 new file mode 100644 index 00000000000..5305af27bb1 --- /dev/null +++ b/db/schema_migrations/20231024124856 @@ -0,0 +1 @@ +add7ce4f9fb56221512227d5aa3697245d537cd5c975978b7dc6dab992890e4e
\ No newline at end of file diff --git a/db/schema_migrations/20231024125551 b/db/schema_migrations/20231024125551 new file mode 100644 index 00000000000..05c647f3abd --- /dev/null +++ b/db/schema_migrations/20231024125551 @@ -0,0 +1 @@ +08275dacbe6b1bd44cc67834fc77d6615e43ebd1b9a85edc9e7237cbecc57315
\ No newline at end of file diff --git a/db/schema_migrations/20231024133234 b/db/schema_migrations/20231024133234 new file mode 100644 index 00000000000..fb536f574d3 --- /dev/null +++ b/db/schema_migrations/20231024133234 @@ -0,0 +1 @@ +0a92e23317e4fc12b9de9d15c0d3895afe211b543a0449834b9459616152680a
\ No newline at end of file diff --git a/db/schema_migrations/20231024142236 b/db/schema_migrations/20231024142236 new file mode 100644 index 00000000000..283bed9db8d --- /dev/null +++ b/db/schema_migrations/20231024142236 @@ -0,0 +1 @@ +6103bd075183ce4196dee2b140cb960f075cc7d3f4fc4f370bb6217c3ff1e758
\ No newline at end of file diff --git a/db/schema_migrations/20231024143457 b/db/schema_migrations/20231024143457 new file mode 100644 index 00000000000..a3033f54954 --- /dev/null +++ b/db/schema_migrations/20231024143457 @@ -0,0 +1 @@ +9627d5af229e51bee8a5a8c47beedf5bd0b3b2ce89f4cc209fe96089e662c749
\ No newline at end of file diff --git a/db/schema_migrations/20231024151916 b/db/schema_migrations/20231024151916 new file mode 100644 index 00000000000..1333c1f3b82 --- /dev/null +++ b/db/schema_migrations/20231024151916 @@ -0,0 +1 @@ +b316a07e7f307aea53dd9cac257c75ac58ff2b4deeace4e454ec933bd4039761
\ No newline at end of file diff --git a/db/schema_migrations/20231024173744 b/db/schema_migrations/20231024173744 new file mode 100644 index 00000000000..b262f2a2ebb --- /dev/null +++ b/db/schema_migrations/20231024173744 @@ -0,0 +1 @@ +fd51e236973eaf1d4a2719eaa34dbd7955c2d73e37adf244472c8c69fc486fdf
\ No newline at end of file diff --git a/db/schema_migrations/20231024212214 b/db/schema_migrations/20231024212214 new file mode 100644 index 00000000000..d3ad27bd4dd --- /dev/null +++ b/db/schema_migrations/20231024212214 @@ -0,0 +1 @@ +c5884c327b3be31122ca36302f8fbd36666ddee07229480884c8c64af825c03f
\ No newline at end of file diff --git a/db/schema_migrations/20231025025733 b/db/schema_migrations/20231025025733 new file mode 100644 index 00000000000..a488c5206e1 --- /dev/null +++ b/db/schema_migrations/20231025025733 @@ -0,0 +1 @@ +c0129899dcea5f304661b49665a371de86dbff9df88afbb3fdbb348a411c1dd8
\ No newline at end of file diff --git a/db/schema_migrations/20231025031337 b/db/schema_migrations/20231025031337 new file mode 100644 index 00000000000..8d28d710397 --- /dev/null +++ b/db/schema_migrations/20231025031337 @@ -0,0 +1 @@ +7dc72ca807126bb992c22879a6d989f282e442ff2c6e15b046e6f3d0f464237f
\ No newline at end of file diff --git a/db/schema_migrations/20231025031539 b/db/schema_migrations/20231025031539 new file mode 100644 index 00000000000..4332cd2b867 --- /dev/null +++ b/db/schema_migrations/20231025031539 @@ -0,0 +1 @@ +4de438a35ae2cbeee4cec03961cf7b5dddfcce2454a1e3ce08985e28b7065a0d
\ No newline at end of file diff --git a/db/schema_migrations/20231025123238 b/db/schema_migrations/20231025123238 new file mode 100644 index 00000000000..e93a7a4d3fb --- /dev/null +++ b/db/schema_migrations/20231025123238 @@ -0,0 +1 @@ +8a34911b504b3752071aa2f6f1eb8dbc6b91540cceb69881c12c89adb48dcc78
\ No newline at end of file diff --git a/db/schema_migrations/20231026050554 b/db/schema_migrations/20231026050554 new file mode 100644 index 00000000000..d99dc675ab6 --- /dev/null +++ b/db/schema_migrations/20231026050554 @@ -0,0 +1 @@ +e71f80b77121722c75125e59ec2e9c3df323b34a107304447948bed05804224c
\ No newline at end of file diff --git a/db/schema_migrations/20231026103346 b/db/schema_migrations/20231026103346 new file mode 100644 index 00000000000..53f5520bcc4 --- /dev/null +++ b/db/schema_migrations/20231026103346 @@ -0,0 +1 @@ +dc0065c2caffdf5bbf79c1e94f8bdb6d415a836cc575109d25df8217423be0e1
\ No newline at end of file diff --git a/db/schema_migrations/20231027013210 b/db/schema_migrations/20231027013210 new file mode 100644 index 00000000000..fdf26416bdc --- /dev/null +++ b/db/schema_migrations/20231027013210 @@ -0,0 +1 @@ +3ee898fd7593c7a300bdfc0dc6f041e2fb65f3600b85788521175449d250590f
\ No newline at end of file diff --git a/db/schema_migrations/20231027052949 b/db/schema_migrations/20231027052949 new file mode 100644 index 00000000000..dff1dd0f197 --- /dev/null +++ b/db/schema_migrations/20231027052949 @@ -0,0 +1 @@ +399e9a19e9436dc077e9b107daf3397a6be2efe574981265758c082deb2c19ce
\ No newline at end of file diff --git a/db/schema_migrations/20231027060443 b/db/schema_migrations/20231027060443 new file mode 100644 index 00000000000..b00276b1849 --- /dev/null +++ b/db/schema_migrations/20231027060443 @@ -0,0 +1 @@ +f3ce119c5ded9fae2f94168455379eb3a8d7d7bc1eff3e555a2a77011a6309fb
\ No newline at end of file diff --git a/db/schema_migrations/20231027064352 b/db/schema_migrations/20231027064352 new file mode 100644 index 00000000000..2a770ac96db --- /dev/null +++ b/db/schema_migrations/20231027064352 @@ -0,0 +1 @@ +2418c94e1e40f2765252f5c69dae7def898ed3c329fa5fc05d3b51ed812bb7c7
\ No newline at end of file diff --git a/db/schema_migrations/20231027065205 b/db/schema_migrations/20231027065205 new file mode 100644 index 00000000000..9c013a95bba --- /dev/null +++ b/db/schema_migrations/20231027065205 @@ -0,0 +1 @@ +b8ecc7e8ead4cddc7dad712c46fdff0d559da1697bd5d16c1130f2c71272b890
\ No newline at end of file diff --git a/db/schema_migrations/20231027083355 b/db/schema_migrations/20231027083355 new file mode 100644 index 00000000000..2ceb5337067 --- /dev/null +++ b/db/schema_migrations/20231027083355 @@ -0,0 +1 @@ +ce4863f02f807498da9c3cf7b49d85a2e5a296903fe0673bfa6f40d50c8a51b5
\ No newline at end of file diff --git a/db/schema_migrations/20231027084327 b/db/schema_migrations/20231027084327 new file mode 100644 index 00000000000..9b4a0baee6e --- /dev/null +++ b/db/schema_migrations/20231027084327 @@ -0,0 +1 @@ +38dcfa54fa7da63c1fbceb842e277b27bd90b1b0ef31fc82db8f80e6ba286047
\ No newline at end of file diff --git a/db/schema_migrations/20231030051837 b/db/schema_migrations/20231030051837 new file mode 100644 index 00000000000..9c9bb912eba --- /dev/null +++ b/db/schema_migrations/20231030051837 @@ -0,0 +1 @@ +ebd61f5c5f74ce00b86aacc996e46c2971deac18d2a6e31bf531576fe3af090f
\ No newline at end of file diff --git a/db/schema_migrations/20231030051838 b/db/schema_migrations/20231030051838 new file mode 100644 index 00000000000..3c15f764cce --- /dev/null +++ b/db/schema_migrations/20231030051838 @@ -0,0 +1 @@ +09129fdab92e39c57f0db400b179eecc1b498249db7b928014eabdcb9af30052
\ No newline at end of file diff --git a/db/schema_migrations/20231030051839 b/db/schema_migrations/20231030051839 new file mode 100644 index 00000000000..144c443f5cc --- /dev/null +++ b/db/schema_migrations/20231030051839 @@ -0,0 +1 @@ +90e0409db7a30b4b531cb0dbbccff7d06c2196e6afdacb88fc5d1ecdc00fcc2f
\ No newline at end of file diff --git a/db/schema_migrations/20231030051840 b/db/schema_migrations/20231030051840 new file mode 100644 index 00000000000..4926ff15f09 --- /dev/null +++ b/db/schema_migrations/20231030051840 @@ -0,0 +1 @@ +6fc7bb7b27a5885890dac96738190bc4157cd8c3b5afd9b47809e0487a8a7b4b
\ No newline at end of file diff --git a/db/schema_migrations/20231030071209 b/db/schema_migrations/20231030071209 new file mode 100644 index 00000000000..5f7b172c22c --- /dev/null +++ b/db/schema_migrations/20231030071209 @@ -0,0 +1 @@ +c3614cda6677dc3afdbb69a95111f39bd4719e1fef683358855a6ff04bebfdac
\ No newline at end of file diff --git a/db/schema_migrations/20231030094755 b/db/schema_migrations/20231030094755 new file mode 100644 index 00000000000..5a18105655b --- /dev/null +++ b/db/schema_migrations/20231030094755 @@ -0,0 +1 @@ +981110baa181be00e7195b9f6e9773d14683b00a0de851b23b261561e7aaae27
\ No newline at end of file diff --git a/db/schema_migrations/20231030095419 b/db/schema_migrations/20231030095419 new file mode 100644 index 00000000000..039ad039283 --- /dev/null +++ b/db/schema_migrations/20231030095419 @@ -0,0 +1 @@ +99b845e37c091107a0540a182e4376bb0c0b0b2c46def577a96cbcf1971a8cd4
\ No newline at end of file diff --git a/db/schema_migrations/20231030154117 b/db/schema_migrations/20231030154117 new file mode 100644 index 00000000000..5380cfa5252 --- /dev/null +++ b/db/schema_migrations/20231030154117 @@ -0,0 +1 @@ +07c4a447b3888046333b0b8fa237411783fc031ea9943520f716ea0c00ed964f
\ No newline at end of file diff --git a/db/schema_migrations/20231030205639 b/db/schema_migrations/20231030205639 new file mode 100644 index 00000000000..4abedebbd44 --- /dev/null +++ b/db/schema_migrations/20231030205639 @@ -0,0 +1 @@ +873fab24af680c9e33bedfe574f20a5a2242732b922bb4bd2f01d13180601de3
\ No newline at end of file diff --git a/db/schema_migrations/20231030205756 b/db/schema_migrations/20231030205756 new file mode 100644 index 00000000000..3923ee6dbd0 --- /dev/null +++ b/db/schema_migrations/20231030205756 @@ -0,0 +1 @@ +fd45299e8376db582461fa4b714b3718c4f589bc087d73465ac51d04437e07c3
\ No newline at end of file diff --git a/db/schema_migrations/20231031134320 b/db/schema_migrations/20231031134320 new file mode 100644 index 00000000000..2c27b20bbc6 --- /dev/null +++ b/db/schema_migrations/20231031134320 @@ -0,0 +1 @@ +235c903dcd43c1bf6a3e11154ff0bde3f1a7a3fc5d9129dce8bfb770fd36b75b
\ No newline at end of file diff --git a/db/schema_migrations/20231031141439 b/db/schema_migrations/20231031141439 new file mode 100644 index 00000000000..bbdae989385 --- /dev/null +++ b/db/schema_migrations/20231031141439 @@ -0,0 +1 @@ +568e7a227911f23e4285e1bbcc9dd516ecbd2013501a2add13e99e98880effc8
\ No newline at end of file diff --git a/db/schema_migrations/20231031200433 b/db/schema_migrations/20231031200433 new file mode 100644 index 00000000000..1093e9edabb --- /dev/null +++ b/db/schema_migrations/20231031200433 @@ -0,0 +1 @@ +409134f3d8980c647bd9ecd73f6f56729c7cf6f83059b3fd32d5665c36ab1a92
\ No newline at end of file diff --git a/db/schema_migrations/20231031200645 b/db/schema_migrations/20231031200645 new file mode 100644 index 00000000000..4d29fbfd996 --- /dev/null +++ b/db/schema_migrations/20231031200645 @@ -0,0 +1 @@ +09f38031c5ae4a88eae80d24285163b45ee6cbc96903a4f54dc0552cb11d12a4
\ No newline at end of file diff --git a/db/schema_migrations/20231101130230 b/db/schema_migrations/20231101130230 new file mode 100644 index 00000000000..8fa382d7033 --- /dev/null +++ b/db/schema_migrations/20231101130230 @@ -0,0 +1 @@ +c8dbdeb4ffcb7f5dc1c719a09a1f6c41188f584c80331a4482542a873d3ad12d
\ No newline at end of file diff --git a/db/schema_migrations/20231102083539 b/db/schema_migrations/20231102083539 new file mode 100644 index 00000000000..489269151bb --- /dev/null +++ b/db/schema_migrations/20231102083539 @@ -0,0 +1 @@ +1ac3716a5e014abe1828d648bd9f1014d770b40c4006944f341739728026fcd4
\ No newline at end of file diff --git a/db/schema_migrations/20231102142553 b/db/schema_migrations/20231102142553 new file mode 100644 index 00000000000..ea7ab1a82ff --- /dev/null +++ b/db/schema_migrations/20231102142553 @@ -0,0 +1 @@ +268ae2897297990a3ee94df152cc2ca1188073841d5da81c276d62471c6a5822
\ No newline at end of file diff --git a/db/schema_migrations/20231102142554 b/db/schema_migrations/20231102142554 new file mode 100644 index 00000000000..80d70adf962 --- /dev/null +++ b/db/schema_migrations/20231102142554 @@ -0,0 +1 @@ +af9d1bebd6e3736735fcbb9bb08858b25e3c1c5d6479c43d3f996f63a2f9660d
\ No newline at end of file diff --git a/db/schema_migrations/20231102142555 b/db/schema_migrations/20231102142555 new file mode 100644 index 00000000000..81c33fa8d36 --- /dev/null +++ b/db/schema_migrations/20231102142555 @@ -0,0 +1 @@ +3b683096e72455356d1ce1f115260b65ac15c5365c3c223abf3a9abed2d89b40
\ No newline at end of file diff --git a/db/schema_migrations/20231102142557 b/db/schema_migrations/20231102142557 new file mode 100644 index 00000000000..9510ecb5bd7 --- /dev/null +++ b/db/schema_migrations/20231102142557 @@ -0,0 +1 @@ +498535936c4d4e306ab6efa930dc77ef0684f07146c54c5e42136cfcbc45fa55
\ No newline at end of file diff --git a/db/schema_migrations/20231102142565 b/db/schema_migrations/20231102142565 new file mode 100644 index 00000000000..f12256acc25 --- /dev/null +++ b/db/schema_migrations/20231102142565 @@ -0,0 +1 @@ +61f9b94b89cd0edac11e56a67b99ded13b7e5761a91be08b06c24ddf9eb3ca02
\ No newline at end of file diff --git a/db/schema_migrations/20231103132849 b/db/schema_migrations/20231103132849 new file mode 100644 index 00000000000..4ac9f938f32 --- /dev/null +++ b/db/schema_migrations/20231103132849 @@ -0,0 +1 @@ +42c514c8e4addaa7836538741d5080c16e4db330507a037abfb149907c37a6a7
\ No newline at end of file diff --git a/db/schema_migrations/20231103162825 b/db/schema_migrations/20231103162825 new file mode 100644 index 00000000000..6bb33354de4 --- /dev/null +++ b/db/schema_migrations/20231103162825 @@ -0,0 +1 @@ +a6b5c59b0035f536185b94157950a2900754e07bcc2c6ea980cd9213f35b899c
\ No newline at end of file diff --git a/db/schema_migrations/20231103195309 b/db/schema_migrations/20231103195309 new file mode 100644 index 00000000000..cb5e21db50d --- /dev/null +++ b/db/schema_migrations/20231103195309 @@ -0,0 +1 @@ +d237c0aa5d44d58ee0a32246f3c2911d7515d18cff6b177709a95c3d064d000d
\ No newline at end of file diff --git a/db/schema_migrations/20231103223224 b/db/schema_migrations/20231103223224 new file mode 100644 index 00000000000..0ea5fea923e --- /dev/null +++ b/db/schema_migrations/20231103223224 @@ -0,0 +1 @@ +0c33abeb9990c6d913000de5c15c431fea7e8e68dbcd4fc1c16e42e679a9e28d
\ No newline at end of file diff --git a/db/schema_migrations/20231105165706 b/db/schema_migrations/20231105165706 new file mode 100644 index 00000000000..6b70de3ab1a --- /dev/null +++ b/db/schema_migrations/20231105165706 @@ -0,0 +1 @@ +050d1a1a44af5f93902c6a715434ce8144bb6644a891a890d381ae85e6cda9d7
\ No newline at end of file diff --git a/db/schema_migrations/20231106145853 b/db/schema_migrations/20231106145853 new file mode 100644 index 00000000000..0c50f91529f --- /dev/null +++ b/db/schema_migrations/20231106145853 @@ -0,0 +1 @@ +daa117df4a6d8e9a39fcf12e2c64917b7c66429952343b65212fcb27ad30130a
\ No newline at end of file diff --git a/db/schema_migrations/20231106212340 b/db/schema_migrations/20231106212340 new file mode 100644 index 00000000000..1731e94d37a --- /dev/null +++ b/db/schema_migrations/20231106212340 @@ -0,0 +1 @@ +c049aa4242cf88bb418e3285de83cf837e6855a709d68970c2f460a7e86bbf26
\ No newline at end of file diff --git a/db/schema_migrations/20231107062104 b/db/schema_migrations/20231107062104 new file mode 100644 index 00000000000..b58cae8fc66 --- /dev/null +++ b/db/schema_migrations/20231107062104 @@ -0,0 +1 @@ +d31386b36b5db29deb9041febc116915f94fa7c551f1d91d5f474671dccdc709
\ No newline at end of file diff --git a/db/schema_migrations/20231107071201 b/db/schema_migrations/20231107071201 new file mode 100644 index 00000000000..4c867fb2ad7 --- /dev/null +++ b/db/schema_migrations/20231107071201 @@ -0,0 +1 @@ +353eb22ec8e991d6aff2a79ae7e54e5d045aac3da34769e927d137ce9fb41306
\ No newline at end of file diff --git a/db/schema_migrations/20231107205734 b/db/schema_migrations/20231107205734 new file mode 100644 index 00000000000..8c5a02b54a8 --- /dev/null +++ b/db/schema_migrations/20231107205734 @@ -0,0 +1 @@ +72f0dde010df3c7bd9f8e5f44510f9d9eae275d1f6c4c3a72fa5813a2d9f3992
\ No newline at end of file diff --git a/db/schema_migrations/20231108072342 b/db/schema_migrations/20231108072342 new file mode 100644 index 00000000000..69228af4769 --- /dev/null +++ b/db/schema_migrations/20231108072342 @@ -0,0 +1 @@ +6798b462ec86a98c9f901ba10f6c8b904295091ff9aae48b76289699534f39c4
\ No newline at end of file diff --git a/db/schema_migrations/20231108093031 b/db/schema_migrations/20231108093031 new file mode 100644 index 00000000000..d532e469d82 --- /dev/null +++ b/db/schema_migrations/20231108093031 @@ -0,0 +1 @@ +fea17e6126f21671a8836dea252e2bd655179aeb6c746b6bbecaed0580dd255a
\ No newline at end of file diff --git a/db/schema_migrations/20231109133153 b/db/schema_migrations/20231109133153 new file mode 100644 index 00000000000..c9cfd53a77d --- /dev/null +++ b/db/schema_migrations/20231109133153 @@ -0,0 +1 @@ +fb17684ac5976811bd08e4a2edb3b3c45baaf293ee3c04e986ae3c197c59c54a
\ No newline at end of file diff --git a/db/schema_migrations/20231109183438 b/db/schema_migrations/20231109183438 new file mode 100644 index 00000000000..32c590bad5a --- /dev/null +++ b/db/schema_migrations/20231109183438 @@ -0,0 +1 @@ +87a41f56368f4211291dc6022af91a2168c389b426a1d615321cf0f36bd2c801
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index d7d5d469d9e..1055e902056 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -35,6 +35,248 @@ RETURN NULL; END $$; +CREATE TABLE namespaces ( + id integer NOT NULL, + name character varying NOT NULL, + path character varying NOT NULL, + owner_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone, + type character varying DEFAULT 'User'::character varying NOT NULL, + description character varying DEFAULT ''::character varying NOT NULL, + avatar character varying, + membership_lock boolean DEFAULT false, + share_with_group_lock boolean DEFAULT false, + visibility_level integer DEFAULT 20 NOT NULL, + request_access_enabled boolean DEFAULT true NOT NULL, + ldap_sync_status character varying DEFAULT 'ready'::character varying NOT NULL, + ldap_sync_error character varying, + ldap_sync_last_update_at timestamp without time zone, + ldap_sync_last_successful_update_at timestamp without time zone, + ldap_sync_last_sync_at timestamp without time zone, + description_html text, + lfs_enabled boolean, + parent_id integer, + shared_runners_minutes_limit integer, + repository_size_limit bigint, + require_two_factor_authentication boolean DEFAULT false NOT NULL, + two_factor_grace_period integer DEFAULT 48 NOT NULL, + cached_markdown_version integer, + project_creation_level integer, + runners_token character varying, + file_template_project_id integer, + saml_discovery_token character varying, + runners_token_encrypted character varying, + custom_project_templates_group_id integer, + auto_devops_enabled boolean, + extra_shared_runners_minutes_limit integer, + last_ci_minutes_notification_at timestamp with time zone, + last_ci_minutes_usage_notification_level integer, + subgroup_creation_level integer DEFAULT 1, + emails_disabled boolean, + max_pages_size integer, + max_artifacts_size integer, + mentions_disabled boolean, + default_branch_protection smallint, + unlock_membership_to_ldap boolean, + max_personal_access_token_lifetime integer, + push_rule_id bigint, + shared_runners_enabled boolean DEFAULT true NOT NULL, + allow_descendants_override_disabled_shared_runners boolean DEFAULT false NOT NULL, + traversal_ids integer[] DEFAULT '{}'::integer[] NOT NULL, + organization_id bigint DEFAULT 1 +); + +CREATE FUNCTION find_namespaces_by_id(namespaces_id bigint) RETURNS namespaces + LANGUAGE plpgsql STABLE COST 1 PARALLEL SAFE + AS $$ +BEGIN + return (SELECT namespaces FROM namespaces WHERE id = namespaces_id LIMIT 1); +END; +$$; + +CREATE TABLE projects ( + id integer NOT NULL, + name character varying, + path character varying, + description text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + creator_id integer, + namespace_id integer NOT NULL, + last_activity_at timestamp without time zone, + import_url character varying, + visibility_level integer DEFAULT 0 NOT NULL, + archived boolean DEFAULT false NOT NULL, + avatar character varying, + merge_requests_template text, + star_count integer DEFAULT 0 NOT NULL, + merge_requests_rebase_enabled boolean DEFAULT false, + import_type character varying, + import_source character varying, + approvals_before_merge integer DEFAULT 0 NOT NULL, + reset_approvals_on_push boolean DEFAULT true, + merge_requests_ff_only_enabled boolean DEFAULT false, + issues_template text, + mirror boolean DEFAULT false NOT NULL, + mirror_last_update_at timestamp without time zone, + mirror_last_successful_update_at timestamp without time zone, + mirror_user_id integer, + shared_runners_enabled boolean DEFAULT true NOT NULL, + runners_token character varying, + build_allow_git_fetch boolean DEFAULT true NOT NULL, + build_timeout integer DEFAULT 3600 NOT NULL, + mirror_trigger_builds boolean DEFAULT false NOT NULL, + pending_delete boolean DEFAULT false, + public_builds boolean DEFAULT true NOT NULL, + last_repository_check_failed boolean, + last_repository_check_at timestamp without time zone, + only_allow_merge_if_pipeline_succeeds boolean DEFAULT false NOT NULL, + has_external_issue_tracker boolean, + repository_storage character varying DEFAULT 'default'::character varying NOT NULL, + repository_read_only boolean, + request_access_enabled boolean DEFAULT true NOT NULL, + has_external_wiki boolean, + ci_config_path character varying, + lfs_enabled boolean, + description_html text, + only_allow_merge_if_all_discussions_are_resolved boolean, + repository_size_limit bigint, + printing_merge_request_link_enabled boolean DEFAULT true NOT NULL, + auto_cancel_pending_pipelines integer DEFAULT 1 NOT NULL, + service_desk_enabled boolean DEFAULT true, + cached_markdown_version integer, + delete_error text, + last_repository_updated_at timestamp without time zone, + disable_overriding_approvers_per_merge_request boolean, + storage_version smallint, + resolve_outdated_diff_discussions boolean, + remote_mirror_available_overridden boolean, + only_mirror_protected_branches boolean, + pull_mirror_available_overridden boolean, + jobs_cache_index integer, + external_authorization_classification_label character varying, + mirror_overwrites_diverged_branches boolean, + pages_https_only boolean DEFAULT true, + external_webhook_token character varying, + packages_enabled boolean, + merge_requests_author_approval boolean DEFAULT false, + pool_repository_id bigint, + runners_token_encrypted character varying, + bfg_object_map character varying, + detected_repository_languages boolean, + merge_requests_disable_committers_approval boolean, + require_password_to_approve boolean, + emails_disabled boolean, + max_pages_size integer, + max_artifacts_size integer, + pull_mirror_branch_prefix character varying(50), + remove_source_branch_after_merge boolean, + marked_for_deletion_at date, + marked_for_deletion_by_user_id integer, + autoclose_referenced_issues boolean, + suggestion_commit_message character varying(255), + project_namespace_id bigint, + hidden boolean DEFAULT false NOT NULL, + organization_id bigint DEFAULT 1 +); + +CREATE FUNCTION find_projects_by_id(projects_id bigint) RETURNS projects + LANGUAGE plpgsql STABLE COST 1 PARALLEL SAFE + AS $$ +BEGIN + return (SELECT projects FROM projects WHERE id = projects_id LIMIT 1); +END; +$$; + +CREATE TABLE users ( + id integer NOT NULL, + email character varying DEFAULT ''::character varying NOT NULL, + encrypted_password character varying DEFAULT ''::character varying NOT NULL, + reset_password_token character varying, + reset_password_sent_at timestamp without time zone, + remember_created_at timestamp without time zone, + sign_in_count integer DEFAULT 0, + current_sign_in_at timestamp without time zone, + last_sign_in_at timestamp without time zone, + current_sign_in_ip character varying, + last_sign_in_ip character varying, + created_at timestamp without time zone, + updated_at timestamp without time zone, + name character varying, + admin boolean DEFAULT false NOT NULL, + projects_limit integer NOT NULL, + failed_attempts integer DEFAULT 0, + locked_at timestamp without time zone, + username character varying, + can_create_group boolean DEFAULT true NOT NULL, + can_create_team boolean DEFAULT true NOT NULL, + state character varying, + color_scheme_id integer DEFAULT 1 NOT NULL, + password_expires_at timestamp without time zone, + created_by_id integer, + last_credential_check_at timestamp without time zone, + avatar character varying, + confirmation_token character varying, + confirmed_at timestamp without time zone, + confirmation_sent_at timestamp without time zone, + unconfirmed_email character varying, + hide_no_ssh_key boolean DEFAULT false, + admin_email_unsubscribed_at timestamp without time zone, + notification_email character varying, + hide_no_password boolean DEFAULT false, + password_automatically_set boolean DEFAULT false, + encrypted_otp_secret character varying, + encrypted_otp_secret_iv character varying, + encrypted_otp_secret_salt character varying, + otp_required_for_login boolean DEFAULT false NOT NULL, + otp_backup_codes text, + public_email character varying, + dashboard integer DEFAULT 0, + project_view integer DEFAULT 2, + consumed_timestep integer, + layout integer DEFAULT 0, + hide_project_limit boolean DEFAULT false, + note text, + unlock_token character varying, + otp_grace_period_started_at timestamp without time zone, + external boolean DEFAULT false, + incoming_email_token character varying, + auditor boolean DEFAULT false NOT NULL, + require_two_factor_authentication_from_group boolean DEFAULT false NOT NULL, + two_factor_grace_period integer DEFAULT 48 NOT NULL, + last_activity_on date, + notified_of_own_activity boolean DEFAULT false, + preferred_language character varying, + theme_id smallint, + accepted_term_id integer, + feed_token character varying, + private_profile boolean DEFAULT false NOT NULL, + roadmap_layout smallint, + include_private_contributions boolean, + commit_email character varying, + group_view integer, + managing_group_id integer, + first_name character varying(255), + last_name character varying(255), + static_object_token character varying(255), + role smallint, + user_type smallint DEFAULT 0, + static_object_token_encrypted text, + otp_secret_expires_at timestamp with time zone, + onboarding_in_progress boolean DEFAULT false NOT NULL, + CONSTRAINT check_0dd5948e38 CHECK ((user_type IS NOT NULL)), + CONSTRAINT check_7bde697e8e CHECK ((char_length(static_object_token_encrypted) <= 255)) +); + +CREATE FUNCTION find_users_by_id(users_id bigint) RETURNS users + LANGUAGE plpgsql STABLE COST 1 PARALLEL SAFE + AS $$ +BEGIN + return (SELECT users FROM users WHERE id = users_id LIMIT 1); +END; +$$; + CREATE FUNCTION gitlab_schema_prevent_write() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -298,30 +540,27 @@ BEGIN END; $$; -CREATE FUNCTION trigger_1bd97da9c1a4() RETURNS trigger +CREATE FUNCTION trigger_10ee1357e825() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN NEW."auto_canceled_by_id_convert_to_bigint" := NEW."auto_canceled_by_id"; + NEW."commit_id_convert_to_bigint" := NEW."commit_id"; + NEW."erased_by_id_convert_to_bigint" := NEW."erased_by_id"; + NEW."project_id_convert_to_bigint" := NEW."project_id"; + NEW."runner_id_convert_to_bigint" := NEW."runner_id"; + NEW."trigger_request_id_convert_to_bigint" := NEW."trigger_request_id"; + NEW."upstream_pipeline_id_convert_to_bigint" := NEW."upstream_pipeline_id"; + NEW."user_id_convert_to_bigint" := NEW."user_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 +CREATE FUNCTION trigger_1bd97da9c1a4() 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"; + NEW."auto_canceled_by_id_convert_to_bigint" := NEW."auto_canceled_by_id"; RETURN NEW; END; $$; @@ -344,29 +583,11 @@ BEGIN END; $$; -CREATE FUNCTION trigger_bbb95b2d6929() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW."shared_runners_duration_convert_to_bigint" := NEW."shared_runners_duration"; - RETURN NEW; -END; -$$; - -CREATE FUNCTION trigger_bfad0e2b9c86() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - NEW."pipeline_id_convert_to_bigint" := NEW."pipeline_id"; - RETURN NEW; -END; -$$; - -CREATE FUNCTION trigger_c0353bbb6145() RETURNS trigger +CREATE FUNCTION trigger_eaec934fe6b2() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN - NEW."shared_runners_duration_convert_to_bigint" := NEW."shared_runners_duration"; + NEW."id_convert_to_bigint" := NEW."id"; RETURN NEW; END; $$; @@ -10880,6 +11101,30 @@ CREATE SEQUENCE achievements_id_seq ALTER SEQUENCE achievements_id_seq OWNED BY achievements.id; +CREATE TABLE activity_pub_releases_subscriptions ( + id bigint NOT NULL, + project_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + status smallint DEFAULT 1 NOT NULL, + shared_inbox_url text, + subscriber_inbox_url text, + subscriber_url text NOT NULL, + payload jsonb, + CONSTRAINT check_0ebf38bcaa CHECK ((char_length(subscriber_inbox_url) <= 1024)), + CONSTRAINT check_2afd35ba17 CHECK ((char_length(subscriber_url) <= 1024)), + CONSTRAINT check_61b77ced49 CHECK ((char_length(shared_inbox_url) <= 1024)) +); + +CREATE SEQUENCE activity_pub_releases_subscriptions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE activity_pub_releases_subscriptions_id_seq OWNED BY activity_pub_releases_subscriptions.id; + CREATE TABLE agent_activity_events ( id bigint NOT NULL, agent_id bigint NOT NULL, @@ -11639,7 +11884,6 @@ CREATE TABLE application_settings ( notes_create_limit integer DEFAULT 300 NOT NULL, notes_create_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL, kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL, - in_product_marketing_emails_enabled boolean DEFAULT true NOT NULL, asset_proxy_whitelist text, admin_mode boolean DEFAULT false NOT NULL, delayed_project_removal boolean DEFAULT false NOT NULL, @@ -11831,7 +12075,7 @@ CREATE TABLE application_settings ( encrypted_product_analytics_configurator_connection_string bytea, encrypted_product_analytics_configurator_connection_string_iv bytea, silent_mode_enabled boolean DEFAULT false NOT NULL, - package_metadata_purl_types smallint[] DEFAULT '{1,2,3,4,5,6,7,8,9,10,11,12}'::smallint[], + package_metadata_purl_types smallint[] DEFAULT '{1,2,3,4,5,6,7,8,9,10,11,12,13}'::smallint[], ci_max_includes integer DEFAULT 150 NOT NULL, remember_me_enabled boolean DEFAULT true NOT NULL, encrypted_anthropic_api_key bytea, @@ -11874,6 +12118,10 @@ CREATE TABLE application_settings ( encrypted_vertex_ai_access_token_iv bytea, project_jobs_api_rate_limit integer DEFAULT 600 NOT NULL, math_rendering_limits_enabled boolean DEFAULT true NOT NULL, + service_access_tokens_expiration_enforced boolean DEFAULT true NOT NULL, + enable_artifact_external_redirect_warning_page boolean DEFAULT true NOT NULL, + allow_project_creation_for_guest_and_below boolean DEFAULT true NOT NULL, + update_namespace_name_rate_limit smallint DEFAULT 120 NOT NULL, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), @@ -11986,6 +12234,74 @@ CREATE SEQUENCE application_settings_id_seq ALTER SEQUENCE application_settings_id_seq OWNED BY application_settings.id; +CREATE TABLE approval_group_rules ( + id bigint NOT NULL, + group_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + approvals_required smallint DEFAULT 0 NOT NULL, + report_type smallint, + rule_type smallint DEFAULT 1 NOT NULL, + security_orchestration_policy_configuration_id bigint, + scan_result_policy_id bigint, + name text NOT NULL, + CONSTRAINT check_25d42add43 CHECK ((char_length(name) <= 255)) +); + +CREATE TABLE approval_group_rules_groups ( + id bigint NOT NULL, + approval_group_rule_id bigint NOT NULL, + group_id bigint NOT NULL +); + +CREATE SEQUENCE approval_group_rules_groups_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE approval_group_rules_groups_id_seq OWNED BY approval_group_rules_groups.id; + +CREATE SEQUENCE approval_group_rules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE approval_group_rules_id_seq OWNED BY approval_group_rules.id; + +CREATE TABLE approval_group_rules_protected_branches ( + id bigint NOT NULL, + approval_group_rule_id bigint NOT NULL, + protected_branch_id bigint NOT NULL +); + +CREATE SEQUENCE approval_group_rules_protected_branches_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE approval_group_rules_protected_branches_id_seq OWNED BY approval_group_rules_protected_branches.id; + +CREATE TABLE approval_group_rules_users ( + id bigint NOT NULL, + approval_group_rule_id bigint NOT NULL, + user_id bigint NOT NULL +); + +CREATE SEQUENCE approval_group_rules_users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE approval_group_rules_users_id_seq OWNED BY approval_group_rules_users.id; + CREATE TABLE approval_merge_request_rule_sources ( id bigint NOT NULL, approval_merge_request_rule_id bigint NOT NULL, @@ -12395,6 +12711,23 @@ CREATE SEQUENCE audit_events_streaming_headers_id_seq ALTER SEQUENCE audit_events_streaming_headers_id_seq OWNED BY audit_events_streaming_headers.id; +CREATE TABLE audit_events_streaming_http_group_namespace_filters ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + external_audit_event_destination_id bigint NOT NULL, + namespace_id bigint NOT NULL +); + +CREATE SEQUENCE audit_events_streaming_http_group_namespace_filters_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE audit_events_streaming_http_group_namespace_filters_id_seq OWNED BY audit_events_streaming_http_group_namespace_filters.id; + CREATE TABLE audit_events_streaming_instance_event_type_filters ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -13031,10 +13364,14 @@ CREATE TABLE bulk_import_failures ( exception_message text NOT NULL, correlation_id_value text, pipeline_step text, + source_url text, + source_title text, CONSTRAINT check_053d65c7a4 CHECK ((char_length(pipeline_class) <= 255)), CONSTRAINT check_6eca8f972e CHECK ((char_length(exception_message) <= 255)), CONSTRAINT check_721a422375 CHECK ((char_length(pipeline_step) <= 255)), + CONSTRAINT check_74414228d4 CHECK ((char_length(source_title) <= 255)), CONSTRAINT check_c7dba8398e CHECK ((char_length(exception_class) <= 255)), + CONSTRAINT check_e035a720ad CHECK ((char_length(source_url) <= 255)), CONSTRAINT check_e787285882 CHECK ((char_length(correlation_id_value) <= 255)) ); @@ -13105,6 +13442,8 @@ CREATE TABLE catalog_resource_components ( resource_type smallint DEFAULT 1 NOT NULL, inputs jsonb DEFAULT '{}'::jsonb NOT NULL, name text NOT NULL, + path text, + CONSTRAINT check_a76bfd47fe CHECK ((char_length(path) <= 255)), CONSTRAINT check_ddca729980 CHECK ((char_length(name) <= 255)) ); @@ -13139,7 +13478,10 @@ CREATE TABLE catalog_resources ( project_id bigint NOT NULL, created_at timestamp with time zone NOT NULL, state smallint DEFAULT 0 NOT NULL, - latest_released_at timestamp with time zone + latest_released_at timestamp with time zone, + name character varying, + description text, + visibility_level integer DEFAULT 0 NOT NULL ); CREATE SEQUENCE catalog_resources_id_seq @@ -13313,6 +13655,14 @@ CREATE TABLE p_ci_builds ( stage_id bigint, partition_id bigint NOT NULL, auto_canceled_by_partition_id bigint DEFAULT 100 NOT NULL, + auto_canceled_by_id_convert_to_bigint bigint, + commit_id_convert_to_bigint bigint, + erased_by_id_convert_to_bigint bigint, + project_id_convert_to_bigint bigint, + runner_id_convert_to_bigint bigint, + trigger_request_id_convert_to_bigint bigint, + upstream_pipeline_id_convert_to_bigint bigint, + user_id_convert_to_bigint bigint, CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)) ) PARTITION BY LIST (partition_id); @@ -13363,6 +13713,14 @@ CREATE TABLE ci_builds ( stage_id bigint, partition_id bigint NOT NULL, auto_canceled_by_partition_id bigint DEFAULT 100 NOT NULL, + auto_canceled_by_id_convert_to_bigint bigint, + commit_id_convert_to_bigint bigint, + erased_by_id_convert_to_bigint bigint, + project_id_convert_to_bigint bigint, + runner_id_convert_to_bigint bigint, + trigger_request_id_convert_to_bigint bigint, + upstream_pipeline_id_convert_to_bigint bigint, + user_id_convert_to_bigint bigint, CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)) ); @@ -13704,7 +14062,6 @@ CREATE TABLE ci_namespace_monthly_usages ( namespace_id bigint NOT NULL, date date NOT NULL, notification_level smallint DEFAULT 100 NOT NULL, - shared_runners_duration_convert_to_bigint integer DEFAULT 0 NOT NULL, created_at timestamp with time zone, amount_used numeric(18,4) DEFAULT 0.0 NOT NULL, shared_runners_duration bigint DEFAULT 0 NOT NULL, @@ -13794,7 +14151,6 @@ ALTER SEQUENCE ci_pipeline_artifacts_id_seq OWNED BY ci_pipeline_artifacts.id; CREATE TABLE ci_pipeline_chat_data ( id bigint NOT NULL, - pipeline_id_convert_to_bigint integer DEFAULT 0 NOT NULL, chat_name_id integer NOT NULL, response_url text NOT NULL, pipeline_id bigint NOT NULL @@ -13812,7 +14168,6 @@ ALTER SEQUENCE ci_pipeline_chat_data_id_seq OWNED BY ci_pipeline_chat_data.id; CREATE TABLE ci_pipeline_messages ( id bigint NOT NULL, severity smallint DEFAULT 0 NOT NULL, - pipeline_id_convert_to_bigint integer DEFAULT 0 NOT NULL, content text NOT NULL, pipeline_id bigint NOT NULL, CONSTRAINT check_58ca2981b2 CHECK ((char_length(content) <= 10000)) @@ -13921,7 +14276,7 @@ CREATE TABLE ci_pipelines ( duration integer, user_id integer, lock_version integer DEFAULT 0, - auto_canceled_by_id integer, + auto_canceled_by_id_convert_to_bigint integer, pipeline_schedule_id integer, source integer, config_source integer, @@ -13936,7 +14291,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, + auto_canceled_by_id bigint, CONSTRAINT check_d7e99a025e CHECK ((lock_version IS NOT NULL)) ); @@ -13991,7 +14346,6 @@ CREATE TABLE ci_project_monthly_usages ( id bigint NOT NULL, project_id bigint NOT NULL, date date NOT NULL, - shared_runners_duration_convert_to_bigint integer DEFAULT 0 NOT NULL, created_at timestamp with time zone, amount_used numeric(18,4) DEFAULT 0.0 NOT NULL, shared_runners_duration bigint DEFAULT 0 NOT NULL, @@ -14240,9 +14594,7 @@ ALTER SEQUENCE ci_secure_files_id_seq OWNED BY ci_secure_files.id; CREATE TABLE ci_sources_pipelines ( id integer NOT NULL, project_id integer, - pipeline_id_convert_to_bigint integer, source_project_id integer, - source_pipeline_id_convert_to_bigint integer, source_job_id bigint, partition_id bigint NOT NULL, source_partition_id bigint NOT NULL, @@ -14276,7 +14628,7 @@ ALTER SEQUENCE ci_sources_projects_id_seq OWNED BY ci_sources_projects.id; CREATE TABLE ci_stages ( project_id integer, - pipeline_id integer, + pipeline_id_convert_to_bigint integer, created_at timestamp without time zone, updated_at timestamp without time zone, name character varying, @@ -14285,7 +14637,7 @@ CREATE TABLE ci_stages ( "position" integer, id bigint NOT NULL, partition_id bigint NOT NULL, - pipeline_id_convert_to_bigint bigint, + pipeline_id bigint, CONSTRAINT check_81b431e49b CHECK ((lock_version IS NOT NULL)) ); @@ -14674,6 +15026,24 @@ CREATE SEQUENCE commit_user_mentions_id_seq ALTER SEQUENCE commit_user_mentions_id_seq OWNED BY commit_user_mentions.id; +CREATE TABLE compliance_framework_security_policies ( + id bigint NOT NULL, + framework_id bigint NOT NULL, + policy_configuration_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + policy_index smallint NOT NULL +); + +CREATE SEQUENCE compliance_framework_security_policies_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE compliance_framework_security_policies_id_seq OWNED BY compliance_framework_security_policies.id; + CREATE TABLE compliance_management_frameworks ( id bigint NOT NULL, name text NOT NULL, @@ -16431,8 +16801,6 @@ CREATE TABLE geo_node_statuses ( id integer NOT NULL, geo_node_id integer NOT NULL, db_replication_lag_seconds integer, - repositories_synced_count integer, - repositories_failed_count integer, lfs_objects_count integer, lfs_objects_synced_count integer, lfs_objects_failed_count integer, @@ -16452,15 +16820,9 @@ CREATE TABLE geo_node_statuses ( job_artifacts_failed_count integer, version character varying, revision character varying, - repositories_verified_count integer, - repositories_verification_failed_count integer, lfs_objects_synced_missing_on_primary_count integer, job_artifacts_synced_missing_on_primary_count integer, - repositories_checksummed_count integer, - repositories_checksum_failed_count integer, - repositories_checksum_mismatch_count integer, storage_configuration_digest bytea, - repositories_retrying_verification_count integer, projects_count integer, container_repositories_count integer, container_repositories_synced_count integer, @@ -17102,10 +17464,7 @@ CREATE TABLE in_product_marketing_emails ( track smallint, series smallint, created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - campaign text, - CONSTRAINT check_9d8b29f74f CHECK ((char_length(campaign) <= 255)), - CONSTRAINT in_product_marketing_emails_track_and_series_or_campaign CHECK ((((track IS NOT NULL) AND (series IS NOT NULL) AND (campaign IS NULL)) OR ((track IS NULL) AND (series IS NULL) AND (campaign IS NOT NULL)))) + updated_at timestamp with time zone NOT NULL ); CREATE SEQUENCE in_product_marketing_emails_id_seq @@ -18166,6 +18525,7 @@ CREATE TABLE member_roles ( admin_merge_request boolean DEFAULT false NOT NULL, admin_group_member boolean DEFAULT false NOT NULL, manage_project_access_tokens boolean DEFAULT false NOT NULL, + archive_project boolean DEFAULT false NOT NULL, CONSTRAINT check_4364846f58 CHECK ((char_length(description) <= 255)), CONSTRAINT check_9907916995 CHECK ((char_length(name) <= 255)) ); @@ -18388,7 +18748,8 @@ CREATE TABLE merge_request_diff_files ( diff text, "binary" boolean, external_diff_offset integer, - external_diff_size integer + external_diff_size integer, + generated boolean ); CREATE TABLE merge_request_diff_llm_summaries ( @@ -18819,6 +19180,7 @@ CREATE TABLE ml_candidates ( project_id bigint, internal_id bigint, ci_build_id bigint, + model_version_id bigint, CONSTRAINT check_25e6c65051 CHECK ((char_length(name) <= 255)), CONSTRAINT check_cd160587d4 CHECK ((eid IS NOT NULL)) ); @@ -18874,6 +19236,26 @@ CREATE SEQUENCE ml_experiments_id_seq ALTER SEQUENCE ml_experiments_id_seq OWNED BY ml_experiments.id; +CREATE TABLE ml_model_metadata ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + model_id bigint NOT NULL, + name text NOT NULL, + value text NOT NULL, + CONSTRAINT check_26d3322153 CHECK ((char_length(value) <= 5000)), + CONSTRAINT check_36240c80a7 CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE ml_model_metadata_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ml_model_metadata_id_seq OWNED BY ml_model_metadata.id; + CREATE TABLE ml_model_versions ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -18882,7 +19264,9 @@ CREATE TABLE ml_model_versions ( model_id bigint NOT NULL, package_id bigint, version text NOT NULL, - CONSTRAINT check_28b2d892c8 CHECK ((char_length(version) <= 255)) + description text, + CONSTRAINT check_28b2d892c8 CHECK ((char_length(version) <= 255)), + CONSTRAINT check_caff7d000b CHECK ((char_length(description) <= 500)) ); CREATE SEQUENCE ml_model_versions_id_seq @@ -18900,7 +19284,10 @@ CREATE TABLE ml_models ( updated_at timestamp with time zone NOT NULL, project_id bigint NOT NULL, name text NOT NULL, - CONSTRAINT check_1fd2cc7d93 CHECK ((char_length(name) <= 255)) + description text, + user_id integer, + CONSTRAINT check_1fd2cc7d93 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_d0c47d63b5 CHECK ((char_length(description) <= 5000)) ); CREATE SEQUENCE ml_models_id_seq @@ -19082,6 +19469,8 @@ CREATE TABLE namespace_settings ( experiment_features_enabled boolean DEFAULT false NOT NULL, third_party_ai_features_enabled boolean DEFAULT true NOT NULL, default_branch_protection_defaults jsonb DEFAULT '{}'::jsonb NOT NULL, + service_access_tokens_expiration_enforced boolean DEFAULT true NOT NULL, + product_analytics_enabled boolean DEFAULT false NOT NULL, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)), CONSTRAINT namespace_settings_unique_project_download_limit_alertlist_size CHECK ((cardinality(unique_project_download_limit_alertlist) <= 100)), CONSTRAINT namespace_settings_unique_project_download_limit_allowlist_size CHECK ((cardinality(unique_project_download_limit_allowlist) <= 100)) @@ -19106,58 +19495,6 @@ CREATE SEQUENCE namespace_statistics_id_seq ALTER SEQUENCE namespace_statistics_id_seq OWNED BY namespace_statistics.id; -CREATE TABLE namespaces ( - id integer NOT NULL, - name character varying NOT NULL, - path character varying NOT NULL, - owner_id integer, - created_at timestamp without time zone, - updated_at timestamp without time zone, - type character varying DEFAULT 'User'::character varying NOT NULL, - description character varying DEFAULT ''::character varying NOT NULL, - avatar character varying, - membership_lock boolean DEFAULT false, - share_with_group_lock boolean DEFAULT false, - visibility_level integer DEFAULT 20 NOT NULL, - request_access_enabled boolean DEFAULT true NOT NULL, - ldap_sync_status character varying DEFAULT 'ready'::character varying NOT NULL, - ldap_sync_error character varying, - ldap_sync_last_update_at timestamp without time zone, - ldap_sync_last_successful_update_at timestamp without time zone, - ldap_sync_last_sync_at timestamp without time zone, - description_html text, - lfs_enabled boolean, - parent_id integer, - shared_runners_minutes_limit integer, - repository_size_limit bigint, - require_two_factor_authentication boolean DEFAULT false NOT NULL, - two_factor_grace_period integer DEFAULT 48 NOT NULL, - cached_markdown_version integer, - project_creation_level integer, - runners_token character varying, - file_template_project_id integer, - saml_discovery_token character varying, - runners_token_encrypted character varying, - custom_project_templates_group_id integer, - auto_devops_enabled boolean, - extra_shared_runners_minutes_limit integer, - last_ci_minutes_notification_at timestamp with time zone, - last_ci_minutes_usage_notification_level integer, - subgroup_creation_level integer DEFAULT 1, - emails_disabled boolean, - max_pages_size integer, - max_artifacts_size integer, - mentions_disabled boolean, - default_branch_protection smallint, - unlock_membership_to_ldap boolean, - max_personal_access_token_lifetime integer, - push_rule_id bigint, - shared_runners_enabled boolean DEFAULT true NOT NULL, - allow_descendants_override_disabled_shared_runners boolean DEFAULT false NOT NULL, - traversal_ids integer[] DEFAULT '{}'::integer[] NOT NULL, - organization_id bigint DEFAULT 1 -); - CREATE SEQUENCE namespaces_id_seq START WITH 1 INCREMENT BY 1 @@ -20084,6 +20421,7 @@ CREATE TABLE packages_npm_metadata_caches ( file text NOT NULL, package_name text NOT NULL, object_storage_key text NOT NULL, + status smallint DEFAULT 0 NOT NULL, CONSTRAINT check_57aa07a4b2 CHECK ((char_length(file) <= 255)), CONSTRAINT check_f97c15aa60 CHECK ((char_length(object_storage_key) <= 255)) ); @@ -20130,6 +20468,7 @@ CREATE TABLE packages_nuget_symbols ( file_path text NOT NULL, signature text NOT NULL, object_storage_key text NOT NULL, + file_sha256 bytea, CONSTRAINT check_0e93ca58b7 CHECK ((char_length(file) <= 255)), CONSTRAINT check_28b82b08fa CHECK ((char_length(object_storage_key) <= 255)), CONSTRAINT check_30b0ef2ca2 CHECK ((char_length(file_path) <= 255)), @@ -20356,7 +20695,8 @@ CREATE TABLE packages_tags ( package_id integer NOT NULL, name character varying(255) 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, + project_id bigint ); CREATE SEQUENCE packages_tags_id_seq @@ -21242,7 +21582,8 @@ CREATE TABLE project_ci_cd_settings ( allow_fork_pipelines_to_run_in_parent_project boolean DEFAULT true NOT NULL, inbound_job_token_scope_enabled boolean DEFAULT true NOT NULL, forward_deployment_rollback_allowed boolean DEFAULT true NOT NULL, - merge_trains_skip_train_allowed boolean DEFAULT false NOT NULL + merge_trains_skip_train_allowed boolean DEFAULT false NOT NULL, + restrict_pipeline_cancellation_role smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE project_ci_cd_settings_id_seq @@ -21697,7 +22038,6 @@ CREATE TABLE project_settings ( selective_code_owner_removals boolean DEFAULT false NOT NULL, issue_branch_template text, show_diff_preview_in_email boolean DEFAULT true NOT NULL, - jitsu_key text, suggested_reviewers_enabled boolean DEFAULT false NOT NULL, only_allow_merge_if_all_status_checks_passed boolean DEFAULT false NOT NULL, mirror_branch_regex text, @@ -21715,7 +22055,6 @@ CREATE TABLE project_settings ( encrypted_product_analytics_configurator_connection_string_iv bytea, pages_multiple_versions_enabled boolean DEFAULT false NOT NULL, CONSTRAINT check_1a30456322 CHECK ((char_length(pages_unique_domain) <= 63)), - CONSTRAINT check_2981f15877 CHECK ((char_length(jitsu_key) <= 100)), CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)), CONSTRAINT check_3ca5cbffe6 CHECK ((char_length(issue_branch_template) <= 255)), CONSTRAINT check_4b142e71f3 CHECK ((char_length(product_analytics_data_collector_host) <= 255)), @@ -21813,92 +22152,6 @@ CREATE SEQUENCE project_wiki_repositories_id_seq ALTER SEQUENCE project_wiki_repositories_id_seq OWNED BY project_wiki_repositories.id; -CREATE TABLE projects ( - id integer NOT NULL, - name character varying, - path character varying, - description text, - created_at timestamp without time zone, - updated_at timestamp without time zone, - creator_id integer, - namespace_id integer NOT NULL, - last_activity_at timestamp without time zone, - import_url character varying, - visibility_level integer DEFAULT 0 NOT NULL, - archived boolean DEFAULT false NOT NULL, - avatar character varying, - merge_requests_template text, - star_count integer DEFAULT 0 NOT NULL, - merge_requests_rebase_enabled boolean DEFAULT false, - import_type character varying, - import_source character varying, - approvals_before_merge integer DEFAULT 0 NOT NULL, - reset_approvals_on_push boolean DEFAULT true, - merge_requests_ff_only_enabled boolean DEFAULT false, - issues_template text, - mirror boolean DEFAULT false NOT NULL, - mirror_last_update_at timestamp without time zone, - mirror_last_successful_update_at timestamp without time zone, - mirror_user_id integer, - shared_runners_enabled boolean DEFAULT true NOT NULL, - runners_token character varying, - build_allow_git_fetch boolean DEFAULT true NOT NULL, - build_timeout integer DEFAULT 3600 NOT NULL, - mirror_trigger_builds boolean DEFAULT false NOT NULL, - pending_delete boolean DEFAULT false, - public_builds boolean DEFAULT true NOT NULL, - last_repository_check_failed boolean, - last_repository_check_at timestamp without time zone, - only_allow_merge_if_pipeline_succeeds boolean DEFAULT false NOT NULL, - has_external_issue_tracker boolean, - repository_storage character varying DEFAULT 'default'::character varying NOT NULL, - repository_read_only boolean, - request_access_enabled boolean DEFAULT true NOT NULL, - has_external_wiki boolean, - ci_config_path character varying, - lfs_enabled boolean, - description_html text, - only_allow_merge_if_all_discussions_are_resolved boolean, - repository_size_limit bigint, - printing_merge_request_link_enabled boolean DEFAULT true NOT NULL, - auto_cancel_pending_pipelines integer DEFAULT 1 NOT NULL, - service_desk_enabled boolean DEFAULT true, - cached_markdown_version integer, - delete_error text, - last_repository_updated_at timestamp without time zone, - disable_overriding_approvers_per_merge_request boolean, - storage_version smallint, - resolve_outdated_diff_discussions boolean, - remote_mirror_available_overridden boolean, - only_mirror_protected_branches boolean, - pull_mirror_available_overridden boolean, - jobs_cache_index integer, - external_authorization_classification_label character varying, - mirror_overwrites_diverged_branches boolean, - pages_https_only boolean DEFAULT true, - external_webhook_token character varying, - packages_enabled boolean, - merge_requests_author_approval boolean DEFAULT false, - pool_repository_id bigint, - runners_token_encrypted character varying, - bfg_object_map character varying, - detected_repository_languages boolean, - merge_requests_disable_committers_approval boolean, - require_password_to_approve boolean, - emails_disabled boolean, - max_pages_size integer, - max_artifacts_size integer, - pull_mirror_branch_prefix character varying(50), - remove_source_branch_after_merge boolean, - marked_for_deletion_at date, - marked_for_deletion_by_user_id integer, - autoclose_referenced_issues boolean, - suggestion_commit_message character varying(255), - project_namespace_id bigint, - hidden boolean DEFAULT false NOT NULL, - organization_id bigint DEFAULT 1 -); - CREATE SEQUENCE projects_id_seq START WITH 1 INCREMENT BY 1 @@ -22337,6 +22590,7 @@ CREATE TABLE remote_development_agent_configs ( dns_zone text NOT NULL, network_policy_enabled boolean DEFAULT true NOT NULL, gitlab_workspaces_proxy_namespace text DEFAULT 'gitlab-workspaces'::text NOT NULL, + network_policy_egress jsonb DEFAULT '[{"allow": "0.0.0.0/0", "except": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]}]'::jsonb NOT NULL, CONSTRAINT check_72947a4495 CHECK ((char_length(gitlab_workspaces_proxy_namespace) <= 63)), CONSTRAINT check_9f5cd54d1c CHECK ((char_length(dns_zone) <= 256)) ); @@ -22697,7 +22951,9 @@ CREATE TABLE sbom_components ( component_type smallint NOT NULL, name text NOT NULL, purl_type smallint, - CONSTRAINT check_91a8f6ad53 CHECK ((char_length(name) <= 255)) + source_package_name text, + CONSTRAINT check_91a8f6ad53 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_e2dcb53709 CHECK ((char_length(source_package_name) <= 255)) ); CREATE SEQUENCE sbom_components_id_seq @@ -23093,6 +23349,7 @@ CREATE TABLE service_desk_custom_email_credentials ( encrypted_smtp_username_iv bytea, encrypted_smtp_password bytea, encrypted_smtp_password_iv bytea, + smtp_authentication smallint, CONSTRAINT check_6dd11e956a CHECK ((char_length(smtp_address) <= 255)) ); @@ -23418,7 +23675,8 @@ CREATE TABLE status_check_responses ( sha bytea NOT NULL, external_status_check_id bigint NOT NULL, status smallint DEFAULT 0 NOT NULL, - retried_at timestamp with time zone + retried_at timestamp with time zone, + created_at timestamp with time zone DEFAULT now() NOT NULL ); CREATE SEQUENCE status_check_responses_id_seq @@ -23621,7 +23879,8 @@ CREATE TABLE system_note_metadata ( created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, description_version_id bigint, - note_id bigint NOT NULL + note_id bigint NOT NULL, + id_convert_to_bigint bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE system_note_metadata_id_seq @@ -24088,6 +24347,8 @@ CREATE TABLE user_details ( enterprise_group_id bigint, enterprise_group_associated_at timestamp with time zone, email_reset_offered_at timestamp with time zone, + mastodon text DEFAULT ''::text NOT NULL, + project_authorizations_recalculated_at timestamp with time zone DEFAULT '2010-01-01 00:00:00+00'::timestamp with time zone NOT NULL, 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)), @@ -24099,6 +24360,7 @@ CREATE TABLE user_details ( CONSTRAINT check_8a7fcf8a60 CHECK ((char_length(location) <= 500)), CONSTRAINT check_a73b398c60 CHECK ((char_length(phone) <= 50)), CONSTRAINT check_eeeaf8d4f0 CHECK ((char_length(pronouns) <= 50)), + CONSTRAINT check_f1a8a05b9a CHECK ((char_length(mastodon) <= 500)), CONSTRAINT check_f932ed37db CHECK ((char_length(pronunciation) <= 255)) ); @@ -24239,6 +24501,7 @@ CREATE TABLE user_preferences ( project_shortcut_buttons boolean DEFAULT true NOT NULL, enabled_zoekt boolean DEFAULT true NOT NULL, keyboard_shortcuts_enabled boolean DEFAULT true NOT NULL, + time_display_format smallint DEFAULT 0 NOT NULL, CONSTRAINT check_89bf269f41 CHECK ((char_length(diffs_deletion_color) <= 7)), CONSTRAINT check_d07ccd35f7 CHECK ((char_length(diffs_addition_color) <= 7)) ); @@ -24306,90 +24569,6 @@ CREATE SEQUENCE user_synced_attributes_metadata_id_seq ALTER SEQUENCE user_synced_attributes_metadata_id_seq OWNED BY user_synced_attributes_metadata.id; -CREATE TABLE users ( - id integer NOT NULL, - email character varying DEFAULT ''::character varying NOT NULL, - encrypted_password character varying DEFAULT ''::character varying NOT NULL, - reset_password_token character varying, - reset_password_sent_at timestamp without time zone, - remember_created_at timestamp without time zone, - sign_in_count integer DEFAULT 0, - current_sign_in_at timestamp without time zone, - last_sign_in_at timestamp without time zone, - current_sign_in_ip character varying, - last_sign_in_ip character varying, - created_at timestamp without time zone, - updated_at timestamp without time zone, - name character varying, - admin boolean DEFAULT false NOT NULL, - projects_limit integer NOT NULL, - failed_attempts integer DEFAULT 0, - locked_at timestamp without time zone, - username character varying, - can_create_group boolean DEFAULT true NOT NULL, - can_create_team boolean DEFAULT true NOT NULL, - state character varying, - color_scheme_id integer DEFAULT 1 NOT NULL, - password_expires_at timestamp without time zone, - created_by_id integer, - last_credential_check_at timestamp without time zone, - avatar character varying, - confirmation_token character varying, - confirmed_at timestamp without time zone, - confirmation_sent_at timestamp without time zone, - unconfirmed_email character varying, - hide_no_ssh_key boolean DEFAULT false, - admin_email_unsubscribed_at timestamp without time zone, - notification_email character varying, - hide_no_password boolean DEFAULT false, - password_automatically_set boolean DEFAULT false, - encrypted_otp_secret character varying, - encrypted_otp_secret_iv character varying, - encrypted_otp_secret_salt character varying, - otp_required_for_login boolean DEFAULT false NOT NULL, - otp_backup_codes text, - public_email character varying, - dashboard integer DEFAULT 0, - project_view integer DEFAULT 2, - consumed_timestep integer, - layout integer DEFAULT 0, - hide_project_limit boolean DEFAULT false, - note text, - unlock_token character varying, - otp_grace_period_started_at timestamp without time zone, - external boolean DEFAULT false, - incoming_email_token character varying, - auditor boolean DEFAULT false NOT NULL, - require_two_factor_authentication_from_group boolean DEFAULT false NOT NULL, - two_factor_grace_period integer DEFAULT 48 NOT NULL, - last_activity_on date, - notified_of_own_activity boolean DEFAULT false, - preferred_language character varying, - email_opted_in boolean, - email_opted_in_ip character varying, - email_opted_in_source_id integer, - email_opted_in_at timestamp without time zone, - theme_id smallint, - accepted_term_id integer, - feed_token character varying, - private_profile boolean DEFAULT false NOT NULL, - roadmap_layout smallint, - include_private_contributions boolean, - commit_email character varying, - group_view integer, - managing_group_id integer, - first_name character varying(255), - last_name character varying(255), - static_object_token character varying(255), - role smallint, - user_type smallint DEFAULT 0, - static_object_token_encrypted text, - otp_secret_expires_at timestamp with time zone, - onboarding_in_progress boolean DEFAULT false NOT NULL, - CONSTRAINT check_0dd5948e38 CHECK ((user_type IS NOT NULL)), - CONSTRAINT check_7bde697e8e CHECK ((char_length(static_object_token_encrypted) <= 255)) -); - CREATE SEQUENCE users_id_seq START WITH 1 INCREMENT BY 1 @@ -25296,7 +25475,6 @@ CREATE TABLE workspaces ( deployment_resource_version text, personal_access_token_id bigint, config_version integer DEFAULT 1 NOT NULL, - force_full_reconciliation boolean DEFAULT false NOT NULL, force_include_all_resources boolean DEFAULT true NOT NULL, CONSTRAINT check_15543fb0fa CHECK ((char_length(name) <= 64)), CONSTRAINT check_157d5f955c CHECK ((char_length(namespace) <= 64)), @@ -25405,11 +25583,12 @@ ALTER SEQUENCE zentao_tracker_data_id_seq OWNED BY zentao_tracker_data.id; CREATE TABLE zoekt_indexed_namespaces ( id bigint NOT NULL, - zoekt_shard_id bigint NOT NULL, + zoekt_shard_id bigint, namespace_id bigint NOT NULL, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, - search boolean DEFAULT true NOT NULL + search boolean DEFAULT true NOT NULL, + zoekt_node_id bigint ); CREATE SEQUENCE zoekt_indexed_namespaces_id_seq @@ -25421,6 +25600,30 @@ CREATE SEQUENCE zoekt_indexed_namespaces_id_seq ALTER SEQUENCE zoekt_indexed_namespaces_id_seq OWNED BY zoekt_indexed_namespaces.id; +CREATE TABLE zoekt_nodes ( + id bigint NOT NULL, + uuid uuid NOT NULL, + used_bytes bigint DEFAULT 0 NOT NULL, + total_bytes bigint DEFAULT 0 NOT NULL, + last_seen_at timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + index_base_url text NOT NULL, + search_base_url text NOT NULL, + metadata jsonb DEFAULT '{}'::jsonb NOT NULL, + CONSTRAINT check_32f39efba3 CHECK ((char_length(search_base_url) <= 1024)), + CONSTRAINT check_38c354a3c2 CHECK ((char_length(index_base_url) <= 1024)) +); + +CREATE SEQUENCE zoekt_nodes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE zoekt_nodes_id_seq OWNED BY zoekt_nodes.id; + CREATE TABLE zoekt_shards ( id bigint NOT NULL, index_base_url text NOT NULL, @@ -25864,6 +26067,8 @@ ALTER TABLE ONLY abuse_trust_scores ALTER COLUMN id SET DEFAULT nextval('abuse_t ALTER TABLE ONLY achievements ALTER COLUMN id SET DEFAULT nextval('achievements_id_seq'::regclass); +ALTER TABLE ONLY activity_pub_releases_subscriptions ALTER COLUMN id SET DEFAULT nextval('activity_pub_releases_subscriptions_id_seq'::regclass); + ALTER TABLE ONLY agent_activity_events ALTER COLUMN id SET DEFAULT nextval('agent_activity_events_id_seq'::regclass); ALTER TABLE ONLY agent_group_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_group_authorizations_id_seq'::regclass); @@ -25906,6 +26111,14 @@ ALTER TABLE ONLY application_setting_terms ALTER COLUMN id SET DEFAULT nextval(' ALTER TABLE ONLY application_settings ALTER COLUMN id SET DEFAULT nextval('application_settings_id_seq'::regclass); +ALTER TABLE ONLY approval_group_rules ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_id_seq'::regclass); + +ALTER TABLE ONLY approval_group_rules_groups ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_groups_id_seq'::regclass); + +ALTER TABLE ONLY approval_group_rules_protected_branches ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_protected_branches_id_seq'::regclass); + +ALTER TABLE ONLY approval_group_rules_users ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_users_id_seq'::regclass); + ALTER TABLE ONLY approval_merge_request_rule_sources ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rule_sources_id_seq'::regclass); ALTER TABLE ONLY approval_merge_request_rules ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rules_id_seq'::regclass); @@ -25946,6 +26159,8 @@ ALTER TABLE ONLY audit_events_streaming_event_type_filters ALTER COLUMN id SET D ALTER TABLE ONLY audit_events_streaming_headers ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_headers_id_seq'::regclass); +ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_http_group_namespace_filters_id_seq'::regclass); + ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_instance_event_type_filters_id_seq'::regclass); ALTER TABLE ONLY authentication_events ALTER COLUMN id SET DEFAULT nextval('authentication_events_id_seq'::regclass); @@ -26136,6 +26351,8 @@ ALTER TABLE ONLY clusters_kubernetes_namespaces ALTER COLUMN id SET DEFAULT next ALTER TABLE ONLY commit_user_mentions ALTER COLUMN id SET DEFAULT nextval('commit_user_mentions_id_seq'::regclass); +ALTER TABLE ONLY compliance_framework_security_policies ALTER COLUMN id SET DEFAULT nextval('compliance_framework_security_policies_id_seq'::regclass); + ALTER TABLE ONLY compliance_management_frameworks ALTER COLUMN id SET DEFAULT nextval('compliance_management_frameworks_id_seq'::regclass); ALTER TABLE ONLY container_registry_protection_rules ALTER COLUMN id SET DEFAULT nextval('container_registry_protection_rules_id_seq'::regclass); @@ -26500,6 +26717,8 @@ ALTER TABLE ONLY ml_experiment_metadata ALTER COLUMN id SET DEFAULT nextval('ml_ ALTER TABLE ONLY ml_experiments ALTER COLUMN id SET DEFAULT nextval('ml_experiments_id_seq'::regclass); +ALTER TABLE ONLY ml_model_metadata ALTER COLUMN id SET DEFAULT nextval('ml_model_metadata_id_seq'::regclass); + ALTER TABLE ONLY ml_model_versions ALTER COLUMN id SET DEFAULT nextval('ml_model_versions_id_seq'::regclass); ALTER TABLE ONLY ml_models ALTER COLUMN id SET DEFAULT nextval('ml_models_id_seq'::regclass); @@ -27022,6 +27241,8 @@ ALTER TABLE ONLY zentao_tracker_data ALTER COLUMN id SET DEFAULT nextval('zentao ALTER TABLE ONLY zoekt_indexed_namespaces ALTER COLUMN id SET DEFAULT nextval('zoekt_indexed_namespaces_id_seq'::regclass); +ALTER TABLE ONLY zoekt_nodes ALTER COLUMN id SET DEFAULT nextval('zoekt_nodes_id_seq'::regclass); + ALTER TABLE ONLY zoekt_shards ALTER COLUMN id SET DEFAULT nextval('zoekt_shards_id_seq'::regclass); ALTER TABLE ONLY zoom_meetings ALTER COLUMN id SET DEFAULT nextval('zoom_meetings_id_seq'::regclass); @@ -27632,6 +27853,9 @@ ALTER TABLE ONLY abuse_trust_scores ALTER TABLE ONLY achievements ADD CONSTRAINT achievements_pkey PRIMARY KEY (id); +ALTER TABLE ONLY activity_pub_releases_subscriptions + ADD CONSTRAINT activity_pub_releases_subscriptions_pkey PRIMARY KEY (id); + ALTER TABLE ONLY agent_activity_events ADD CONSTRAINT agent_activity_events_pkey PRIMARY KEY (id); @@ -27704,6 +27928,18 @@ ALTER TABLE ONLY application_setting_terms ALTER TABLE ONLY application_settings ADD CONSTRAINT application_settings_pkey PRIMARY KEY (id); +ALTER TABLE ONLY approval_group_rules_groups + ADD CONSTRAINT approval_group_rules_groups_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY approval_group_rules + ADD CONSTRAINT approval_group_rules_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY approval_group_rules_protected_branches + ADD CONSTRAINT approval_group_rules_protected_branches_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY approval_group_rules_users + ADD CONSTRAINT approval_group_rules_users_pkey PRIMARY KEY (id); + ALTER TABLE ONLY approval_merge_request_rule_sources ADD CONSTRAINT approval_merge_request_rule_sources_pkey PRIMARY KEY (id); @@ -27770,6 +28006,9 @@ ALTER TABLE ONLY audit_events_streaming_event_type_filters ALTER TABLE ONLY audit_events_streaming_headers ADD CONSTRAINT audit_events_streaming_headers_pkey PRIMARY KEY (id); +ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters + ADD CONSTRAINT audit_events_streaming_http_group_namespace_filters_pkey PRIMARY KEY (id); + ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters ADD CONSTRAINT audit_events_streaming_instance_event_type_filters_pkey PRIMARY KEY (id); @@ -27893,8 +28132,8 @@ ALTER TABLE workspaces ALTER TABLE vulnerability_scanners ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID; -ALTER TABLE personal_access_tokens - ADD CONSTRAINT check_b8d60815eb CHECK ((expires_at IS NOT NULL)) NOT VALID; +ALTER TABLE packages_tags + ADD CONSTRAINT check_91b8472153 CHECK ((project_id IS NOT NULL)) NOT VALID; ALTER TABLE sprints ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID; @@ -28124,6 +28363,9 @@ ALTER TABLE ONLY clusters ALTER TABLE ONLY commit_user_mentions ADD CONSTRAINT commit_user_mentions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY compliance_framework_security_policies + ADD CONSTRAINT compliance_framework_security_policies_pkey PRIMARY KEY (id); + ALTER TABLE ONLY compliance_management_frameworks ADD CONSTRAINT compliance_management_frameworks_pkey PRIMARY KEY (id); @@ -28766,6 +29008,9 @@ ALTER TABLE ONLY ml_experiment_metadata ALTER TABLE ONLY ml_experiments ADD CONSTRAINT ml_experiments_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ml_model_metadata + ADD CONSTRAINT ml_model_metadata_pkey PRIMARY KEY (id); + ALTER TABLE ONLY ml_model_versions ADD CONSTRAINT ml_model_versions_pkey PRIMARY KEY (id); @@ -29687,6 +29932,9 @@ ALTER TABLE ONLY zentao_tracker_data ALTER TABLE ONLY zoekt_indexed_namespaces ADD CONSTRAINT zoekt_indexed_namespaces_pkey PRIMARY KEY (id); +ALTER TABLE ONLY zoekt_nodes + ADD CONSTRAINT zoekt_nodes_pkey PRIMARY KEY (id); + ALTER TABLE ONLY zoekt_shards ADD CONSTRAINT zoekt_shards_pkey PRIMARY KEY (id); @@ -30879,8 +31127,6 @@ CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING CREATE INDEX analytics_repository_languages_on_project_id ON analytics_language_trend_repository_languages USING btree (project_id); -CREATE UNIQUE INDEX any_approver_merge_request_rule_type_unique_index ON approval_merge_request_rules USING btree (merge_request_id, rule_type) WHERE (rule_type = 4); - CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_project_rules USING btree (project_id) WHERE (rule_type = 3); CREATE INDEX approval_mr_rule_index_merge_request_id ON approval_merge_request_rules USING btree (merge_request_id); @@ -30941,6 +31187,8 @@ CREATE UNIQUE INDEX i_bulk_import_trackers_id_batch_number ON bulk_import_batch_ CREATE INDEX i_compliance_frameworks_on_id_and_created_at ON compliance_management_frameworks USING btree (id, created_at, pipeline_configuration_full_path); +CREATE INDEX i_compliance_standards_adherence_on_namespace_id_and_proj_id ON project_compliance_standards_adherence USING btree (namespace_id, project_id DESC, id DESC); + CREATE INDEX i_compliance_violations_for_export ON merge_requests_compliance_violations USING btree (target_project_id, id); CREATE INDEX i_compliance_violations_on_project_id_merged_at_and_id ON merge_requests_compliance_violations USING btree (target_project_id, merged_at, id); @@ -30999,6 +31247,8 @@ CREATE INDEX idx_build_artifacts_size_refreshes_state_updated_at ON project_buil CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1); +CREATE INDEX idx_compliance_security_policies_on_policy_configuration_id ON compliance_framework_security_policies USING btree (policy_configuration_id); + CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at ON container_expiration_policies USING btree (project_id, next_run_at) WHERE (enabled = true); CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled); @@ -31079,6 +31329,18 @@ CREATE INDEX idx_mrs_on_target_id_and_created_at_and_state_id ON merge_requests CREATE UNIQUE INDEX idx_namespace_settings_on_default_compliance_framework_id ON namespace_settings USING btree (default_compliance_framework_id); +CREATE UNIQUE INDEX idx_on_approval_group_rules_any_approver_type ON approval_group_rules USING btree (group_id, rule_type) WHERE (rule_type = 4); + +CREATE UNIQUE INDEX idx_on_approval_group_rules_group_id_type_name ON approval_group_rules USING btree (group_id, rule_type, name); + +CREATE UNIQUE INDEX idx_on_approval_group_rules_groups_rule_group ON approval_group_rules_groups USING btree (approval_group_rule_id, group_id); + +CREATE UNIQUE INDEX idx_on_approval_group_rules_protected_branch ON approval_group_rules_protected_branches USING btree (approval_group_rule_id, protected_branch_id); + +CREATE INDEX idx_on_approval_group_rules_security_orch_policy ON approval_group_rules USING btree (security_orchestration_policy_configuration_id); + +CREATE UNIQUE INDEX idx_on_approval_group_rules_users_rule_user ON approval_group_rules_users USING btree (approval_group_rule_id, user_id); + CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name); CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_external_url ON external_approval_rules USING btree (project_id, external_url); @@ -31089,6 +31351,8 @@ CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_external_url ON ext CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_name ON external_status_checks USING btree (project_id, name); +CREATE INDEX idx_on_protected_branch ON approval_group_rules_protected_branches USING btree (protected_branch_id); + CREATE INDEX idx_open_issues_on_project_and_confidential_and_author_and_id ON issues USING btree (project_id, confidential, author_id, id) WHERE (state_id = 1); CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id); @@ -31121,6 +31385,8 @@ CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type O CREATE INDEX idx_pkgs_installable_package_files_on_package_id_id_file_name ON packages_package_files USING btree (package_id, id, file_name) WHERE (status = 0); +CREATE INDEX idx_pkgs_npm_metadata_caches_on_id_and_project_id_and_status ON packages_npm_metadata_caches USING btree (id) WHERE ((project_id IS NULL) AND (status = 0)); + CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_cloud_last_sync_at, project_id) WHERE (jira_dvcs_cloud_last_sync_at IS NOT NULL); CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_server_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_server_last_sync_at, project_id) WHERE (jira_dvcs_server_last_sync_at IS NOT NULL); @@ -31163,6 +31429,8 @@ CREATE INDEX idx_security_scans_on_scan_type ON security_scans USING btree (scan CREATE UNIQUE INDEX idx_software_license_policies_unique_on_project_and_scan_policy ON software_license_policies USING btree (project_id, software_license_id, scan_result_policy_id); +CREATE INDEX idx_status_check_responses_on_id_and_status ON status_check_responses USING btree (id, status); + CREATE INDEX idx_streaming_headers_on_external_audit_event_destination_id ON audit_events_streaming_headers USING btree (external_audit_event_destination_id); CREATE INDEX idx_test_reports_on_issue_id_created_at_and_id ON requirements_management_test_reports USING btree (issue_id, created_at, id); @@ -31229,6 +31497,10 @@ CREATE INDEX index_abuse_trust_scores_on_user_id_and_source_and_created_at ON ab CREATE UNIQUE INDEX "index_achievements_on_namespace_id_LOWER_name" ON achievements USING btree (namespace_id, lower(name)); +CREATE UNIQUE INDEX index_activity_pub_releases_sub_on_project_id_inbox_url ON activity_pub_releases_subscriptions USING btree (project_id, lower(subscriber_inbox_url)); + +CREATE UNIQUE INDEX index_activity_pub_releases_sub_on_project_id_sub_url ON activity_pub_releases_subscriptions USING btree (project_id, lower(subscriber_url)); + CREATE INDEX index_agent_activity_events_on_agent_id_and_recorded_at_and_id ON agent_activity_events USING btree (agent_id, recorded_at, id); CREATE INDEX index_agent_activity_events_on_agent_token_id ON agent_activity_events USING btree (agent_token_id) WHERE (agent_token_id IS NOT NULL); @@ -31283,8 +31555,6 @@ CREATE INDEX index_allowed_email_domains_on_group_id ON allowed_email_domains US CREATE INDEX index_analytics_ca_group_stages_on_end_event_label_id ON analytics_cycle_analytics_group_stages USING btree (end_event_label_id); -CREATE INDEX index_analytics_ca_group_stages_on_group_id ON analytics_cycle_analytics_group_stages USING btree (group_id); - CREATE INDEX index_analytics_ca_group_stages_on_relative_position ON analytics_cycle_analytics_group_stages USING btree (relative_position); CREATE INDEX index_analytics_ca_group_stages_on_start_event_label_id ON analytics_cycle_analytics_group_stages USING btree (start_event_label_id); @@ -31311,6 +31581,12 @@ CREATE INDEX index_application_settings_on_usage_stats_set_by_user_id ON applica CREATE INDEX index_applicationsettings_on_instance_administration_project_id ON application_settings USING btree (instance_administration_project_id); +CREATE INDEX index_approval_group_rules_groups_on_group_id ON approval_group_rules_groups USING btree (group_id); + +CREATE INDEX index_approval_group_rules_on_scan_result_policy_id ON approval_group_rules USING btree (scan_result_policy_id); + +CREATE INDEX index_approval_group_rules_users_on_user_id ON approval_group_rules_users USING btree (user_id); + CREATE UNIQUE INDEX index_approval_merge_request_rule_sources_1 ON approval_merge_request_rule_sources USING btree (approval_merge_request_rule_id); CREATE INDEX index_approval_merge_request_rule_sources_2 ON approval_merge_request_rule_sources USING btree (approval_project_rule_id); @@ -31519,8 +31795,14 @@ CREATE INDEX index_catalog_resource_versions_on_project_id ON catalog_resource_v CREATE UNIQUE INDEX index_catalog_resource_versions_on_release_id ON catalog_resource_versions USING btree (release_id); +CREATE INDEX index_catalog_resources_on_description_trigram ON catalog_resources USING gin (description gin_trgm_ops); + +CREATE INDEX index_catalog_resources_on_name_trigram ON catalog_resources USING gin (name gin_trgm_ops); + CREATE UNIQUE INDEX index_catalog_resources_on_project_id ON catalog_resources USING btree (project_id); +CREATE INDEX index_catalog_resources_on_state ON catalog_resources USING btree (state); + CREATE INDEX index_chat_names_on_team_id_and_chat_id ON chat_names USING btree (team_id, chat_id); CREATE INDEX index_chat_names_on_user_id ON chat_names USING btree (user_id); @@ -31739,12 +32021,8 @@ CREATE INDEX index_ci_pipeline_chat_data_on_chat_name_id ON ci_pipeline_chat_dat CREATE UNIQUE INDEX index_ci_pipeline_chat_data_on_pipeline_id ON ci_pipeline_chat_data USING btree (pipeline_id); -CREATE UNIQUE INDEX index_ci_pipeline_chat_data_on_pipeline_id_convert_to_bigint ON ci_pipeline_chat_data USING btree (pipeline_id_convert_to_bigint); - CREATE INDEX index_ci_pipeline_messages_on_pipeline_id ON ci_pipeline_messages USING btree (pipeline_id); -CREATE INDEX index_ci_pipeline_messages_on_pipeline_id_convert_to_bigint ON ci_pipeline_messages USING btree (pipeline_id_convert_to_bigint); - CREATE INDEX index_ci_pipeline_metadata_on_project_id ON ci_pipeline_metadata USING btree (project_id); CREATE UNIQUE INDEX index_ci_pipeline_schedule_variables_on_schedule_id_and_key ON ci_pipeline_schedule_variables USING btree (pipeline_schedule_id, key); @@ -31831,6 +32109,12 @@ CREATE INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ON ci_run CREATE INDEX index_ci_runner_machines_on_created_at_and_id_desc ON ci_runner_machines USING btree (created_at, id DESC); +CREATE INDEX index_ci_runner_machines_on_major_version_trigram ON ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id); + +CREATE INDEX index_ci_runner_machines_on_minor_version_trigram ON ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id); + +CREATE INDEX index_ci_runner_machines_on_patch_version_trigram ON ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id); + CREATE UNIQUE INDEX index_ci_runner_machines_on_runner_id_and_system_xid ON ci_runner_machines USING btree (runner_id, system_xid); CREATE INDEX index_ci_runner_machines_on_version ON ci_runner_machines USING btree (version); @@ -31893,8 +32177,6 @@ CREATE INDEX index_ci_secure_files_on_project_id ON ci_secure_files USING btree CREATE INDEX index_ci_sources_pipelines_on_pipeline_id ON ci_sources_pipelines USING btree (pipeline_id); -CREATE INDEX index_ci_sources_pipelines_on_pipeline_id_bigint ON ci_sources_pipelines USING btree (pipeline_id_convert_to_bigint); - CREATE INDEX index_ci_sources_pipelines_on_project_id ON ci_sources_pipelines USING btree (project_id); CREATE INDEX index_ci_sources_pipelines_on_source_job_id ON ci_sources_pipelines USING btree (source_job_id); @@ -31903,8 +32185,6 @@ CREATE INDEX index_ci_sources_pipelines_on_source_partition_id_source_job_id ON CREATE INDEX index_ci_sources_pipelines_on_source_pipeline_id ON ci_sources_pipelines USING btree (source_pipeline_id); -CREATE INDEX index_ci_sources_pipelines_on_source_pipeline_id_bigint ON ci_sources_pipelines USING btree (source_pipeline_id_convert_to_bigint); - CREATE INDEX index_ci_sources_pipelines_on_source_project_id ON ci_sources_pipelines USING btree (source_project_id); CREATE INDEX index_ci_sources_projects_on_pipeline_id ON ci_sources_projects USING btree (pipeline_id); @@ -32293,6 +32573,8 @@ CREATE INDEX index_environments_on_state_and_auto_delete_at ON environments USIN CREATE INDEX index_environments_on_state_and_auto_stop_at ON environments USING btree (state, auto_stop_at) WHERE ((auto_stop_at IS NOT NULL) AND ((state)::text = 'available'::text)); +CREATE INDEX index_environments_on_updated_at_for_stopping_state ON environments USING btree (updated_at) WHERE ((state)::text = 'stopping'::text); + CREATE UNIQUE INDEX index_epic_board_list_preferences_on_user_and_list ON boards_epic_list_user_preferences USING btree (user_id, epic_list_id); CREATE UNIQUE INDEX index_epic_board_recent_visits_on_user_group_and_board ON boards_epic_board_recent_visits USING btree (user_id, group_id, epic_board_id); @@ -32633,8 +32915,6 @@ CREATE INDEX index_imported_projects_on_import_type_id ON projects USING btree ( CREATE INDEX index_in_product_marketing_emails_on_track_series_id_clicked ON in_product_marketing_emails USING btree (track, series, id, cta_clicked_at); -CREATE UNIQUE INDEX index_in_product_marketing_emails_on_user_campaign ON in_product_marketing_emails USING btree (user_id, campaign); - CREATE INDEX index_in_product_marketing_emails_on_user_id ON in_product_marketing_emails USING btree (user_id); CREATE UNIQUE INDEX index_in_product_marketing_emails_on_user_track_series ON in_product_marketing_emails USING btree (user_id, track, series); @@ -32929,8 +33209,6 @@ CREATE INDEX index_members_on_user_id_and_access_level_requested_at_is_null ON m CREATE INDEX index_members_on_user_id_created_at ON members USING btree (user_id, created_at) WHERE ((ldap = true) AND ((type)::text = 'GroupMember'::text) AND ((source_type)::text = 'Namespace'::text)); -CREATE INDEX index_merge_request_assignees_on_merge_request_id ON merge_request_assignees USING btree (merge_request_id); - CREATE UNIQUE INDEX index_merge_request_assignees_on_merge_request_id_and_user_id ON merge_request_assignees USING btree (merge_request_id, user_id); CREATE INDEX index_merge_request_assignees_on_user_id ON merge_request_assignees USING btree (user_id); @@ -32983,8 +33261,6 @@ CREATE INDEX index_merge_request_metrics_on_merged_by_id ON merge_request_metric CREATE INDEX index_merge_request_metrics_on_pipeline_id ON merge_request_metrics USING btree (pipeline_id); -CREATE INDEX index_merge_request_metrics_on_target_project_id ON merge_request_metrics USING btree (target_project_id); - CREATE INDEX index_merge_request_review_llm_summaries_on_mr_diff_id ON merge_request_review_llm_summaries USING btree (merge_request_diff_id); CREATE INDEX index_merge_request_review_llm_summaries_on_review_id ON merge_request_review_llm_summaries USING btree (review_id); @@ -33107,6 +33383,8 @@ CREATE INDEX index_ml_candidates_on_ci_build_id ON ml_candidates USING btree (ci CREATE UNIQUE INDEX index_ml_candidates_on_experiment_id_and_eid ON ml_candidates USING btree (experiment_id, eid); +CREATE UNIQUE INDEX index_ml_candidates_on_model_version_id ON ml_candidates USING btree (model_version_id); + CREATE INDEX index_ml_candidates_on_package_id ON ml_candidates USING btree (package_id); CREATE INDEX index_ml_candidates_on_project_id ON ml_candidates USING btree (project_id); @@ -33135,6 +33413,8 @@ CREATE INDEX index_ml_models_on_project_id ON ml_models USING btree (project_id) CREATE UNIQUE INDEX index_ml_models_on_project_id_and_name ON ml_models USING btree (project_id, name); +CREATE INDEX index_ml_models_on_user_id ON ml_models USING btree (user_id); + CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id); CREATE INDEX index_mr_cleanup_schedules_timestamps_status ON merge_request_cleanup_schedules USING btree (scheduled_at) WHERE ((completed_at IS NULL) AND (status = 0)); @@ -33193,8 +33473,6 @@ CREATE INDEX index_namespaces_on_require_two_factor_authentication ON namespaces CREATE UNIQUE INDEX index_namespaces_on_runners_token_encrypted ON namespaces USING btree (runners_token_encrypted); -CREATE INDEX index_namespaces_on_shared_and_extra_runners_minutes_limit ON namespaces USING btree (shared_runners_minutes_limit, extra_shared_runners_minutes_limit); - CREATE INDEX index_namespaces_on_traversal_ids ON namespaces USING gin (traversal_ids); CREATE INDEX index_namespaces_on_traversal_ids_for_groups ON namespaces USING gin (traversal_ids) WHERE ((type)::text = 'Group'::text); @@ -33307,8 +33585,6 @@ CREATE UNIQUE INDEX index_on_project_id_escalation_policy_name_unique ON inciden CREATE INDEX index_on_projects_lower_path ON projects USING btree (lower((path)::text)); -CREATE INDEX index_on_projects_path ON projects USING btree (path); - CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text)); CREATE INDEX index_on_sbom_sources_package_manager_name ON sbom_sources USING btree ((((source -> 'package_manager'::text) ->> 'name'::text))); @@ -33473,6 +33749,8 @@ CREATE INDEX index_packages_tags_on_package_id ON packages_tags USING btree (pac CREATE INDEX index_packages_tags_on_package_id_and_updated_at ON packages_tags USING btree (package_id, updated_at DESC); +CREATE INDEX index_packages_tags_on_project_id ON packages_tags USING btree (project_id); + CREATE INDEX index_pages_deployment_states_failed_verification ON pages_deployment_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3); CREATE INDEX index_pages_deployment_states_needs_verification ON pages_deployment_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3)); @@ -33587,8 +33865,6 @@ CREATE INDEX index_project_compliance_framework_settings_on_framework_id ON proj CREATE INDEX index_project_compliance_framework_settings_on_project_id ON project_compliance_framework_settings USING btree (project_id); -CREATE INDEX index_project_compliance_standards_adherence_on_namespace_id ON project_compliance_standards_adherence USING btree (namespace_id); - CREATE INDEX index_project_compliance_standards_adherence_on_project_id ON project_compliance_standards_adherence USING btree (project_id); CREATE INDEX index_project_custom_attributes_on_key_and_value ON project_custom_attributes USING btree (key, value); @@ -34049,8 +34325,6 @@ CREATE UNIQUE INDEX index_sbom_occurrences_on_uuid ON sbom_occurrences USING btr CREATE UNIQUE INDEX index_sbom_sources_on_source_type_and_source ON sbom_sources USING btree (source_type, source); -CREATE INDEX index_scan_result_policies_on_policy_configuration_id ON scan_result_policies USING btree (security_orchestration_policy_configuration_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_scan_result_policies_on_project_id ON scan_result_policies USING btree (project_id); @@ -34163,6 +34437,8 @@ CREATE INDEX index_snippet_repositories_verification_state ON snippet_repositori CREATE INDEX index_snippet_repository_storage_moves_on_snippet_id ON snippet_repository_storage_moves USING btree (snippet_id); +CREATE INDEX index_snippet_repository_storage_moves_on_state ON snippet_repository_storage_moves USING btree (state) WHERE (state = ANY (ARRAY[2, 3])); + CREATE UNIQUE INDEX index_snippet_user_mentions_on_note_id ON snippet_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); CREATE INDEX index_snippets_on_author_id ON snippets USING btree (author_id); @@ -34203,6 +34479,8 @@ CREATE INDEX index_sop_schedules_on_sop_configuration_id ON security_orchestrati CREATE INDEX index_sop_schedules_on_user_id ON security_orchestration_policy_rule_schedules USING btree (user_id); +CREATE UNIQUE INDEX index_source_package_names_on_component_and_purl ON sbom_components USING btree (component_type, source_package_name, purl_type); + CREATE INDEX index_spam_logs_on_user_id ON spam_logs USING btree (user_id); CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id); @@ -34411,7 +34689,7 @@ CREATE INDEX index_user_custom_attributes_on_key_and_value ON user_custom_attrib CREATE UNIQUE INDEX index_user_custom_attributes_on_user_id_and_key ON user_custom_attributes USING btree (user_id, key); -CREATE INDEX index_user_details_on_enterprise_group_id ON user_details USING btree (enterprise_group_id); +CREATE INDEX index_user_details_on_enterprise_group_id_and_user_id ON user_details USING btree (enterprise_group_id, user_id); CREATE INDEX index_user_details_on_password_last_changed_at ON user_details USING btree (password_last_changed_at); @@ -34433,6 +34711,8 @@ CREATE INDEX index_user_namespace_callouts_on_namespace_id ON user_namespace_cal CREATE INDEX index_user_permission_export_uploads_on_user_id_and_status ON user_permission_export_uploads USING btree (user_id, status); +CREATE INDEX index_user_phone_number_validations_on_telesign_reference_xid ON user_phone_number_validations USING btree (telesign_reference_xid); + CREATE INDEX index_user_phone_validations_on_dial_code_phone_number ON user_phone_number_validations USING btree (international_dial_code, phone_number); CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled); @@ -34523,8 +34803,6 @@ 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 INDEX index_vs_code_settings_on_user_id ON vs_code_settings USING btree (user_id); - CREATE UNIQUE INDEX index_vuln_findings_on_uuid_including_vuln_id_1 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); @@ -34783,6 +35061,16 @@ CREATE INDEX index_zentao_tracker_data_on_integration_id ON zentao_tracker_data CREATE INDEX index_zoekt_indexed_namespaces_on_namespace_id ON zoekt_indexed_namespaces USING btree (namespace_id); +CREATE UNIQUE INDEX index_zoekt_node_and_namespace ON zoekt_indexed_namespaces USING btree (zoekt_node_id, namespace_id); + +CREATE UNIQUE INDEX index_zoekt_nodes_on_index_base_url ON zoekt_nodes USING btree (index_base_url); + +CREATE INDEX index_zoekt_nodes_on_last_seen_at ON zoekt_nodes USING btree (last_seen_at); + +CREATE UNIQUE INDEX index_zoekt_nodes_on_search_base_url ON zoekt_nodes USING btree (search_base_url); + +CREATE UNIQUE INDEX index_zoekt_nodes_on_uuid ON zoekt_nodes USING btree (uuid); + CREATE UNIQUE INDEX index_zoekt_shard_and_namespace ON zoekt_indexed_namespaces USING btree (zoekt_shard_id, namespace_id); CREATE UNIQUE INDEX index_zoekt_shards_on_index_base_url ON zoekt_shards USING btree (index_base_url); @@ -34837,8 +35125,6 @@ CREATE UNIQUE INDEX partial_index_bulk_import_exports_on_project_id_and_relation CREATE INDEX partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs ON ci_builds USING btree (scheduled_at) WHERE ((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text)); -CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON deployments USING btree (id) WHERE ((finished_at IS NULL) AND (status = 2)); - CREATE INDEX partial_index_slack_integrations_with_bot_user_id ON slack_integrations USING btree (id) WHERE (bot_user_id IS NOT NULL); CREATE UNIQUE INDEX partial_index_sop_configs_on_namespace_id ON security_orchestration_policy_configurations USING btree (namespace_id) WHERE (namespace_id IS NOT NULL); @@ -34889,7 +35175,11 @@ CREATE INDEX tmp_idx_orphaned_approval_merge_request_rules ON approval_merge_req 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_protected_branch_merge_access_levels_on_id_with_group ON protected_branch_merge_access_levels USING btree (id) WHERE (group_id IS NOT NULL); + +CREATE INDEX tmp_idx_protected_branch_push_access_levels_on_id_with_group ON protected_branch_push_access_levels USING btree (id) WHERE (group_id IS NOT NULL); + +CREATE INDEX tmp_idx_protected_tag_create_access_levels_on_id_with_group ON protected_tag_create_access_levels USING btree (id) WHERE (group_id IS NOT NULL); 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)); @@ -34941,10 +35231,16 @@ CREATE UNIQUE INDEX unique_amazon_s3_configurations_namespace_id_and_name ON aud CREATE UNIQUE INDEX unique_any_approver_merge_request_rule_type_post_merge ON approval_merge_request_rules USING btree (merge_request_id, rule_type, applicable_post_merge) WHERE (rule_type = 4); +CREATE UNIQUE INDEX unique_audit_events_group_namespace_filters_destination_id ON audit_events_streaming_http_group_namespace_filters USING btree (external_audit_event_destination_id); + +CREATE UNIQUE INDEX unique_audit_events_group_namespace_filters_namespace_id ON audit_events_streaming_http_group_namespace_filters USING btree (namespace_id); + CREATE UNIQUE INDEX unique_batched_background_migrations_queued_migration_version ON batched_background_migrations USING btree (queued_migration_version); CREATE UNIQUE INDEX unique_ci_builds_token_encrypted_and_partition_id ON ci_builds USING btree (token_encrypted, partition_id) WHERE (token_encrypted IS NOT NULL); +CREATE UNIQUE INDEX unique_compliance_framework_security_policies_framework_id ON compliance_framework_security_policies USING btree (framework_id, policy_configuration_id, policy_index); + CREATE UNIQUE INDEX unique_external_audit_event_destination_namespace_id_and_name ON audit_events_external_audit_event_destinations USING btree (namespace_id, name); CREATE UNIQUE INDEX unique_google_cloud_logging_configurations_on_namespace_id ON audit_events_google_cloud_logging_configurations USING btree (namespace_id, google_project_id_name, log_id_name); @@ -34955,6 +35251,8 @@ CREATE UNIQUE INDEX unique_index_ci_build_pending_states_on_partition_id_build_i CREATE UNIQUE INDEX unique_index_for_project_pages_unique_domain ON project_settings USING btree (pages_unique_domain) WHERE (pages_unique_domain IS NOT NULL); +CREATE UNIQUE INDEX unique_index_ml_model_metadata_name ON ml_model_metadata USING btree (model_id, name); + CREATE UNIQUE INDEX unique_index_on_system_note_metadata_id ON resource_link_events USING btree (system_note_metadata_id); CREATE UNIQUE INDEX unique_index_sysaccess_ms_access_tokens_on_sysaccess_ms_app_id ON system_access_microsoft_graph_access_tokens USING btree (system_access_microsoft_application_id); @@ -34985,6 +35283,8 @@ CREATE UNIQUE INDEX unique_streaming_event_type_filters_destination_id ON audit_ CREATE UNIQUE INDEX unique_streaming_instance_event_type_filters_destination_id ON audit_events_streaming_instance_event_type_filters USING btree (instance_external_audit_event_destination_id, audit_event_type); +CREATE UNIQUE INDEX unique_user_id_and_setting_type ON vs_code_settings USING btree (user_id, setting_type); + CREATE UNIQUE INDEX unique_vuln_merge_request_link_vuln_id_and_mr_id ON vulnerability_merge_request_links USING btree (vulnerability_id, merge_request_id); CREATE UNIQUE INDEX unique_zoekt_shards_uuid ON zoekt_shards USING btree (uuid); @@ -36627,24 +36927,18 @@ CREATE TRIGGER tags_loose_fk_trigger AFTER DELETE ON tags REFERENCING OLD TABLE CREATE TRIGGER trigger_07bc3c48f407 BEFORE INSERT OR UPDATE ON ci_stages FOR EACH ROW EXECUTE FUNCTION trigger_07bc3c48f407(); -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_10ee1357e825 BEFORE INSERT OR UPDATE ON p_ci_builds FOR EACH ROW EXECUTE FUNCTION trigger_10ee1357e825(); -CREATE TRIGGER trigger_68d7b6653c7d BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_68d7b6653c7d(); +CREATE TRIGGER trigger_1bd97da9c1a4 BEFORE INSERT OR UPDATE ON ci_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_1bd97da9c1a4(); 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_bbb95b2d6929 BEFORE INSERT OR UPDATE ON ci_project_monthly_usages FOR EACH ROW EXECUTE FUNCTION trigger_bbb95b2d6929(); - -CREATE TRIGGER trigger_bfad0e2b9c86 BEFORE INSERT OR UPDATE ON ci_pipeline_messages FOR EACH ROW EXECUTE FUNCTION trigger_bfad0e2b9c86(); - -CREATE TRIGGER trigger_c0353bbb6145 BEFORE INSERT OR UPDATE ON ci_namespace_monthly_usages FOR EACH ROW EXECUTE FUNCTION trigger_c0353bbb6145(); - 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(); +CREATE TRIGGER trigger_eaec934fe6b2 BEFORE INSERT OR UPDATE ON system_note_metadata FOR EACH ROW EXECUTE FUNCTION trigger_eaec934fe6b2(); + CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker(); CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker(); @@ -36733,15 +37027,15 @@ ALTER TABLE ONLY user_interacted_projects ALTER TABLE ONLY merge_request_assignment_events ADD CONSTRAINT fk_08f7602bfd FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; -ALTER TABLE ONLY ci_pipeline_messages - ADD CONSTRAINT fk_0946fea681 FOREIGN KEY (pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE; - ALTER TABLE ONLY remote_development_agent_configs ADD CONSTRAINT fk_0a3c0ada56 FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE; ALTER TABLE ONLY dast_sites ADD CONSTRAINT fk_0a57f2271b FOREIGN KEY (dast_site_validation_id) REFERENCES dast_site_validations(id) ON DELETE SET NULL; +ALTER TABLE ONLY approval_group_rules_protected_branches + ADD CONSTRAINT fk_0b85e6c388 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; + ALTER TABLE ONLY issue_customer_relations_contacts ADD CONSTRAINT fk_0c0037f723 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -36772,6 +37066,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 approval_group_rules + ADD CONSTRAINT fk_1485c451e3 FOREIGN KEY (scan_result_policy_id) REFERENCES scan_result_policies(id) ON DELETE CASCADE; + ALTER TABLE ONLY catalog_resource_versions ADD CONSTRAINT fk_15376d917e FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE; @@ -36814,9 +37111,6 @@ ALTER TABLE ONLY agent_project_authorizations ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_1d37cddf91 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE SET NULL; -ALTER TABLE ONLY ci_sources_pipelines - ADD CONSTRAINT fk_1df371767f FOREIGN KEY (source_pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE; - ALTER TABLE ONLY boards ADD CONSTRAINT fk_1e9a074a35 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -37021,12 +37315,18 @@ ALTER TABLE ONLY user_achievements ALTER TABLE ONLY vulnerability_reads ADD CONSTRAINT fk_4f593f6c62 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY approval_group_rules_protected_branches + ADD CONSTRAINT fk_4f85f13b20 FOREIGN KEY (approval_group_rule_id) REFERENCES approval_group_rules(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_compliance_standards_adherence ADD CONSTRAINT fk_4fd1d9d9b0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL; ALTER TABLE ONLY vulnerability_reads ADD CONSTRAINT fk_5001652292 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY approval_group_rules_groups + ADD CONSTRAINT fk_50edc8134e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY alert_management_alerts ADD CONSTRAINT fk_51ab4b6089 FOREIGN KEY (prometheus_alert_id) REFERENCES prometheus_alerts(id) ON DELETE CASCADE; @@ -37057,8 +37357,8 @@ ALTER TABLE ONLY approval_merge_request_rules ALTER TABLE ONLY deploy_keys_projects ADD CONSTRAINT fk_58a901ca7e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; -ALTER TABLE ONLY ci_pipeline_chat_data - ADD CONSTRAINT fk_5b21bde562 FOREIGN KEY (pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_tags + ADD CONSTRAINT fk_5a230894f6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; ALTER TABLE ONLY dependency_list_exports ADD CONSTRAINT fk_5b3d11e1ef FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; @@ -37105,6 +37405,9 @@ ALTER TABLE ONLY vulnerability_reads ALTER TABLE ONLY merge_requests ADD CONSTRAINT fk_641731faff FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY approval_group_rules + ADD CONSTRAINT fk_64450bea52 FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_pipeline_chat_data ADD CONSTRAINT fk_64ebfab6b3 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; @@ -37117,6 +37420,9 @@ ALTER TABLE ONLY ci_pipelines ALTER TABLE ONLY merge_requests ADD CONSTRAINT fk_6a5165a692 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; +ALTER TABLE ONLY ml_models + ADD CONSTRAINT fk_6c95e61a6e FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY projects ADD CONSTRAINT fk_6ca23af0a3 FOREIGN KEY (project_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -37255,6 +37561,9 @@ ALTER TABLE ONLY packages_package_files ALTER TABLE p_ci_builds ADD CONSTRAINT fk_87f4cefcda FOREIGN KEY (upstream_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; +ALTER TABLE ONLY approval_group_rules_users + ADD CONSTRAINT fk_888a0df3b7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_88b4d546ef FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; @@ -37294,6 +37603,9 @@ ALTER TABLE ONLY merge_request_review_llm_summaries ALTER TABLE ONLY todos ADD CONSTRAINT fk_91d1f47b13 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE; +ALTER TABLE ONLY zoekt_indexed_namespaces + ADD CONSTRAINT fk_9267f4de0c FOREIGN KEY (zoekt_node_id) REFERENCES zoekt_nodes(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_site_profiles_builds ADD CONSTRAINT fk_94e80df60e FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE; @@ -37324,6 +37636,9 @@ ALTER TABLE ONLY protected_branch_merge_access_levels ALTER TABLE ONLY notes ADD CONSTRAINT fk_99e097b079 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY approval_group_rules_users + ADD CONSTRAINT fk_9a4b673183 FOREIGN KEY (approval_group_rule_id) REFERENCES approval_group_rules(id) ON DELETE CASCADE; + ALTER TABLE ONLY import_failures ADD CONSTRAINT fk_9a9b9ba21c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -37441,6 +37756,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 compliance_framework_security_policies + ADD CONSTRAINT fk_b5df066d8f FOREIGN KEY (framework_id) REFERENCES compliance_management_frameworks(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; @@ -37510,9 +37828,6 @@ ALTER TABLE ONLY design_management_versions ALTER TABLE ONLY packages_packages ADD CONSTRAINT fk_c188f0dba4 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL; -ALTER TABLE ONLY ci_sources_pipelines - ADD CONSTRAINT fk_c1b5dc6b6f FOREIGN KEY (pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE; - ALTER TABLE ONLY sbom_occurrences ADD CONSTRAINT fk_c2a5562923 FOREIGN KEY (source_id) REFERENCES sbom_sources(id) ON DELETE CASCADE; @@ -37573,6 +37888,9 @@ ALTER TABLE ONLY todos ALTER TABLE ONLY dast_site_profiles_pipelines ADD CONSTRAINT fk_cf05cf8fe1 FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE; +ALTER TABLE ONLY compliance_framework_security_policies + ADD CONSTRAINT fk_cf3c0ac207 FOREIGN KEY (policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE; + ALTER TABLE ONLY issue_assignment_events ADD CONSTRAINT fk_cfd2073177 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -37696,6 +38014,9 @@ ALTER TABLE ONLY namespaces ALTER TABLE ONLY fork_networks ADD CONSTRAINT fk_e7b436b2b5 FOREIGN KEY (root_project_id) REFERENCES projects(id) ON DELETE SET NULL; +ALTER TABLE ONLY ml_candidates + ADD CONSTRAINT fk_e86e0bfa5a FOREIGN KEY (model_version_id) REFERENCES ml_model_versions(id) ON DELETE CASCADE; + ALTER TABLE ONLY integrations ADD CONSTRAINT fk_e8fe908a34 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -37729,6 +38050,9 @@ ALTER TABLE ONLY approval_project_rules ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_efb96ab1e2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY approval_group_rules_groups + ADD CONSTRAINT fk_efff219a48 FOREIGN KEY (approval_group_rule_id) REFERENCES approval_group_rules(id) ON DELETE CASCADE; + ALTER TABLE ONLY emails ADD CONSTRAINT fk_emails_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -37987,6 +38311,9 @@ ALTER TABLE ONLY security_orchestration_policy_rule_schedules ALTER TABLE ONLY incident_management_escalation_rules ADD CONSTRAINT fk_rails_17dbea07a6 FOREIGN KEY (policy_id) REFERENCES incident_management_escalation_policies(id) ON DELETE CASCADE; +ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters + ADD CONSTRAINT fk_rails_17f19c81df FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY cluster_providers_aws ADD CONSTRAINT fk_rails_18983d9ea4 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; @@ -38269,6 +38596,9 @@ ALTER TABLE ONLY batched_background_migration_jobs ALTER TABLE ONLY operations_strategies_user_lists ADD CONSTRAINT fk_rails_43241e8d29 FOREIGN KEY (strategy_id) REFERENCES operations_strategies(id) ON DELETE CASCADE; +ALTER TABLE ONLY activity_pub_releases_subscriptions + ADD CONSTRAINT fk_rails_4337598314 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY analytics_cycle_analytics_value_stream_settings ADD CONSTRAINT fk_rails_4360d37256 FOREIGN KEY (value_stream_id) REFERENCES analytics_cycle_analytics_group_value_streams(id) ON DELETE CASCADE; @@ -38551,6 +38881,9 @@ ALTER TABLE ONLY namespace_admin_notes ALTER TABLE ONLY ci_runner_machines ADD CONSTRAINT fk_rails_666b61f04f FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE CASCADE; +ALTER TABLE ONLY approval_group_rules + ADD CONSTRAINT fk_rails_6727675176 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY jira_imports ADD CONSTRAINT fk_rails_675d38c03b FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE SET NULL; @@ -38632,6 +38965,9 @@ ALTER TABLE ONLY dast_site_profiles ALTER TABLE ONLY merge_request_context_commit_diff_files ADD CONSTRAINT fk_rails_74a00a1787 FOREIGN KEY (merge_request_context_commit_id) REFERENCES merge_request_context_commits(id) ON DELETE CASCADE; +ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters + ADD CONSTRAINT fk_rails_74a28d2432 FOREIGN KEY (external_audit_event_destination_id) REFERENCES audit_events_external_audit_event_destinations(id) ON DELETE CASCADE; + ALTER TABLE ONLY group_crm_settings ADD CONSTRAINT fk_rails_74fdf2f13d FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -39304,6 +39640,9 @@ ALTER TABLE ONLY packages_rpm_metadata ALTER TABLE ONLY note_metadata ADD CONSTRAINT fk_rails_d853224d37 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE; +ALTER TABLE ONLY ml_model_metadata + ADD CONSTRAINT fk_rails_d907835e01 FOREIGN KEY (model_id) REFERENCES ml_models(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_request_reviewers ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; |