summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /db
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
downloadgitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/29_instance_statistics.rb26
-rw-r--r--db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb26
-rw-r--r--db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb19
-rw-r--r--db/migrate/20200226100624_requirements_add_project_fk.rb2
-rw-r--r--db/migrate/20200226100634_requirements_add_author_fk.rb2
-rw-r--r--db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb2
-rw-r--r--db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb2
-rw-r--r--db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb2
-rw-r--r--db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb2
-rw-r--r--db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb2
-rw-r--r--db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb2
-rw-r--r--db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb2
-rw-r--r--db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb2
-rw-r--r--db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb2
-rw-r--r--db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb2
-rw-r--r--db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb2
-rw-r--r--db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb2
-rw-r--r--db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb2
-rw-r--r--db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb2
-rw-r--r--db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb2
-rw-r--r--db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb2
-rw-r--r--db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb2
-rw-r--r--db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb2
-rw-r--r--db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb2
-rw-r--r--db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb2
-rw-r--r--db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb2
-rw-r--r--db/migrate/20200527135313_add_requirements_build_reference.rb2
-rw-r--r--db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb2
-rw-r--r--db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb2
-rw-r--r--db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb2
-rw-r--r--db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb2
-rw-r--r--db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb2
-rw-r--r--db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb2
-rw-r--r--db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb2
-rw-r--r--db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb2
-rw-r--r--db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb2
-rw-r--r--db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb2
-rw-r--r--db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb2
-rw-r--r--db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb2
-rw-r--r--db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb2
-rw-r--r--db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb2
-rw-r--r--db/migrate/20200813135558_create_ci_deleted_objects.rb29
-rw-r--r--db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb9
-rw-r--r--db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb2
-rw-r--r--db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb2
-rw-r--r--db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb2
-rw-r--r--db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb2
-rw-r--r--db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb2
-rw-r--r--db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb2
-rw-r--r--db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb2
-rw-r--r--db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20200907092610_add_user_id_to_group_import_states.rb26
-rw-r--r--db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb19
-rw-r--r--db/migrate/20200909040555_create_package_events.rb19
-rw-r--r--db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb9
-rw-r--r--db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb2
-rw-r--r--db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb2
-rw-r--r--db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb17
-rw-r--r--db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb21
-rw-r--r--db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb13
-rw-r--r--db/migrate/20200915134004_add_indices_to_approval_project_rules.rb25
-rw-r--r--db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb17
-rw-r--r--db/migrate/20200916151442_add_result_index_to_authentication_events.rb18
-rw-r--r--db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb12
-rw-r--r--db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb15
-rw-r--r--db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb19
-rw-r--r--db/migrate/20200921093826_add_index_to_user_preferences.rb17
-rw-r--r--db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb16
-rw-r--r--db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb9
-rw-r--r--db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb20
-rw-r--r--db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb18
-rw-r--r--db/migrate/20200922052316_create_issue_email_participants.rb32
-rw-r--r--db/migrate/20200922075244_add_compliance_framework_model.rb32
-rw-r--r--db/migrate/20200922093004_add_postgres_index_view.rb33
-rw-r--r--db/migrate/20200922133949_create_bulk_import.rb26
-rw-r--r--db/migrate/20200923071622_add_description_to_requirements.rb15
-rw-r--r--db/migrate/20200923071644_add_text_limit_to_requirements_description.rb17
-rw-r--r--db/migrate/20200923102312_update_programming_language_colors.rb21
-rw-r--r--db/migrate/20200923130057_remove_tmp_container_scanning_index.rb20
-rw-r--r--db/migrate/20200923140404_add_postgres_reindex_actions_table.rb26
-rw-r--r--db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb13
-rw-r--r--db/migrate/20200925112104_create_bulk_import_configurations.rb27
-rw-r--r--db/migrate/20200925114522_create_bulk_import_entities.rb38
-rw-r--r--db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb11
-rw-r--r--db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb17
-rw-r--r--db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb17
-rw-r--r--db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb19
-rw-r--r--db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb19
-rw-r--r--db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb20
-rw-r--r--db/migrate/20200928095732_add_state_to_dast_site_validation.rb12
-rw-r--r--db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb17
-rw-r--r--db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb20
-rw-r--r--db/migrate/20200928131934_create_required_code_owners_sections.rb26
-rw-r--r--db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb21
-rw-r--r--db/migrate/20200928203531_create_alert_management_http_integrations.rb37
-rw-r--r--db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb19
-rw-r--r--db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb21
-rw-r--r--db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb10
-rw-r--r--db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb9
-rw-r--r--db/migrate/20200930094812_update_postgres_indexes_view.rb54
-rw-r--r--db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb20
-rw-r--r--db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb9
-rw-r--r--db/migrate/20201002012659_add_issuable_sla_table.rb12
-rw-r--r--db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb17
-rw-r--r--db/migrate/20201005092703_add_namespace_column_to_frameworks.rb26
-rw-r--r--db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb39
-rw-r--r--db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb34
-rw-r--r--db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb9
-rw-r--r--db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb9
-rw-r--r--db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb19
-rw-r--r--db/migrate/20201012194936_create_saml_group_links.rb30
-rw-r--r--db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb25
-rw-r--r--db/post_migrate/20190926180443_schedule_epic_issues_after_epics_move.rb2
-rw-r--r--db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb2
-rw-r--r--db/post_migrate/20200810191256_remove_pipeline_id_from_test_reports.rb2
-rw-r--r--db/post_migrate/20200901170135_backfill_modified_column_for_approval_merge_request_rules.rb17
-rw-r--r--db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb17
-rw-r--r--db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb37
-rw-r--r--db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb80
-rw-r--r--db/post_migrate/20200910155617_backfill_jira_tracker_deployment_type.rb19
-rw-r--r--db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb17
-rw-r--r--db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb33
-rw-r--r--db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb21
-rw-r--r--db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb30
-rw-r--r--db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb23
-rw-r--r--db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb9
-rw-r--r--db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb13
-rw-r--r--db/post_migrate/20200922170907_change_index_on_pipeline_status.rb21
-rw-r--r--db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb26
-rw-r--r--db/post_migrate/20200929052138_create_initial_versions_for_pre_versioning_terraform_states.rb18
-rw-r--r--db/post_migrate/20200929113254_remove_type_from_audit_events.rb125
-rw-r--r--db/post_migrate/20200929114107_schedule_migrate_u2f_webauthn.rb31
-rw-r--r--db/post_migrate/20200930144340_set_job_waiter_ttl.rb31
-rw-r--r--db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb16
-rw-r--r--db/post_migrate/20201001101136_remove_index_on_issues_relative_position.rb18
-rw-r--r--db/post_migrate/20201002094617_remove_container_scanning_report_type_index.rb24
-rw-r--r--db/post_migrate/20201002175953_add_index_for_merged_merge_requests.rb21
-rw-r--r--db/post_migrate/20201005094331_migrate_compliance_framework_enum_to_database_framework_record.rb104
-rw-r--r--db/post_migrate/20201005153955_add_not_null_constraint_to_compliance_project_settings.rb21
-rw-r--r--db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb46
-rw-r--r--db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb30
-rw-r--r--db/post_migrate/20201015154527_add_index_on_services_for_usage_data.rb18
-rw-r--r--db/schema_migrations/202008131355581
-rw-r--r--db/schema_migrations/202008171956281
-rw-r--r--db/schema_migrations/202009011701351
-rw-r--r--db/schema_migrations/202009050132471
-rw-r--r--db/schema_migrations/202009070926101
-rw-r--r--db/schema_migrations/202009070927151
-rw-r--r--db/schema_migrations/202009080642291
-rw-r--r--db/schema_migrations/202009080948101
-rw-r--r--db/schema_migrations/202009090405551
-rw-r--r--db/schema_migrations/202009090833391
-rw-r--r--db/schema_migrations/202009091616241
-rw-r--r--db/schema_migrations/202009101556171
-rw-r--r--db/schema_migrations/202009121529431
-rw-r--r--db/schema_migrations/202009121532181
-rw-r--r--db/schema_migrations/202009121932101
-rw-r--r--db/schema_migrations/202009140701401
-rw-r--r--db/schema_migrations/202009151340041
-rw-r--r--db/schema_migrations/202009151857071
-rw-r--r--db/schema_migrations/202009151911561
-rw-r--r--db/schema_migrations/202009161350441
-rw-r--r--db/schema_migrations/202009161514421
-rw-r--r--db/schema_migrations/202009161652321
-rw-r--r--db/schema_migrations/202009171216501
-rw-r--r--db/schema_migrations/202009171358021
-rw-r--r--db/schema_migrations/202009171655251
-rw-r--r--db/schema_migrations/202009192003181
-rw-r--r--db/schema_migrations/202009192041551
-rw-r--r--db/schema_migrations/202009210938261
-rw-r--r--db/schema_migrations/202009211137221
-rw-r--r--db/schema_migrations/202009211300281
-rw-r--r--db/schema_migrations/202009211313131
-rw-r--r--db/schema_migrations/202009212032311
-rw-r--r--db/schema_migrations/202009220523161
-rw-r--r--db/schema_migrations/202009220546421
-rw-r--r--db/schema_migrations/202009220752441
-rw-r--r--db/schema_migrations/202009220930041
-rw-r--r--db/schema_migrations/202009220959541
-rw-r--r--db/schema_migrations/202009221339491
-rw-r--r--db/schema_migrations/202009221709071
-rw-r--r--db/schema_migrations/202009222317551
-rw-r--r--db/schema_migrations/202009230716221
-rw-r--r--db/schema_migrations/202009230716441
-rw-r--r--db/schema_migrations/202009231023121
-rw-r--r--db/schema_migrations/202009231300571
-rw-r--r--db/schema_migrations/202009231404041
-rw-r--r--db/schema_migrations/202009240358251
-rw-r--r--db/schema_migrations/202009251121041
-rw-r--r--db/schema_migrations/202009251145221
-rw-r--r--db/schema_migrations/202009251253211
-rw-r--r--db/schema_migrations/202009251534231
-rw-r--r--db/schema_migrations/202009251938151
-rw-r--r--db/schema_migrations/202009251939061
-rw-r--r--db/schema_migrations/202009251940061
-rw-r--r--db/schema_migrations/202009272247501
-rw-r--r--db/schema_migrations/202009280957321
-rw-r--r--db/schema_migrations/202009281004081
-rw-r--r--db/schema_migrations/202009281252581
-rw-r--r--db/schema_migrations/202009281319341
-rw-r--r--db/schema_migrations/202009281648071
-rw-r--r--db/schema_migrations/202009282035311
-rw-r--r--db/schema_migrations/202009282105241
-rw-r--r--db/schema_migrations/202009282336321
-rw-r--r--db/schema_migrations/202009290327291
-rw-r--r--db/schema_migrations/202009290521381
-rw-r--r--db/schema_migrations/202009290631591
-rw-r--r--db/schema_migrations/202009291132541
-rw-r--r--db/schema_migrations/202009291141071
-rw-r--r--db/schema_migrations/202009300948121
-rw-r--r--db/schema_migrations/202009301313431
-rw-r--r--db/schema_migrations/202009301323191
-rw-r--r--db/schema_migrations/202009301443401
-rw-r--r--db/schema_migrations/202010010221001
-rw-r--r--db/schema_migrations/202010011011361
-rw-r--r--db/schema_migrations/202010020126591
-rw-r--r--db/schema_migrations/202010020946171
-rw-r--r--db/schema_migrations/202010021759531
-rw-r--r--db/schema_migrations/202010041639181
-rw-r--r--db/schema_migrations/202010050927031
-rw-r--r--db/schema_migrations/202010050927091
-rw-r--r--db/schema_migrations/202010050927531
-rw-r--r--db/schema_migrations/202010050943311
-rw-r--r--db/schema_migrations/202010051539551
-rw-r--r--db/schema_migrations/202010060146051
-rw-r--r--db/schema_migrations/202010071152091
-rw-r--r--db/schema_migrations/202010090909541
-rw-r--r--db/schema_migrations/202010121949361
-rw-r--r--db/schema_migrations/202010141425211
-rw-r--r--db/schema_migrations/202010142053001
-rw-r--r--db/schema_migrations/202010150738081
-rw-r--r--db/schema_migrations/202010151545271
-rw-r--r--db/structure.sql527
234 files changed, 2795 insertions, 123 deletions
diff --git a/db/fixtures/development/29_instance_statistics.rb b/db/fixtures/development/29_instance_statistics.rb
index c4af13d0f4d..02afdc61339 100644
--- a/db/fixtures/development/29_instance_statistics.rb
+++ b/db/fixtures/development/29_instance_statistics.rb
@@ -3,17 +3,31 @@
require './spec/support/sidekiq_middleware'
Gitlab::Seeder.quiet do
+ chance_for_decrement = 0.1 # 10% chance that we'll generate smaller count than the previous count
+ max_increase = 10000
+ max_decrease = 1000
+
model_class = Analytics::InstanceStatistics::Measurement
- recorded_at = Date.today
- # Insert random counts for the last 10 weeks
- measurements = 10.times.flat_map do
- recorded_at = (recorded_at - 1.week).end_of_week.end_of_day - 5.minutes
+ measurements = model_class.identifiers.flat_map do |_, id|
+ recorded_at = 60.days.ago
+ current_count = rand(1_000_000)
+
+ # Insert random counts for the last 60 days
+ Array.new(60) do
+ recorded_at = (recorded_at + 1.day).end_of_day - 5.minutes
+
+ # Normally our counts should slowly increase as the gitlab instance grows.
+ # Small chance (10%) to have a slight decrease (simulating cleanups, bulk delete)
+ if rand < chance_for_decrement
+ current_count -= rand(max_decrease)
+ else
+ current_count += rand(max_increase)
+ end
- model_class.identifiers.map do |_, id|
{
recorded_at: recorded_at,
- count: rand(1_000_000),
+ count: current_count,
identifier: id
}
end
diff --git a/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb b/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb
index 94fafe214c2..18fd349df2a 100644
--- a/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb
+++ b/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb
@@ -5,22 +5,26 @@ class RemoveAnalyticsRepositoryTableFksOnProjects < ActiveRecord::Migration[5.2]
DOWNTIME = false
+ disable_ddl_transaction!
+
def up
+ # Requires ExclusiveLock on all tables. analytics_* tables are empty
with_lock_retries do
- # Requires ExclusiveLock on all tables. analytics_* tables are empty
- remove_foreign_key :analytics_repository_files, :projects
- remove_foreign_key :analytics_repository_file_edits, :projects if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment
- remove_foreign_key :analytics_repository_file_commits, :projects
+ remove_foreign_key_if_exists(:analytics_repository_files, :projects)
end
- end
- def down
with_lock_retries do
- # rubocop:disable Migration/AddConcurrentForeignKey
- add_foreign_key :analytics_repository_files, :projects, on_delete: :cascade
- add_foreign_key :analytics_repository_file_edits, :projects, on_delete: :cascade
- add_foreign_key :analytics_repository_file_commits, :projects, on_delete: :cascade
- # rubocop:enable Migration/AddConcurrentForeignKey
+ remove_foreign_key_if_exists(:analytics_repository_file_edits, :projects) if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment
end
+
+ with_lock_retries do
+ remove_foreign_key_if_exists(:analytics_repository_file_commits, :projects)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:analytics_repository_files, :projects, column: :project_id, on_delete: :cascade)
+ add_concurrent_foreign_key(:analytics_repository_file_edits, :projects, column: :project_id, on_delete: :cascade)
+ add_concurrent_foreign_key(:analytics_repository_file_commits, :projects, column: :project_id, on_delete: :cascade)
end
end
diff --git a/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb b/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb
index e3e415dd0ad..a436ad8d529 100644
--- a/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb
+++ b/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb
@@ -5,20 +5,21 @@ class RemoveAnalyticsRepositoryFilesFkOnOtherAnalyticsTables < ActiveRecord::Mig
DOWNTIME = false
+ disable_ddl_transaction!
+
def up
+ # Requires ExclusiveLock on all tables. analytics_* tables are empty
with_lock_retries do
- # Requires ExclusiveLock on all tables. analytics_* tables are empty
- remove_foreign_key :analytics_repository_file_edits, :analytics_repository_files if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment
- remove_foreign_key :analytics_repository_file_commits, :analytics_repository_files
+ remove_foreign_key_if_exists(:analytics_repository_file_edits, :analytics_repository_files) if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment
end
- end
- def down
with_lock_retries do
- # rubocop:disable Migration/AddConcurrentForeignKey
- add_foreign_key :analytics_repository_file_edits, :analytics_repository_files, on_delete: :cascade
- add_foreign_key :analytics_repository_file_commits, :analytics_repository_files, on_delete: :cascade
- # rubocop:enable Migration/AddConcurrentForeignKey
+ remove_foreign_key_if_exists(:analytics_repository_file_commits, :analytics_repository_files)
end
end
+
+ def down
+ add_concurrent_foreign_key(:analytics_repository_file_edits, :analytics_repository_files, column: :analytics_repository_file_id, on_delete: :cascade)
+ add_concurrent_foreign_key(:analytics_repository_file_commits, :analytics_repository_files, column: :analytics_repository_file_id, on_delete: :cascade)
+ end
end
diff --git a/db/migrate/20200226100624_requirements_add_project_fk.rb b/db/migrate/20200226100624_requirements_add_project_fk.rb
index 7c133e820f3..b44ce1d34ec 100644
--- a/db/migrate/20200226100624_requirements_add_project_fk.rb
+++ b/db/migrate/20200226100624_requirements_add_project_fk.rb
@@ -7,7 +7,7 @@ class RequirementsAddProjectFk < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key(:requirements, :projects, column: :project_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey
+ add_foreign_key(:requirements, :projects, column: :project_id, on_delete: :cascade)
end
end
diff --git a/db/migrate/20200226100634_requirements_add_author_fk.rb b/db/migrate/20200226100634_requirements_add_author_fk.rb
index 8e1a726bb76..b458657827f 100644
--- a/db/migrate/20200226100634_requirements_add_author_fk.rb
+++ b/db/migrate/20200226100634_requirements_add_author_fk.rb
@@ -7,7 +7,7 @@ class RequirementsAddAuthorFk < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key(:requirements, :users, column: :author_id, on_delete: :nullify) # rubocop: disable Migration/AddConcurrentForeignKey
+ add_foreign_key(:requirements, :users, column: :author_id, on_delete: :nullify)
end
end
diff --git a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
index d5b0af41d4a..ed244a7d308 100644
--- a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
+++ b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb
@@ -7,7 +7,7 @@ class AddCiSourcesProjectPipelineForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb
index 4f679bef85e..56ae2106644 100644
--- a/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb
+++ b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb
@@ -7,7 +7,7 @@ class AddCiSourcesProjectSourceProjectForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :ci_sources_projects, :projects, column: :source_project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :ci_sources_projects, :projects, column: :source_project_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb b/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb
index 23837f559d2..84b96c64658 100644
--- a/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb
+++ b/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb
@@ -7,7 +7,7 @@ class AddVulnerabilityExportProjectForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :vulnerability_exports, :projects, column: :project_id, on_delete: :cascade, index: false # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :vulnerability_exports, :projects, column: :project_id, on_delete: :cascade, index: false
end
end
diff --git a/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb b/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb
index 032577f2f2a..c4f685701b9 100644
--- a/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb
+++ b/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb
@@ -7,7 +7,7 @@ class AddVulnerabilityExportUserForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :vulnerability_exports, :users, column: :author_id, on_delete: :cascade, index: false # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :vulnerability_exports, :users, column: :author_id, on_delete: :cascade, index: false
end
end
diff --git a/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb
index 6410f530b30..654d35619e3 100644
--- a/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb
+++ b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb
@@ -7,7 +7,7 @@ class AddProjectsFkToJiraImportsTable < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :jira_imports, :projects, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :jira_imports, :projects, on_delete: :cascade
end
end
diff --git a/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb
index 0956a8e814b..429f72628e2 100644
--- a/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb
+++ b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb
@@ -7,7 +7,7 @@ class AddUsersFkToJiraImportsTable < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :jira_imports, :users, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :jira_imports, :users, on_delete: :nullify
end
end
diff --git a/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb
index ead04100a96..9bcadcb61c1 100644
--- a/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb
+++ b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb
@@ -7,7 +7,7 @@ class AddLabelsFkToJiraImportsTable < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :jira_imports, :labels, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :jira_imports, :labels, on_delete: :nullify
end
end
diff --git a/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb b/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb
index ecee028351a..144291d94be 100644
--- a/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb
+++ b/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb
@@ -7,7 +7,7 @@ class AddLockedByUserIdForeignKeyToTerraformState < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :terraform_states, :users, column: :locked_by_user_id # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :terraform_states, :users, column: :locked_by_user_id
end
end
diff --git a/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb
index 702347e5d43..91a6dbe4214 100644
--- a/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb
+++ b/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb
@@ -7,7 +7,7 @@ class AddUserIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :resource_state_events, :users, column: :user_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_state_events, :users, column: :user_id, on_delete: :nullify
end
end
diff --git a/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb
index 660c51eb3a6..b9f0fdeaa16 100644
--- a/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb
+++ b/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb
@@ -7,7 +7,7 @@ class AddIssueIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :resource_state_events, :issues, column: :issue_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_state_events, :issues, column: :issue_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb
index 4f0a689a992..3c070984f9e 100644
--- a/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb
+++ b/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb
@@ -7,7 +7,7 @@ class AddMergeRequestIdForeignKeyToResourceStateEvents < ActiveRecord::Migration
def up
with_lock_retries do
- add_foreign_key :resource_state_events, :merge_requests, column: :merge_request_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_state_events, :merge_requests, column: :merge_request_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb b/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb
index a68ce66e4a6..166ce320a23 100644
--- a/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb
+++ b/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb
@@ -7,7 +7,7 @@ class AddFkToProjectRepositoryStorageMoves < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :project_repository_storage_moves, :projects, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :project_repository_storage_moves, :projects, on_delete: :cascade
end
end
diff --git a/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb b/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb
index f71a5276dee..9071e3e17e3 100644
--- a/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb
+++ b/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb
@@ -9,7 +9,7 @@ class AddForeignKeyFromWebauthnRegistrationsToUsers < ActiveRecord::Migration[6.
def up
with_lock_retries do
- add_foreign_key :webauthn_registrations, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :webauthn_registrations, :users, column: :user_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
index 8072fe81c4a..1daa620501a 100644
--- a/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
+++ b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToEpicIdOnResourceStateEvents < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :resource_state_events, :epics, column: :epic_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_state_events, :epics, column: :epic_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb b/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb
index c2606dfb0d5..d1bb3fcc6ea 100644
--- a/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb
+++ b/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb
@@ -7,7 +7,7 @@ class AddGroupWikiRepositoriesShardIdForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :group_wiki_repositories, :shards, on_delete: :restrict # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :group_wiki_repositories, :shards, on_delete: :restrict
end
end
diff --git a/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb b/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb
index 3a4c75be3b9..40f272cc0e7 100644
--- a/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb
+++ b/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb
@@ -7,7 +7,7 @@ class AddGroupWikiRepositoriesGroupIdForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :group_wiki_repositories, :namespaces, column: :group_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :group_wiki_repositories, :namespaces, column: :group_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb b/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb
index a9fbee388c5..532133fe7f9 100644
--- a/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb
+++ b/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb
@@ -7,7 +7,7 @@ class AddAuthorForeignKeyToTestReports < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :requirements_management_test_reports, :users, column: :author_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :requirements_management_test_reports, :users, column: :author_id, on_delete: :nullify
end
end
diff --git a/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb b/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb
index 2b9b3464580..46657f9af6d 100644
--- a/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb
+++ b/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb
@@ -7,7 +7,7 @@ class AddPipelineForeignKeyToTestReports < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :requirements_management_test_reports, :ci_pipelines, column: :pipeline_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :requirements_management_test_reports, :ci_pipelines, column: :pipeline_id, on_delete: :nullify
end
end
diff --git a/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb b/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb
index 9d97c68f78f..4a6a25a8472 100644
--- a/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb
+++ b/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToUserIdOnAlertManagementAlertAssignees < ActiveRecord::Migra
def up
with_lock_retries do
- add_foreign_key :alert_management_alert_assignees, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :alert_management_alert_assignees, :users, column: :user_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb b/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb
index 1d6197edef9..77d374f08fa 100644
--- a/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb
+++ b/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToAlertIdOnAlertMangagementAlertAssignees < ActiveRecord::Mig
def up
with_lock_retries do
- add_foreign_key :alert_management_alert_assignees, :alert_management_alerts, column: :alert_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :alert_management_alert_assignees, :alert_management_alerts, column: :alert_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb b/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb
index 1cad53cb371..a11a8094823 100644
--- a/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb
+++ b/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToOpsFeatureFlagsIssues < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :operations_feature_flags_issues, :issues, column: :issue_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :operations_feature_flags_issues, :issues, column: :issue_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200527135313_add_requirements_build_reference.rb b/db/migrate/20200527135313_add_requirements_build_reference.rb
index 3385243fbdd..b492871a19b 100644
--- a/db/migrate/20200527135313_add_requirements_build_reference.rb
+++ b/db/migrate/20200527135313_add_requirements_build_reference.rb
@@ -11,7 +11,7 @@ class AddRequirementsBuildReference < ActiveRecord::Migration[6.0]
add_index :requirements_management_test_reports, :build_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex
with_lock_retries do
- add_foreign_key :requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify
end
end
diff --git a/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb b/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb
index 1c41389b15b..1809fed551a 100644
--- a/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb
+++ b/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToBuildIdOnBuildReportResults < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :ci_build_report_results, :ci_builds, column: :build_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :ci_build_report_results, :ci_builds, column: :build_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb b/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb
index da870722bc3..1857cb07b06 100644
--- a/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb
+++ b/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToProjectIdOnBuildReportResults < ActiveRecord::Migration[6.0
def up
with_lock_retries do
- add_foreign_key :ci_build_report_results, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :ci_build_report_results, :projects, column: :project_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb b/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb
index 8f60c41a9c7..cc613e0261e 100644
--- a/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb
+++ b/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb
@@ -7,7 +7,7 @@ class AddUsersForeignKeyToBoardUserPreferences < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :board_user_preferences, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :board_user_preferences, :users, column: :user_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb b/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb
index a18f0eac505..4ac978d3741 100644
--- a/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb
+++ b/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb
@@ -7,7 +7,7 @@ class AddBoardsForeignKeyToBoardUserPreferences < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :board_user_preferences, :boards, column: :board_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :board_user_preferences, :boards, column: :board_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb b/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb
index 35a250521a6..3198544d3a9 100644
--- a/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb
+++ b/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToAlertManagementAlertUserMentions < ActiveRecord::Migration[
def up
with_lock_retries do
- add_foreign_key :alert_management_alert_user_mentions, :notes, column: :note_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :alert_management_alert_user_mentions, :notes, column: :note_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb b/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb
index 8970797d3c0..01d0d8ce1d4 100644
--- a/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb
+++ b/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb
@@ -20,7 +20,7 @@ class AddSourceMergeRequestIdToResourceStateEvents < ActiveRecord::Migration[6.0
unless foreign_key_exists?(:resource_state_events, :merge_requests, column: :source_merge_request_id)
with_lock_retries do
- add_foreign_key :resource_state_events, :merge_requests, column: :source_merge_request_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_state_events, :merge_requests, column: :source_merge_request_id, on_delete: :nullify
end
end
end
diff --git a/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb
index e28405be53d..c3d95c9dfc2 100644
--- a/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb
+++ b/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb
@@ -7,7 +7,7 @@ class AddUsersFkToResourceIterationEventsTable < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :resource_iteration_events, :users, column: :user_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_iteration_events, :users, column: :user_id, on_delete: :nullify
end
end
diff --git a/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb
index adb10aaa707..b603f14f62b 100644
--- a/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb
+++ b/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb
@@ -7,7 +7,7 @@ class AddIssuesFkToResourceIterationEventsTable < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :resource_iteration_events, :issues, column: :issue_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_iteration_events, :issues, column: :issue_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb
index 8b1859bb253..e047b157a53 100644
--- a/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb
+++ b/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb
@@ -7,7 +7,7 @@ class AddMergeRequestsFkToResourceIterationEventsTable < ActiveRecord::Migration
def up
with_lock_retries do
- add_foreign_key :resource_iteration_events, :merge_requests, column: :merge_request_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_iteration_events, :merge_requests, column: :merge_request_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb
index b42c29a0634..1bb3ac7c8bd 100644
--- a/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb
+++ b/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb
@@ -7,7 +7,7 @@ class AddIterationsFkToResourceIterationEventsTable < ActiveRecord::Migration[6.
def up
with_lock_retries do
- add_foreign_key :resource_iteration_events, :sprints, column: :iteration_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :resource_iteration_events, :sprints, column: :iteration_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb b/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb
index 3961803bf52..c1a6dae242b 100644
--- a/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb
+++ b/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb
@@ -8,7 +8,7 @@ class AddForeignKeyToExperimentOnExperimentUsers < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
# There is no need to use add_concurrent_foreign_key since it's an empty table
- add_foreign_key :experiment_users, :experiments, column: :experiment_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :experiment_users, :experiments, column: :experiment_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb b/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb
index 42c337fecff..673a0bde0b1 100644
--- a/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb
+++ b/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb
@@ -8,7 +8,7 @@ class AddForeignKeyToUserOnExperimentUsers < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
# There is no need to use add_concurrent_foreign_key since it's an empty table
- add_foreign_key :experiment_users, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :experiment_users, :users, column: :user_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb b/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb
index d6c3a4fe742..5cfe0496b8d 100644
--- a/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb
+++ b/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToPipelineIdOnPipelineArtifact < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :ci_pipeline_artifacts, :ci_pipelines, column: :pipeline_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :ci_pipeline_artifacts, :ci_pipelines, column: :pipeline_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb b/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb
index 367a2774d62..fe418f4c5af 100644
--- a/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb
+++ b/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb
@@ -7,7 +7,7 @@ class AddForeignKeyToProjectIdOnPipelineArtifact < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :ci_pipeline_artifacts, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :ci_pipeline_artifacts, :projects, column: :project_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200813135558_create_ci_deleted_objects.rb b/db/migrate/20200813135558_create_ci_deleted_objects.rb
new file mode 100644
index 00000000000..5364b7fc0ce
--- /dev/null
+++ b/db/migrate/20200813135558_create_ci_deleted_objects.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateCiDeletedObjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :ci_deleted_objects, if_not_exists: true do |t|
+ t.integer :file_store, limit: 2, default: 1, null: false
+ t.datetime_with_timezone :pick_up_at, null: false, default: -> { 'now()' }, index: true
+ t.text :store_dir, null: false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # This column depends on the `file` column from `ci_job_artifacts` table
+ # which doesn't have a constraint limit on it.
+ t.text :file, null: false
+ # rubocop:enable Migration/AddLimitToTextColumns
+ end
+
+ add_text_limit(:ci_deleted_objects, :store_dir, 1024)
+ end
+
+ def down
+ drop_table :ci_deleted_objects
+ end
+end
diff --git a/db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb b/db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb
new file mode 100644
index 00000000000..71a29ae9bc5
--- /dev/null
+++ b/db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddModifiedToApprovalMergeRequestRule < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :approval_merge_request_rules, :modified_from_project_rule, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb b/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb
index eb52cadaecf..1c014573fb4 100644
--- a/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb
+++ b/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb
@@ -7,7 +7,7 @@ class BoardsEpicUserPreferencesFkBoard < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :boards_epic_user_preferences, :boards, column: :board_id, on_delete: :cascade # rubocop: disable Migration/AddConcurrentForeignKey
+ add_foreign_key :boards_epic_user_preferences, :boards, column: :board_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb b/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb
index 98d0a5b64f6..3edc3bc0ded 100644
--- a/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb
+++ b/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb
@@ -7,7 +7,7 @@ class BoardsEpicUserPreferencesFkUser < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :boards_epic_user_preferences, :users, column: :user_id, on_delete: :cascade # rubocop: disable Migration/AddConcurrentForeignKey
+ add_foreign_key :boards_epic_user_preferences, :users, column: :user_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb b/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb
index 46498f186c4..0354060b7c1 100644
--- a/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb
+++ b/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb
@@ -7,7 +7,7 @@ class BoardsEpicUserPreferencesFkEpic < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :boards_epic_user_preferences, :epics, column: :epic_id, on_delete: :cascade # rubocop: disable Migration/AddConcurrentForeignKey
+ add_foreign_key :boards_epic_user_preferences, :epics, column: :epic_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb b/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb
index dc3356375fd..73d0eea9819 100644
--- a/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb
+++ b/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb
@@ -10,7 +10,7 @@ class AddMergeRequestForeignKeyToMergeRequestReviewers < ActiveRecord::Migration
def up
with_lock_retries do
- add_foreign_key :merge_request_reviewers, :merge_requests, column: :merge_request_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :merge_request_reviewers, :merge_requests, column: :merge_request_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb b/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb
index d6c6985a668..5463c3d9846 100644
--- a/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb
+++ b/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb
@@ -10,7 +10,7 @@ class AddUserForeignKeyToMergeRequestReviewers < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :merge_request_reviewers, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :merge_request_reviewers, :users, column: :user_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb b/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb
index 612bd79a282..9d815cc75dc 100644
--- a/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb
+++ b/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb
@@ -7,7 +7,7 @@ class AddForeignKeyOnScanIdToSecurityScans < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :security_findings, :security_scans, column: :scan_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :security_findings, :security_scans, column: :scan_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb b/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb
index eb3e878c8be..015e83b59b1 100644
--- a/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb
+++ b/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb
@@ -7,7 +7,7 @@ class AddForeignKeyOnScannerIdToVulnerabilityScanners < ActiveRecord::Migration[
def up
with_lock_retries do
- add_foreign_key :security_findings, :vulnerability_scanners, column: :scanner_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :security_findings, :vulnerability_scanners, column: :scanner_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb b/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb
new file mode 100644
index 00000000000..0a6d0ce7339
--- /dev/null
+++ b/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddGolangPackageMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column(:plan_limits, :golang_max_file_size, :bigint, default: 100.megabytes, null: false)
+ end
+end
diff --git a/db/migrate/20200907092610_add_user_id_to_group_import_states.rb b/db/migrate/20200907092610_add_user_id_to_group_import_states.rb
new file mode 100644
index 00000000000..231bafeabdb
--- /dev/null
+++ b/db/migrate/20200907092610_add_user_id_to_group_import_states.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddUserIdToGroupImportStates < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:group_import_states, :user_id)
+ with_lock_retries do
+ add_column :group_import_states, :user_id, :bigint
+ end
+ end
+
+ add_concurrent_foreign_key :group_import_states, :users, column: :user_id, on_delete: :cascade
+ add_concurrent_index :group_import_states, :user_id, where: 'user_id IS NOT NULL', name: 'index_group_import_states_on_user_id'
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :group_import_states, :user_id
+ end
+ end
+end
diff --git a/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb b/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb
new file mode 100644
index 00000000000..27fc93a2c53
--- /dev/null
+++ b/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddNewSettingToNamespaceSetting < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :namespace_settings, :allow_mfa_for_subgroups, :boolean, default: true, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_settings, :allow_mfa_for_subgroups
+ end
+ end
+end
diff --git a/db/migrate/20200909040555_create_package_events.rb b/db/migrate/20200909040555_create_package_events.rb
new file mode 100644
index 00000000000..000ff051a7c
--- /dev/null
+++ b/db/migrate/20200909040555_create_package_events.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CreatePackageEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :packages_events do |t|
+ t.integer :event_type, null: false, limit: 2
+ t.integer :event_scope, null: false, limit: 2
+ t.integer :originator_type, null: false, limit: 2
+ t.bigint :originator
+ t.datetime_with_timezone :created_at, null: false
+
+ t.references :package, primary_key: false, default: nil, index: true, foreign_key: { to_table: :packages_packages, on_delete: :nullify }, type: :bigint
+ end
+ end
+end
diff --git a/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb b/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb
new file mode 100644
index 00000000000..7024cc4a263
--- /dev/null
+++ b/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddChangeReviewerMergeRequestToNotificationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :notification_settings, :change_reviewer_merge_request, :boolean
+ end
+end
diff --git a/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb b/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb
index 70418881c4f..665b9de9230 100644
--- a/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb
+++ b/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb
@@ -7,7 +7,7 @@ class AddPagesDeploymentProjectForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :pages_deployments, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :pages_deployments, :projects, column: :project_id, on_delete: :cascade
end
end
diff --git a/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb b/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb
index ece721d88d5..83f38b2fae3 100644
--- a/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb
+++ b/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb
@@ -7,7 +7,7 @@ class AddPagesDeploymentCiBuildForeignKey < ActiveRecord::Migration[6.0]
def up
with_lock_retries do
- add_foreign_key :pages_deployments, :ci_builds, column: :ci_build_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ add_foreign_key :pages_deployments, :ci_builds, column: :ci_build_id, on_delete: :nullify
end
end
diff --git a/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb b/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb
new file mode 100644
index 00000000000..b469099014d
--- /dev/null
+++ b/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RenameAdminNotificationEmailApplicationSetting < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ rename_column_concurrently :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+
+ def down
+ undo_rename_column_concurrently :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+end
diff --git a/db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb b/db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb
new file mode 100644
index 00000000000..bc2b8d4ce97
--- /dev/null
+++ b/db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddSchedulingIssuesTempIndexes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :issue_links, [:source_id], where: 'link_type = 1', name: 'tmp_idx_blocking_type_links'
+ add_concurrent_index :issue_links, [:target_id], where: 'link_type = 2', name: 'tmp_idx_blocked_by_type_links'
+ add_concurrent_index :issues, :id, where: '(state_id = 1 AND blocking_issues_count = 0)', name: 'tmp_idx_index_issues_with_outdate_blocking_count'
+ end
+
+ def down
+ remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocking_type_links')
+ remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocked_by_type_links')
+ remove_concurrent_index_by_name(:issues, 'tmp_idx_index_issues_with_outdate_blocking_count')
+ end
+end
diff --git a/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb b/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb
new file mode 100644
index 00000000000..fa787fe98b0
--- /dev/null
+++ b/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddExpirationPolicyStartedAtToContainerRepositories < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column(:container_repositories, :expiration_policy_started_at, :datetime_with_timezone)
+ end
+
+ def down
+ remove_column(:container_repositories, :expiration_policy_started_at)
+ end
+end
diff --git a/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb b/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb
new file mode 100644
index 00000000000..b7b0e1da2cb
--- /dev/null
+++ b/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb
@@ -0,0 +1,25 @@
+# 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 AddIndicesToApprovalProjectRules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ RULE_TYPE_INDEX_NAME = 'index_approval_project_rules_on_id_with_regular_type'
+ RULE_ID_INDEX_NAME = 'index_approval_project_rules_users_on_approval_project_rule_id'
+
+ def up
+ add_concurrent_index :approval_project_rules, :id, where: 'rule_type = 0', name: RULE_TYPE_INDEX_NAME
+ add_concurrent_index :approval_project_rules_users, :approval_project_rule_id, name: RULE_ID_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :approval_project_rules, :id, where: 'rule_type = 0', name: RULE_TYPE_INDEX_NAME
+ remove_concurrent_index :approval_project_rules_users, :approval_project_rule_id, name: RULE_ID_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb b/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb
new file mode 100644
index 00000000000..bec162ff888
--- /dev/null
+++ b/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddStateIdIndexToMergeRequests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id
+ end
+
+ def down
+ remove_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id
+ end
+end
diff --git a/db/migrate/20200916151442_add_result_index_to_authentication_events.rb b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb
new file mode 100644
index 00000000000..13b0521038e
--- /dev/null
+++ b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddResultIndexToAuthenticationEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_authentication_events_on_provider_user_id_created_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :authentication_events, [:provider, :user_id, :created_at], where: 'result = 1', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :authentication_events, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb b/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb
new file mode 100644
index 00000000000..9a91a5d2195
--- /dev/null
+++ b/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddDebianMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :plan_limits, :debian_max_file_size, :bigint, default: 3.gigabytes, null: false
+ end
+end
diff --git a/db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb b/db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb
new file mode 100644
index 00000000000..21259b633b1
--- /dev/null
+++ b/db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddHelpPageDocumentationUrlToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20200921113722_add_text_limit_to_help_page_documentation_url.rb
+ def change
+ add_column :application_settings, :help_page_documentation_base_url, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb b/db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb
new file mode 100644
index 00000000000..c8c856c7533
--- /dev/null
+++ b/db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddDefaultBranchNameToNamespaceSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+
+ # limit is added in 20200919204155_add_text_limit_to_namespace_settings_default_branch_name
+ #
+ def change
+ add_column :namespace_settings, :default_branch_name, :text
+ end
+
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb b/db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb
new file mode 100644
index 00000000000..174a1a9c556
--- /dev/null
+++ b/db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddTextLimitToNamespaceSettingsDefaultBranchName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :namespace_settings, :default_branch_name, 255
+ end
+
+ def down
+ # Down is required as `add_text_limit` is not reversible
+ #
+ remove_text_limit :namespace_settings, :default_branch_name
+ end
+end
diff --git a/db/migrate/20200921093826_add_index_to_user_preferences.rb b/db/migrate/20200921093826_add_index_to_user_preferences.rb
new file mode 100644
index 00000000000..78b04eb7a83
--- /dev/null
+++ b/db/migrate/20200921093826_add_index_to_user_preferences.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToUserPreferences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :user_preferences, :gitpod_enabled, name: :index_user_preferences_on_gitpod_enabled
+ end
+
+ def down
+ remove_concurrent_index :user_preferences, :gitpod_enabled, name: :index_user_preferences_on_gitpod_enabled
+ end
+end
diff --git a/db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb b/db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb
new file mode 100644
index 00000000000..a262ea559a5
--- /dev/null
+++ b/db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddTextLimitToHelpPageDocumentationUrl < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :application_settings, :help_page_documentation_base_url, 255
+ end
+
+ def down
+ remove_text_limit :application_settings, :help_page_documentation_base_url
+ end
+end
diff --git a/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb b/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb
new file mode 100644
index 00000000000..395ce43d8ac
--- /dev/null
+++ b/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddPagesDeploymentIdToPagesMetadata < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :project_pages_metadata, :pages_deployment_id, :bigint
+ end
+end
diff --git a/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb b/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb
new file mode 100644
index 00000000000..8611f3ab943
--- /dev/null
+++ b/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToPagesDeploymentIdInProjectPagesMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_project_pages_metadata_on_pages_deployment_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:project_pages_metadata, :pages_deployment_id, name: INDEX_NAME)
+ add_concurrent_foreign_key :project_pages_metadata, :pages_deployments, column: :pages_deployment_id, on_delete: :nullify
+ end
+
+ def down
+ remove_foreign_key_if_exists :project_pages_metadata, column: :pages_deployment_id
+ remove_concurrent_index_by_name(:project_pages_metadata, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb b/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb
new file mode 100644
index 00000000000..3f073e32d84
--- /dev/null
+++ b/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveDuplicateClusterAgentsIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX = 'index_cluster_agents_on_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :cluster_agents, INDEX
+ end
+
+ def down
+ add_concurrent_index :cluster_agents, :project_id, name: INDEX
+ end
+end
diff --git a/db/migrate/20200922052316_create_issue_email_participants.rb b/db/migrate/20200922052316_create_issue_email_participants.rb
new file mode 100644
index 00000000000..a8aeb9d9a5a
--- /dev/null
+++ b/db/migrate/20200922052316_create_issue_email_participants.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class CreateIssueEmailParticipants < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:issue_email_participants)
+ with_lock_retries do
+ create_table :issue_email_participants do |t|
+ t.references :issue, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.datetime_with_timezone :created_at, null: false
+ t.datetime_with_timezone :updated_at, null: false
+ t.text :email, null: false
+
+ t.index [:issue_id, :email], unique: true
+ end
+ end
+
+ add_text_limit(:issue_email_participants, :email, 255)
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :issue_email_participants
+ end
+ end
+end
diff --git a/db/migrate/20200922075244_add_compliance_framework_model.rb b/db/migrate/20200922075244_add_compliance_framework_model.rb
new file mode 100644
index 00000000000..376482d9005
--- /dev/null
+++ b/db/migrate/20200922075244_add_compliance_framework_model.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class AddComplianceFrameworkModel < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:compliance_management_frameworks)
+ with_lock_retries do
+ create_table :compliance_management_frameworks do |t|
+ t.references :group, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false, index: false
+ t.text :name, null: false
+ t.text :description, null: false
+ t.text :color, null: false
+ t.index [:group_id, :name], unique: true
+ end
+ end
+ end
+
+ add_text_limit :compliance_management_frameworks, :name, 255
+ add_text_limit :compliance_management_frameworks, :description, 255
+ add_text_limit :compliance_management_frameworks, :color, 10
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :compliance_management_frameworks
+ end
+ end
+end
diff --git a/db/migrate/20200922093004_add_postgres_index_view.rb b/db/migrate/20200922093004_add_postgres_index_view.rb
new file mode 100644
index 00000000000..c16eae4dd0b
--- /dev/null
+++ b/db/migrate/20200922093004_add_postgres_index_view.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class AddPostgresIndexView < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ execute(<<~SQL)
+ CREATE VIEW postgres_indexes AS
+ SELECT
+ pg_namespace.nspname || '.' || pg_class.relname as identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname as schema,
+ pg_class.relname as name,
+ pg_index.indisunique as unique,
+ pg_index.indisvalid as valid_index,
+ pg_class.relispartition as partitioned,
+ pg_index.indisexclusion as exclusion,
+ pg_indexes.indexdef as definition,
+ pg_relation_size(pg_class.oid) as ondisk_size_bytes
+ FROM pg_index
+ INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
+ INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname
+ WHERE pg_namespace.nspname <> 'pg_catalog'
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ DROP VIEW postgres_indexes
+ SQL
+ end
+end
diff --git a/db/migrate/20200922133949_create_bulk_import.rb b/db/migrate/20200922133949_create_bulk_import.rb
new file mode 100644
index 00000000000..29d770d13ff
--- /dev/null
+++ b/db/migrate/20200922133949_create_bulk_import.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class CreateBulkImport < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ create_table :bulk_imports do |t|
+ t.references :user, type: :integer, index: true, null: false, foreign_key: { on_delete: :cascade }
+
+ t.integer :source_type, null: false, limit: 2
+ t.integer :status, null: false, limit: 2
+
+ t.timestamps_with_timezone
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :bulk_imports
+ end
+ end
+end
diff --git a/db/migrate/20200923071622_add_description_to_requirements.rb b/db/migrate/20200923071622_add_description_to_requirements.rb
new file mode 100644
index 00000000000..b4b1250c10a
--- /dev/null
+++ b/db/migrate/20200923071622_add_description_to_requirements.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddDescriptionToRequirements < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit for description is added in 20200923071644_add_text_limit_to_requirements_description
+ # for description_html limit is not set because it's for caching purposes and
+ # its value is generated from `description`
+ def change
+ add_column :requirements, :description, :text
+ add_column :requirements, :description_html, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb b/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb
new file mode 100644
index 00000000000..0172d6bbba3
--- /dev/null
+++ b/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTextLimitToRequirementsDescription < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :requirements, :description, 10_000
+ end
+
+ def down
+ remove_text_limit :requirements, :description
+ end
+end
diff --git a/db/migrate/20200923102312_update_programming_language_colors.rb b/db/migrate/20200923102312_update_programming_language_colors.rb
new file mode 100644
index 00000000000..37233bd3148
--- /dev/null
+++ b/db/migrate/20200923102312_update_programming_language_colors.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+require 'yaml'
+
+class UpdateProgrammingLanguageColors < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ class ProgrammingLanguage < ActiveRecord::Base; end
+
+ def up
+ YAML.load_file("vendor/languages.yml").each do |name, metadata|
+ color = metadata["color"]
+ next unless color.present?
+
+ ProgrammingLanguage.where(name: name).update(color: color)
+ end
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb b/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb
new file mode 100644
index 00000000000..e9ab6f9ff15
--- /dev/null
+++ b/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class RemoveTmpContainerScanningIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'tmp_index_for_fixing_inconsistent_vulnerability_occurrences'
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME)
+ end
+
+ def down
+ # report_type: 2 container scanning
+ add_concurrent_index(:vulnerability_occurrences, :id,
+ where: "LENGTH(location_fingerprint) = 40 AND report_type = 2",
+ name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb b/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb
new file mode 100644
index 00000000000..ed37e44e201
--- /dev/null
+++ b/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddPostgresReindexActionsTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :postgres_reindex_actions, if_not_exists: true do |t|
+ t.datetime_with_timezone :action_start, null: false
+ t.datetime_with_timezone :action_end
+ t.bigint :ondisk_size_bytes_start, null: false
+ t.bigint :ondisk_size_bytes_end
+ t.integer :state, limit: 2, null: false, default: 0
+ t.text :index_identifier, null: false, index: true
+ end
+
+ add_text_limit(:postgres_reindex_actions, :index_identifier, 255)
+ end
+
+ def down
+ drop_table :postgres_reindex_actions
+ end
+end
diff --git a/db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb b/db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb
new file mode 100644
index 00000000000..588ce8fada7
--- /dev/null
+++ b/db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddOptionsToDastScannerProfile < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ PASSIVE_SCAN_ENUM_VALUE = 1
+
+ def change
+ add_column :dast_scanner_profiles, :scan_type, :integer, limit: 2, default: PASSIVE_SCAN_ENUM_VALUE, null: false
+ add_column :dast_scanner_profiles, :use_ajax_spider, :boolean, default: false, null: false
+ add_column :dast_scanner_profiles, :show_debug_messages, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20200925112104_create_bulk_import_configurations.rb b/db/migrate/20200925112104_create_bulk_import_configurations.rb
new file mode 100644
index 00000000000..b894cdeefbc
--- /dev/null
+++ b/db/migrate/20200925112104_create_bulk_import_configurations.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class CreateBulkImportConfigurations < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :bulk_import_configurations, if_not_exists: true do |t|
+ t.references :bulk_import, type: :integer, index: true, null: false, foreign_key: { on_delete: :cascade }
+
+ t.text :encrypted_url # rubocop: disable Migration/AddLimitToTextColumns
+ t.text :encrypted_url_iv # rubocop: disable Migration/AddLimitToTextColumns
+
+ t.text :encrypted_access_token # rubocop: disable Migration/AddLimitToTextColumns
+ t.text :encrypted_access_token_iv # rubocop: disable Migration/AddLimitToTextColumns
+
+ t.timestamps_with_timezone
+ end
+ end
+
+ def down
+ drop_table :bulk_import_configurations
+ end
+end
diff --git a/db/migrate/20200925114522_create_bulk_import_entities.rb b/db/migrate/20200925114522_create_bulk_import_entities.rb
new file mode 100644
index 00000000000..c78c4aee9ae
--- /dev/null
+++ b/db/migrate/20200925114522_create_bulk_import_entities.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class CreateBulkImportEntities < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :bulk_import_entities, if_not_exists: true do |t|
+ t.bigint :bulk_import_id, index: true, null: false
+ t.bigint :parent_id, index: true
+ t.bigint :namespace_id, index: true
+ t.bigint :project_id, index: true
+
+ t.integer :source_type, null: false, limit: 2
+ t.text :source_full_path, null: false
+
+ t.text :destination_name, null: false
+ t.text :destination_namespace, null: false
+
+ t.integer :status, null: false, limit: 2
+ t.text :jid
+
+ t.timestamps_with_timezone
+ end
+
+ add_text_limit(:bulk_import_entities, :source_full_path, 255)
+ add_text_limit(:bulk_import_entities, :destination_name, 255)
+ add_text_limit(:bulk_import_entities, :destination_namespace, 255)
+ add_text_limit(:bulk_import_entities, :jid, 255)
+ end
+
+ def down
+ drop_table :bulk_import_entities
+ end
+end
diff --git a/db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb b/db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb
new file mode 100644
index 00000000000..8a352fc6e9f
--- /dev/null
+++ b/db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddU2fIdToWebauthnRegistration < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ add_column :webauthn_registrations, :u2f_registration_id, :integer
+ end
+end
diff --git a/db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..fca4070d990
--- /dev/null
+++ b/db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddBulkImportForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :bulk_import_entities, :bulk_imports, column: :bulk_import_id, on_delete: :cascade
+ end
+
+ def down
+ remove_foreign_key :bulk_import_entities, column: :bulk_import_id
+ end
+end
diff --git a/db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..37e38c384b8
--- /dev/null
+++ b/db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddParentForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :bulk_import_entities, :bulk_import_entities, column: :parent_id, on_delete: :cascade
+ end
+
+ def down
+ remove_foreign_key :bulk_import_entities, column: :parent_id
+ end
+end
diff --git a/db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..13212395488
--- /dev/null
+++ b/db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddNamespaceForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :bulk_import_entities, :namespaces, column: :namespace_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :bulk_import_entities, column: :namespace_id
+ end
+ end
+end
diff --git a/db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..975f2b1ef4a
--- /dev/null
+++ b/db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddProjectForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :bulk_import_entities, :projects, column: :project_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :bulk_import_entities, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb b/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb
new file mode 100644
index 00000000000..ed4dd5b9cc1
--- /dev/null
+++ b/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddIncidentIssueTypeIndexToIssues < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INCIDENT_ISSUE_TYPE = 1
+ INDEX_NAME = 'index_issues_project_id_issue_type_incident'
+
+ def up
+ add_concurrent_index :issues, :project_id, where: "issue_type = #{INCIDENT_ISSUE_TYPE}", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:issues, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200928095732_add_state_to_dast_site_validation.rb b/db/migrate/20200928095732_add_state_to_dast_site_validation.rb
new file mode 100644
index 00000000000..7adeef54d71
--- /dev/null
+++ b/db/migrate/20200928095732_add_state_to_dast_site_validation.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddStateToDastSiteValidation < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20200928100408_add_text_limit_to_dast_site_validation_state.rb
+ def change
+ add_column :dast_site_validations, :state, :text, default: :pending, null: false
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb b/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb
new file mode 100644
index 00000000000..18bf7ee4bdc
--- /dev/null
+++ b/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTextLimitToDastSiteValidationState < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :dast_site_validations, :state, 255
+ end
+
+ def down
+ remove_text_limit :dast_site_validations, :state
+ end
+end
diff --git a/db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb b/db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb
new file mode 100644
index 00000000000..b76b826658e
--- /dev/null
+++ b/db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToU2fRegIdInWebauthnRegs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_webauthn_registrations_on_u2f_registration_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :webauthn_registrations, :u2f_registration_id, where: 'u2f_registration_id IS NOT NULL', name: INDEX_NAME
+ add_concurrent_foreign_key :webauthn_registrations, :u2f_registrations, column: :u2f_registration_id, on_delete: :cascade
+ end
+
+ def down
+ remove_foreign_key_if_exists :webauthn_registrations, column: :u2f_registration_id
+ remove_concurrent_index_by_name(:webauthn_registrations, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200928131934_create_required_code_owners_sections.rb b/db/migrate/20200928131934_create_required_code_owners_sections.rb
new file mode 100644
index 00000000000..f2dfd4007e5
--- /dev/null
+++ b/db/migrate/20200928131934_create_required_code_owners_sections.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class CreateRequiredCodeOwnersSections < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ create_table :required_code_owners_sections, if_not_exists: true do |t|
+ t.references :protected_branch, null: false, foreign_key: { on_delete: :cascade }
+ t.text :name, null: false
+ end
+ end
+
+ add_text_limit :required_code_owners_sections, :name, 1024
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :required_code_owners_sections, if_exists: true
+ end
+ end
+end
diff --git a/db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb b/db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb
new file mode 100644
index 00000000000..7bfae7377d7
--- /dev/null
+++ b/db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddIndexOnVulnerabilitiesStateCase < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_vulnerabilities_on_state_case_id'
+ STATE_ORDER_ARRAY_POSITION = 'ARRAY_POSITION(ARRAY[1, 4, 3, 2]::smallint[], state)'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerabilities, "#{STATE_ORDER_ARRAY_POSITION}, id DESC", name: INDEX_NAME
+ add_concurrent_index :vulnerabilities, "#{STATE_ORDER_ARRAY_POSITION} DESC, id DESC", name: "#{INDEX_NAME}_desc"
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerabilities, "#{INDEX_NAME}_desc"
+ remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200928203531_create_alert_management_http_integrations.rb b/db/migrate/20200928203531_create_alert_management_http_integrations.rb
new file mode 100644
index 00000000000..fe13fe400e3
--- /dev/null
+++ b/db/migrate/20200928203531_create_alert_management_http_integrations.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class CreateAlertManagementHttpIntegrations < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ UNIQUE_INDEX = 'index_http_integrations_on_active_and_project_and_endpoint'
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :alert_management_http_integrations, if_not_exists: true do |t|
+ t.timestamps_with_timezone
+ t.bigint :project_id, index: true, null: false
+ t.boolean :active, null: false, default: false
+ t.text :encrypted_token, null: false
+ t.text :encrypted_token_iv, null: false
+ t.text :endpoint_identifier, null: false
+ t.text :name, null: false
+ end
+
+ add_text_limit :alert_management_http_integrations, :encrypted_token, 255
+ add_text_limit :alert_management_http_integrations, :encrypted_token_iv, 255
+ add_text_limit :alert_management_http_integrations, :endpoint_identifier, 255
+ add_text_limit :alert_management_http_integrations, :name, 255
+
+ add_index :alert_management_http_integrations,
+ [:active, :project_id, :endpoint_identifier],
+ unique: true,
+ name: UNIQUE_INDEX,
+ where: 'active'
+ end
+
+ def down
+ drop_table :alert_management_http_integrations
+ end
+end
diff --git a/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb b/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb
new file mode 100644
index 00000000000..f59a5a0b5bb
--- /dev/null
+++ b/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddHttpIntegrationsProjectForeignKey < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :alert_management_http_integrations, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :alert_management_http_integrations, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
new file mode 100644
index 00000000000..0256d580cd6
--- /dev/null
+++ b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial".freeze
+ FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial".freeze
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :terraform_states, :verification_failure, name: FAILURE_INDEX_NAME
+ remove_concurrent_index :terraform_states, :verification_checksum, name: CHECKSUM_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :terraform_states, :verification_failure, where: "(verification_failure IS NOT NULL)", name: FAILURE_INDEX_NAME
+ add_concurrent_index :terraform_states, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: CHECKSUM_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb b/db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb
new file mode 100644
index 00000000000..2848cdf8fcd
--- /dev/null
+++ b/db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddSlaMinutesToProjectIncidentManagementSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :project_incident_management_settings, :sla_timer, :boolean, default: false
+ add_column :project_incident_management_settings, :sla_timer_minutes, :integer
+ end
+end
diff --git a/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb b/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb
new file mode 100644
index 00000000000..92d82757b79
--- /dev/null
+++ b/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddRequireAdminApprovalAfterUserSignupToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :require_admin_approval_after_user_signup, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20200930094812_update_postgres_indexes_view.rb b/db/migrate/20200930094812_update_postgres_indexes_view.rb
new file mode 100644
index 00000000000..b36ea362e6f
--- /dev/null
+++ b/db/migrate/20200930094812_update_postgres_indexes_view.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+class UpdatePostgresIndexesView < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ execute(<<~SQL)
+ CREATE OR REPLACE VIEW postgres_indexes AS
+ SELECT
+ pg_namespace.nspname || '.' || pg_class.relname as identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname as schema,
+ pg_class.relname as name,
+ pg_index.indisunique as unique,
+ pg_index.indisvalid as valid_index,
+ pg_class.relispartition as partitioned,
+ pg_index.indisexclusion as exclusion,
+ pg_indexes.indexdef as definition,
+ pg_relation_size(pg_class.oid) as ondisk_size_bytes
+ FROM pg_index
+ INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
+ INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname
+ WHERE pg_namespace.nspname <> 'pg_catalog'
+ AND pg_namespace.nspname IN (
+ current_schema(),
+ 'gitlab_partitions_dynamic',
+ 'gitlab_partitions_static'
+ )
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ CREATE OR REPLACE VIEW postgres_indexes AS
+ SELECT
+ pg_namespace.nspname || '.' || pg_class.relname as identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname as schema,
+ pg_class.relname as name,
+ pg_index.indisunique as unique,
+ pg_index.indisvalid as valid_index,
+ pg_class.relispartition as partitioned,
+ pg_index.indisexclusion as exclusion,
+ pg_indexes.indexdef as definition,
+ pg_relation_size(pg_class.oid) as ondisk_size_bytes
+ FROM pg_index
+ INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
+ INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname
+ WHERE pg_namespace.nspname <> 'pg_catalog'
+ SQL
+ end
+end
diff --git a/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb b/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb
new file mode 100644
index 00000000000..19a536f8f6e
--- /dev/null
+++ b/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIndexOnProjectIdAndShaToDeployments < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+ INDEX_NAME = 'index_deployments_on_project_id_sha'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :deployments, [:project_id, :sha], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:deployments, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb b/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb
new file mode 100644
index 00000000000..9be79974ee4
--- /dev/null
+++ b/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddApiFuzzingToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :plan_limits, "ci_max_artifact_size_api_fuzzing", :integer, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20201002012659_add_issuable_sla_table.rb b/db/migrate/20201002012659_add_issuable_sla_table.rb
new file mode 100644
index 00000000000..c43187bf93a
--- /dev/null
+++ b/db/migrate/20201002012659_add_issuable_sla_table.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddIssuableSlaTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :issuable_slas do |t|
+ t.references :issue, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
+ t.datetime_with_timezone :due_at, null: false
+ end
+ end
+end
diff --git a/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb b/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb
new file mode 100644
index 00000000000..7a59e706bf3
--- /dev/null
+++ b/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb
@@ -0,0 +1,17 @@
+class RemoveProjectIdAndIdIndexFromVulnerabilitiesTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_vulnerabilities_on_project_id_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ Gitlab::BackgroundMigration.steal('PopulateResolvedOnDefaultBranchColumn')
+ remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :vulnerabilities, [:project_id, :id], name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20201005092703_add_namespace_column_to_frameworks.rb b/db/migrate/20201005092703_add_namespace_column_to_frameworks.rb
new file mode 100644
index 00000000000..b7a9866e50b
--- /dev/null
+++ b/db/migrate/20201005092703_add_namespace_column_to_frameworks.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddNamespaceColumnToFrameworks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'idx_on_compliance_management_frameworks_namespace_id_name'
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:compliance_management_frameworks, :namespace_id)
+ add_column(:compliance_management_frameworks, :namespace_id, :integer)
+ end
+
+ add_concurrent_foreign_key(:compliance_management_frameworks, :namespaces, column: :namespace_id, on_delete: :cascade)
+ add_concurrent_index(:compliance_management_frameworks, [:namespace_id, :name], unique: true, name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:compliance_management_frameworks, INDEX_NAME)
+ remove_foreign_key_if_exists(:compliance_management_frameworks, :namespaces, column: :namespace_id)
+
+ remove_column(:compliance_management_frameworks, :namespace_id)
+ end
+end
diff --git a/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb b/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb
new file mode 100644
index 00000000000..88c019c849e
--- /dev/null
+++ b/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+class RemoveComplianceFrameworksGroupIdFk < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_compliance_management_frameworks_on_group_id_and_name'.freeze
+
+ class TmpComplianceFramework < ActiveRecord::Base
+ self.table_name = 'compliance_management_frameworks'
+
+ include EachBatch
+ end
+
+ disable_ddl_transaction!
+
+ def up
+ TmpComplianceFramework.each_batch(of: 100) do |query|
+ query.update_all('namespace_id = group_id') # Copy data in case we rolled back before...
+ end
+
+ change_column_null(:compliance_management_frameworks, :group_id, true)
+
+ remove_foreign_key_if_exists(:compliance_management_frameworks, :namespaces, column: :group_id)
+ remove_concurrent_index_by_name(:compliance_management_frameworks, INDEX_NAME)
+ end
+
+ def down
+ # This is just to make the rollback possible
+ TmpComplianceFramework.each_batch(of: 100) do |query|
+ query.update_all('group_id = namespace_id') # The group_id column is not in used at all
+ end
+
+ change_column_null(:compliance_management_frameworks, :group_id, false)
+
+ add_concurrent_foreign_key(:compliance_management_frameworks, :namespaces, column: :group_id, on_delete: :cascade)
+ add_concurrent_index(:compliance_management_frameworks, [:group_id, :name], unique: true, name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb b/db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb
new file mode 100644
index 00000000000..f9ac12dcfd2
--- /dev/null
+++ b/db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+class AddFrameworkIdToProjectFrameworkSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:project_compliance_framework_settings, :framework_id)
+ with_lock_retries do
+ add_column(:project_compliance_framework_settings, :framework_id, :bigint)
+ end
+ end
+
+ add_concurrent_index(:project_compliance_framework_settings, :framework_id)
+
+ add_concurrent_foreign_key(
+ :project_compliance_framework_settings,
+ :compliance_management_frameworks,
+ column: :framework_id,
+ on_delete: :cascade
+ )
+ end
+
+ def down
+ remove_foreign_key_if_exists(:project_compliance_framework_settings, :compliance_management_frameworks, column: :framework_id)
+
+ with_lock_retries do
+ remove_column(:project_compliance_framework_settings, :framework_id)
+ end
+ end
+end
diff --git a/db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb b/db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb
new file mode 100644
index 00000000000..f88bd177b98
--- /dev/null
+++ b/db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddAutomaticPurchasedStorageAllocationToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :automatic_purchased_storage_allocation, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb b/db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb
new file mode 100644
index 00000000000..fdef5e2f52a
--- /dev/null
+++ b/db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddLockVersionToCiBuildTraceChunk < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :ci_build_trace_chunks, :lock_version, :integer, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb b/db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb
new file mode 100644
index 00000000000..ec44d5ddcef
--- /dev/null
+++ b/db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexWithProjectIdToContainerExpirationPolicies < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'idx_container_exp_policies_on_project_id_next_run_at_enabled'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :container_expiration_policies, [:project_id, :next_run_at, :enabled], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :container_expiration_policies, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20201012194936_create_saml_group_links.rb b/db/migrate/20201012194936_create_saml_group_links.rb
new file mode 100644
index 00000000000..d47c383afef
--- /dev/null
+++ b/db/migrate/20201012194936_create_saml_group_links.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class CreateSamlGroupLinks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ create_table :saml_group_links, if_not_exists: true do |t|
+ t.integer :access_level, null: false, limit: 2
+ t.references :group, index: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false
+ t.timestamps_with_timezone
+ t.text :saml_group_name, null: false
+
+ t.index [:group_id, :saml_group_name], unique: true
+ end
+ end
+
+ add_text_limit :saml_group_links, :saml_group_name, 255
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :saml_group_links
+ end
+ end
+end
diff --git a/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb b/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
new file mode 100644
index 00000000000..ea45e82dcc4
--- /dev/null
+++ b/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class DropBackfillJiraTrackerDeploymentTypeJobs < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+ DROPPED_JOB_CLASS = 'BackfillJiraTrackerDeploymentType'.freeze
+ QUEUE = 'background_migration'.freeze
+
+ def up
+ sidekiq_queues.each do |queue|
+ queue.each do |job|
+ next unless job.args.first == DROPPED_JOB_CLASS
+
+ job.delete
+ end
+ end
+ end
+
+ def down
+ # no-op
+ end
+
+ def sidekiq_queues
+ [Sidekiq::ScheduledSet.new, Sidekiq::RetrySet.new, Sidekiq::Queue.new(QUEUE)]
+ end
+end
diff --git a/db/post_migrate/20190926180443_schedule_epic_issues_after_epics_move.rb b/db/post_migrate/20190926180443_schedule_epic_issues_after_epics_move.rb
index 86fe0f26681..113b7104209 100644
--- a/db/post_migrate/20190926180443_schedule_epic_issues_after_epics_move.rb
+++ b/db/post_migrate/20190926180443_schedule_epic_issues_after_epics_move.rb
@@ -25,7 +25,7 @@ class ScheduleEpicIssuesAfterEpicsMove < ActiveRecord::Migration[5.2]
Epic.each_batch(of: BATCH_SIZE) do |batch, index|
range = batch.pluck('MIN(id)', 'MAX(id)').first
delay = index * INTERVAL
- BackgroundMigrationWorker.perform_in(delay, MIGRATION, *range)
+ BackgroundMigrationWorker.perform_in(delay, MIGRATION, range)
end
end
diff --git a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
index 1ead10a4de6..9e606b2264b 100644
--- a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
+++ b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
@@ -66,8 +66,6 @@ class CleanupProjectsWithMissingNamespace < ActiveRecord::Migration[6.0]
end
def ensure_bio_is_assigned_to_user_details
- return if Feature.disabled?(:migrate_bio_to_user_details, default_enabled: true)
-
user_detail.bio = bio.to_s[0...255]
end
diff --git a/db/post_migrate/20200810191256_remove_pipeline_id_from_test_reports.rb b/db/post_migrate/20200810191256_remove_pipeline_id_from_test_reports.rb
index 4a5e6942371..f99629a921e 100644
--- a/db/post_migrate/20200810191256_remove_pipeline_id_from_test_reports.rb
+++ b/db/post_migrate/20200810191256_remove_pipeline_id_from_test_reports.rb
@@ -13,9 +13,7 @@ class RemovePipelineIdFromTestReports < ActiveRecord::Migration[6.0]
add_column :requirements_management_test_reports, :pipeline_id, :integer
with_lock_retries do
- # rubocop:disable Migration/AddConcurrentForeignKey
add_foreign_key :requirements_management_test_reports, :ci_pipelines, column: :pipeline_id, on_delete: :nullify
- # rubocop:enable Migration/AddConcurrentForeignKey
end
end
end
diff --git a/db/post_migrate/20200901170135_backfill_modified_column_for_approval_merge_request_rules.rb b/db/post_migrate/20200901170135_backfill_modified_column_for_approval_merge_request_rules.rb
new file mode 100644
index 00000000000..9a9866f38ec
--- /dev/null
+++ b/db/post_migrate/20200901170135_backfill_modified_column_for_approval_merge_request_rules.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class BackfillModifiedColumnForApprovalMergeRequestRules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::Migrations::BackgroundMigrationHelpers
+
+ disable_ddl_transaction!
+
+ class ApprovalMergeRequestRule < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'approval_merge_request_rules'
+ end
+
+ def change
+ queue_background_migration_jobs_by_range_at_intervals(ApprovalMergeRequestRule, 'AddModifiedToApprovalMergeRequestRule', 2.minutes, batch_size: 10_000)
+ end
+end
diff --git a/db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb b/db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb
new file mode 100644
index 00000000000..4f2edad43d8
--- /dev/null
+++ b/db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintToUserOnGroupImportStates < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint :group_import_states, :user_id, validate: false
+ end
+
+ def down
+ remove_not_null_constraint :group_import_states, :user_id
+ end
+end
diff --git a/db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb b/db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb
new file mode 100644
index 00000000000..433fa957c38
--- /dev/null
+++ b/db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class AddPartialIndexToCiBuildsTableOnUserIdName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_partial_ci_builds_on_user_id_name_parser_features'
+ FILTER_CONDITION = <<~SQL
+ (((type)::text = 'Ci::Build'::text) AND
+ ((name)::text = ANY (
+ ARRAY[
+ ('container_scanning'::character varying)::text,
+ ('dast'::character varying)::text,
+ ('dependency_scanning'::character varying)::text,
+ ('license_management'::character varying)::text,
+ ('license_scanning'::character varying)::text,
+ ('sast'::character varying)::text,
+ ('coverage_fuzzing'::character varying)::text,
+ ('secret_detection'::character varying)::text
+ ]
+ ))
+ )
+ SQL
+
+ def up
+ add_concurrent_index(:ci_builds,
+ [:user_id, :name],
+ where: FILTER_CONDITION,
+ name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_builds, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb
new file mode 100644
index 00000000000..861d9e40e77
--- /dev/null
+++ b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb
@@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+class CleanupGroupImportStatesWithNullUserId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # With BATCH_SIZE=1000 and group_import_states.count=600 on GitLab.com
+ # - 1 iteration will be run
+ # - each batch requires on average ~2500ms
+ # - 600 rows require on average ~1500ms
+ # Expected total run time: ~2500ms
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ class User < ActiveRecord::Base
+ self.table_name = 'users'
+ end
+
+ class Namespace < ActiveRecord::Base
+ self.table_name = 'namespaces'
+
+ belongs_to :owner, class_name: 'CleanupGroupImportStatesWithNullUserId::User'
+ end
+
+ class Member < ActiveRecord::Base
+ self.table_name = 'members'
+ self.inheritance_column = :_type_disabled
+
+ belongs_to :user, class_name: 'CleanupGroupImportStatesWithNullUserId::User'
+ end
+
+ class Group < Namespace
+ OWNER = 50
+
+ self.inheritance_column = :_type_disabled
+
+ def default_owner
+ owners.first || parent&.default_owner || owner
+ end
+
+ def parent
+ Group.find_by_id(parent_id)
+ end
+
+ def owners
+ Member.where(type: 'GroupMember', source_type: 'Namespace', source_id: id, requested_at: nil, access_level: OWNER).map(&:user)
+ end
+ end
+
+ class GroupImportState < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'group_import_states'
+
+ belongs_to :group, class_name: 'CleanupGroupImportStatesWithNullUserId::Group'
+ belongs_to :user, class_name: 'CleanupGroupImportStatesWithNullUserId::User'
+ end
+
+ def up
+ User.reset_column_information
+ Namespace.reset_column_information
+ Member.reset_column_information
+ Group.reset_column_information
+ GroupImportState.reset_column_information
+
+ GroupImportState.each_batch(of: BATCH_SIZE) do |batch|
+ batch.each do |group_import_state|
+ owner_id = Group.find_by_id(group_import_state.group_id)&.default_owner&.id
+
+ group_import_state.update!(user_id: owner_id) if owner_id
+ end
+ end
+
+ GroupImportState.where('user_id IS NULL').delete_all
+ end
+
+ def down
+ # no-op : can't go back to `NULL` without first dropping the `NOT NULL` constraint
+ end
+end
diff --git a/db/post_migrate/20200910155617_backfill_jira_tracker_deployment_type.rb b/db/post_migrate/20200910155617_backfill_jira_tracker_deployment_type.rb
new file mode 100644
index 00000000000..9c978a20d25
--- /dev/null
+++ b/db/post_migrate/20200910155617_backfill_jira_tracker_deployment_type.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class BackfillJiraTrackerDeploymentType < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ # no-op
+ # this migration was reverted
+ # in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45205
+ # due to https://gitlab.com/gitlab-com/gl-infra/production/-/issues/2820
+ end
+
+ def down
+ # no-op
+ # intentionally blank
+ end
+end
diff --git a/db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb b/db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb
new file mode 100644
index 00000000000..35c54b64ddf
--- /dev/null
+++ b/db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CleanupAdminNotificationEmailApplicationSettingRename < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ cleanup_concurrent_column_rename :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+
+ def down
+ undo_cleanup_concurrent_column_rename :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+end
diff --git a/db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb b/db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb
new file mode 100644
index 00000000000..ec6f6df27bc
--- /dev/null
+++ b/db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class EnsureFilledFileStoreOnPackageFiles < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ BACKGROUND_MIGRATION_CLASS = 'SetNullPackageFilesFileStoreToLocalValue'
+ BATCH_SIZE = 5_000
+ LOCAL_STORE = 1 # equal to ObjectStorage::Store::LOCAL
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ module Packages
+ class PackageFile < ActiveRecord::Base
+ self.table_name = 'packages_package_files'
+
+ include ::EachBatch
+ end
+ end
+
+ def up
+ Gitlab::BackgroundMigration.steal(BACKGROUND_MIGRATION_CLASS)
+
+ # Do a manual update in case we lost BG jobs. The expected record count should be 0 or very low.
+ Packages::PackageFile.where(file_store: nil).each_batch(of: BATCH_SIZE) do |batch, index|
+ batch.update_all(file_store: LOCAL_STORE)
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb b/db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb
new file mode 100644
index 00000000000..5e6db9cec3f
--- /dev/null
+++ b/db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ValidateNotNullFileStoreOnPackageFiles < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Remove index which was only added to fill file_store
+ INDEX_NAME = 'index_packages_package_files_file_store_is_null'
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ validate_not_null_constraint :packages_package_files, :file_store
+
+ remove_concurrent_index_by_name :packages_package_files, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :packages_package_files, :id, where: 'file_store IS NULL', name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb b/db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb
new file mode 100644
index 00000000000..0e161b5de78
--- /dev/null
+++ b/db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RemoveDuplicatedCsFindingsWithoutVulnerabilityId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 1_000
+
+ INTERVAL = 2.minutes
+
+ # 1_500 records will be deleted
+ def up
+ return unless Gitlab.com?
+
+ migration = Gitlab::BackgroundMigration::RemoveDuplicatedCsFindingsWithoutVulnerabilityId
+ migration_name = migration.to_s.demodulize
+ relation = migration::Finding.container_scanning.with_broken_fingerprint.where(vulnerability_id: nil)
+ queue_background_migration_jobs_by_range_at_intervals(relation,
+ migration_name,
+ INTERVAL,
+ batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb b/db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb
new file mode 100644
index 00000000000..35b72b4f160
--- /dev/null
+++ b/db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class UpdateIndexOnNamespacesForTypeAndId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_namespaces_on_type_partial'
+ NEW_INDEX_NAME = 'index_namespaces_on_type_and_id_partial'
+
+ def up
+ add_concurrent_index(:namespaces, [:type, :id], where: 'type IS NOT NULL', name: NEW_INDEX_NAME)
+
+ remove_concurrent_index_by_name(:namespaces, OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:namespaces, :type, where: 'type IS NOT NULL', name: OLD_INDEX_NAME)
+
+ remove_concurrent_index_by_name(:namespaces, NEW_INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb b/db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb
new file mode 100644
index 00000000000..d3e64f1f4c2
--- /dev/null
+++ b/db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class DropSnowplowIgluRegistryUrlFromApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ remove_column :application_settings, :snowplow_iglu_registry_url, :string, limit: 255
+ end
+end
diff --git a/db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb b/db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb
new file mode 100644
index 00000000000..1d01e54013d
--- /dev/null
+++ b/db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RemoveInstanceStatisticsVisibilityPrivateFromApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ remove_column :application_settings, :instance_statistics_visibility_private
+ end
+
+ def down
+ add_column :application_settings, :instance_statistics_visibility_private, :boolean, default: false, null: false
+ end
+end
diff --git a/db/post_migrate/20200922170907_change_index_on_pipeline_status.rb b/db/post_migrate/20200922170907_change_index_on_pipeline_status.rb
new file mode 100644
index 00000000000..61648788d7f
--- /dev/null
+++ b/db/post_migrate/20200922170907_change_index_on_pipeline_status.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ChangeIndexOnPipelineStatus < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX_NAME = 'index_ci_pipelines_on_status'
+ NEW_INDEX_NAME = 'index_ci_pipelines_on_status_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:status, :id], name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipelines, name: OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_pipelines, :status, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipelines, name: NEW_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb b/db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb
new file mode 100644
index 00000000000..02cc9676202
--- /dev/null
+++ b/db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class RemoveCreatedByUserIdFromClusterProvidersAws < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_cluster_providers_aws_on_created_by_user_id'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_column :cluster_providers_aws, :created_by_user_id
+ end
+ end
+
+ def down
+ unless column_exists?(:cluster_providers_aws, :created_by_user_id)
+ add_column :cluster_providers_aws, :created_by_user_id, :integer
+ end
+
+ add_concurrent_index :cluster_providers_aws, :created_by_user_id, name: INDEX_NAME
+
+ add_concurrent_foreign_key :cluster_providers_aws, :users, column: :created_by_user_id, on_delete: :nullify
+ end
+end
diff --git a/db/post_migrate/20200929052138_create_initial_versions_for_pre_versioning_terraform_states.rb b/db/post_migrate/20200929052138_create_initial_versions_for_pre_versioning_terraform_states.rb
new file mode 100644
index 00000000000..eff6ebfe5b4
--- /dev/null
+++ b/db/post_migrate/20200929052138_create_initial_versions_for_pre_versioning_terraform_states.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateInitialVersionsForPreVersioningTerraformStates < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ execute <<-SQL
+ INSERT INTO terraform_state_versions (terraform_state_id, created_at, updated_at, version, file_store, file)
+ SELECT id, NOW(), NOW(), 0, file_store, file
+ FROM terraform_states
+ WHERE versioning_enabled = FALSE
+ ON CONFLICT (terraform_state_id, version) DO NOTHING
+ SQL
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20200929113254_remove_type_from_audit_events.rb b/db/post_migrate/20200929113254_remove_type_from_audit_events.rb
new file mode 100644
index 00000000000..000dc0d2865
--- /dev/null
+++ b/db/post_migrate/20200929113254_remove_type_from_audit_events.rb
@@ -0,0 +1,125 @@
+# frozen_string_literal: true
+
+class RemoveTypeFromAuditEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::SchemaHelpers
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ SOURCE_TABLE_NAME = 'audit_events'
+ PARTITIONED_TABLE_NAME = 'audit_events_part_5fc467ac26'
+ TRIGGER_FUNCTION_NAME = 'table_sync_function_2be879775d'
+
+ def up
+ with_lock_retries do
+ remove_column SOURCE_TABLE_NAME, :type
+
+ create_trigger_function(TRIGGER_FUNCTION_NAME, replace: true) do
+ <<~SQL
+ IF (TG_OP = 'DELETE') THEN
+ DELETE FROM #{PARTITIONED_TABLE_NAME} where id = OLD.id;
+ ELSIF (TG_OP = 'UPDATE') THEN
+ UPDATE #{PARTITIONED_TABLE_NAME}
+ SET author_id = NEW.author_id,
+ entity_id = NEW.entity_id,
+ entity_type = NEW.entity_type,
+ details = NEW.details,
+ ip_address = NEW.ip_address,
+ author_name = NEW.author_name,
+ entity_path = NEW.entity_path,
+ target_details = NEW.target_details,
+ target_type = NEW.target_type,
+ target_id = NEW.target_id,
+ created_at = NEW.created_at
+ WHERE #{PARTITIONED_TABLE_NAME}.id = NEW.id;
+ ELSIF (TG_OP = 'INSERT') THEN
+ INSERT INTO #{PARTITIONED_TABLE_NAME} (id,
+ author_id,
+ entity_id,
+ entity_type,
+ details,
+ ip_address,
+ author_name,
+ entity_path,
+ target_details,
+ target_type,
+ target_id,
+ created_at)
+ VALUES (NEW.id,
+ NEW.author_id,
+ NEW.entity_id,
+ NEW.entity_type,
+ NEW.details,
+ NEW.ip_address,
+ NEW.author_name,
+ NEW.entity_path,
+ NEW.target_details,
+ NEW.target_type,
+ NEW.target_id,
+ NEW.created_at);
+ END IF;
+ RETURN NULL;
+ SQL
+ end
+
+ remove_column PARTITIONED_TABLE_NAME, :type
+ end
+ end
+
+ def down
+ with_lock_retries do
+ add_column SOURCE_TABLE_NAME, :type, :string
+ add_column PARTITIONED_TABLE_NAME, :type, :string
+
+ create_trigger_function(TRIGGER_FUNCTION_NAME, replace: true) do
+ <<~SQL
+ IF (TG_OP = 'DELETE') THEN
+ DELETE FROM #{PARTITIONED_TABLE_NAME} where id = OLD.id;
+ ELSIF (TG_OP = 'UPDATE') THEN
+ UPDATE #{PARTITIONED_TABLE_NAME}
+ SET author_id = NEW.author_id,
+ type = NEW.type,
+ entity_id = NEW.entity_id,
+ entity_type = NEW.entity_type,
+ details = NEW.details,
+ ip_address = NEW.ip_address,
+ author_name = NEW.author_name,
+ entity_path = NEW.entity_path,
+ target_details = NEW.target_details,
+ target_type = NEW.target_type,
+ target_id = NEW.target_id,
+ created_at = NEW.created_at
+ WHERE #{PARTITIONED_TABLE_NAME}.id = NEW.id;
+ ELSIF (TG_OP = 'INSERT') THEN
+ INSERT INTO #{PARTITIONED_TABLE_NAME} (id,
+ author_id,
+ type,
+ entity_id,
+ entity_type,
+ details,
+ ip_address,
+ author_name,
+ entity_path,
+ target_details,
+ target_type,
+ target_id,
+ created_at)
+ VALUES (NEW.id,
+ NEW.author_id,
+ NEW.type,
+ NEW.entity_id,
+ NEW.entity_type,
+ NEW.details,
+ NEW.ip_address,
+ NEW.author_name,
+ NEW.entity_path,
+ NEW.target_details,
+ NEW.target_type,
+ NEW.target_id,
+ NEW.created_at);
+ END IF;
+ RETURN NULL;
+ SQL
+ end
+ end
+ end
+end
diff --git a/db/post_migrate/20200929114107_schedule_migrate_u2f_webauthn.rb b/db/post_migrate/20200929114107_schedule_migrate_u2f_webauthn.rb
new file mode 100644
index 00000000000..b118ed271a2
--- /dev/null
+++ b/db/post_migrate/20200929114107_schedule_migrate_u2f_webauthn.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class ScheduleMigrateU2fWebauthn < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INTERVAL = 2.minutes.to_i
+ DOWNTIME = false
+ MIGRATION = 'MigrateU2fWebauthn'
+ BATCH_SIZE = 1_000
+
+ disable_ddl_transaction!
+
+ class U2fRegistration < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'u2f_registrations'
+ end
+
+ def up
+ say "Scheduling #{MIGRATION} background migration jobs"
+
+ queue_background_migration_jobs_by_range_at_intervals(U2fRegistration, MIGRATION, INTERVAL, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ # There is no real way back here, because
+ # a) The U2fMigrator of webauthn_ruby gem only works in one way
+ # b) This migration only pushes jobs to Sidekiq
+ end
+end
diff --git a/db/post_migrate/20200930144340_set_job_waiter_ttl.rb b/db/post_migrate/20200930144340_set_job_waiter_ttl.rb
new file mode 100644
index 00000000000..b15faa61dea
--- /dev/null
+++ b/db/post_migrate/20200930144340_set_job_waiter_ttl.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class SetJobWaiterTtl < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ SCRIPT = <<~LUA.freeze
+ if redis.call("ttl", KEYS[1]) < 0 then
+ redis.call("expire", KEYS[1], 21600)
+ end
+ LUA
+
+ def up
+ Gitlab::Redis::SharedState.with do |redis|
+ cursor_init = '0'
+ cursor = cursor_init
+
+ loop do
+ cursor, keys = redis.scan(cursor, match: 'gitlab:job_waiter:*')
+
+ redis.pipelined do |redis|
+ keys.each { |k| redis.eval(SCRIPT, keys: [k]) }
+ end
+
+ break if cursor == cursor_init
+ end
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb b/db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb
new file mode 100644
index 00000000000..35ed8c20671
--- /dev/null
+++ b/db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class ValidateDesignsFilenameTextLimit < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ validate_text_limit :design_management_designs, :filename
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20201001101136_remove_index_on_issues_relative_position.rb b/db/post_migrate/20201001101136_remove_index_on_issues_relative_position.rb
new file mode 100644
index 00000000000..605a167c0d5
--- /dev/null
+++ b/db/post_migrate/20201001101136_remove_index_on_issues_relative_position.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnIssuesRelativePosition < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_issues_on_relative_position'
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:issues, INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:issues, :relative_position, name: INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20201002094617_remove_container_scanning_report_type_index.rb b/db/post_migrate/20201002094617_remove_container_scanning_report_type_index.rb
new file mode 100644
index 00000000000..a591fc185c4
--- /dev/null
+++ b/db/post_migrate/20201002094617_remove_container_scanning_report_type_index.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class RemoveContainerScanningReportTypeIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'idx_container_scanning_findings'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME)
+ end
+
+ def down
+ # report_type: 2 container scanning
+ add_concurrent_index(
+ :vulnerability_occurrences,
+ :id,
+ where: 'report_type = 2',
+ name: INDEX_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20201002175953_add_index_for_merged_merge_requests.rb b/db/post_migrate/20201002175953_add_index_for_merged_merge_requests.rb
new file mode 100644
index 00000000000..cd663f3da89
--- /dev/null
+++ b/db/post_migrate/20201002175953_add_index_for_merged_merge_requests.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddIndexForMergedMergeRequests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'idx_merge_requests_on_merged_state'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests,
+ :id,
+ where: 'state_id = 3',
+ name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_requests, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20201005094331_migrate_compliance_framework_enum_to_database_framework_record.rb b/db/post_migrate/20201005094331_migrate_compliance_framework_enum_to_database_framework_record.rb
new file mode 100644
index 00000000000..5e261637d46
--- /dev/null
+++ b/db/post_migrate/20201005094331_migrate_compliance_framework_enum_to_database_framework_record.rb
@@ -0,0 +1,104 @@
+# frozen_string_literal: true
+
+class MigrateComplianceFrameworkEnumToDatabaseFrameworkRecord < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ class TmpComplianceFramework < ActiveRecord::Base
+ self.table_name = 'compliance_management_frameworks'
+ end
+
+ class TmpProjectSettings < ActiveRecord::Base
+ # Maps data between ComplianceManagement::ComplianceFramework::FRAMEWORKS(enum) and new ComplianceManagement::Framework model
+ ENUM_FRAMEWORK_MAPPING = {
+ 1 => {
+ name: 'GDPR',
+ description: 'General Data Protection Regulation',
+ color: '#1aaa55'
+ }.freeze,
+ 2 => {
+ name: 'HIPAA',
+ description: 'Health Insurance Portability and Accountability Act',
+ color: '#1f75cb'
+ }.freeze,
+ 3 => {
+ name: 'PCI-DSS',
+ description: 'Payment Card Industry-Data Security Standard',
+ color: '#6666c4'
+ }.freeze,
+ 4 => {
+ name: 'SOC 2',
+ description: 'Service Organization Control 2',
+ color: '#dd2b0e'
+ }.freeze,
+ 5 => {
+ name: 'SOX',
+ description: 'Sarbanes-Oxley',
+ color: '#fc9403'
+ }.freeze
+ }.freeze
+
+ self.table_name = 'project_compliance_framework_settings'
+
+ include EachBatch
+
+ def raw_compliance_framework
+ # Because we have an `enum` definition in ComplianceManagement::ComplianceFramework::ProjectSettings, this is very unlikely to fail.
+ ENUM_FRAMEWORK_MAPPING.fetch(framework).merge(namespace_id: root_namespace_id)
+ end
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ TmpComplianceFramework.reset_column_information
+ TmpProjectSettings.reset_column_information
+
+ # This is our standard recursive namespace query, we use it to determine the root_namespace_id in the same query.
+ lateral_join = <<~SQL
+ INNER JOIN LATERAL (
+ WITH RECURSIVE "base_and_ancestors" AS (
+ (
+ SELECT "ns".* FROM "namespaces" as ns WHERE "ns"."id" = projects.namespace_id
+ ) UNION
+ (
+ SELECT "ns".* FROM "namespaces" as ns, "base_and_ancestors" WHERE "ns"."id" = "base_and_ancestors"."parent_id"
+ )
+ ) SELECT "namespaces".* FROM "base_and_ancestors" AS "namespaces" WHERE parent_id IS NULL LIMIT 1) AS root_namespaces ON TRUE
+ SQL
+
+ TmpProjectSettings.each_batch(of: 100) do |query|
+ project_settings_with_root_group = query
+ .select(:project_id, :framework, 'root_namespaces.id as root_namespace_id')
+ .from("(SELECT * FROM project_compliance_framework_settings) as project_compliance_framework_settings") # this is needed for the LATERAL JOIN
+ .joins("INNER JOIN projects on projects.id = project_compliance_framework_settings.project_id")
+ .joins(lateral_join)
+ .to_a
+
+ ActiveRecord::Base.transaction do
+ raw_frameworks = project_settings_with_root_group.map(&:raw_compliance_framework)
+ TmpComplianceFramework.insert_all(raw_frameworks.uniq) # Create compliance frameworks per group
+
+ unique_namespace_ids = project_settings_with_root_group.map(&:root_namespace_id).uniq
+
+ framework_records = TmpComplianceFramework.select(:id, :namespace_id, :name).where(namespace_id: unique_namespace_ids)
+
+ project_settings_with_root_group.each do |project_setting|
+ framework = framework_records.find do |record|
+ # name is unique within a group
+ record.name == project_setting.raw_compliance_framework[:name] && record[:namespace_id] == project_setting.raw_compliance_framework[:namespace_id]
+ end
+
+ project_setting.update_column(:framework_id, framework.id)
+ end
+ end
+ end
+ end
+
+ def down
+ # data migration, no-op
+ end
+end
diff --git a/db/post_migrate/20201005153955_add_not_null_constraint_to_compliance_project_settings.rb b/db/post_migrate/20201005153955_add_not_null_constraint_to_compliance_project_settings.rb
new file mode 100644
index 00000000000..6d47cbe9f08
--- /dev/null
+++ b/db/post_migrate/20201005153955_add_not_null_constraint_to_compliance_project_settings.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintToComplianceProjectSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint(:project_compliance_framework_settings, :framework_id)
+
+ change_column_null(:compliance_management_frameworks, :namespace_id, false)
+ end
+
+ def down
+ change_column_null(:compliance_management_frameworks, :namespace_id, true)
+
+ remove_not_null_constraint(:project_compliance_framework_settings, :framework_id)
+ end
+end
diff --git a/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb b/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb
new file mode 100644
index 00000000000..61b2b2aaad5
--- /dev/null
+++ b/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+require 'set'
+
+class ScheduleSyncBlockingIssuesCount < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ BATCH_SIZE = 50
+ DELAY_INTERVAL = 120.seconds.to_i
+ MIGRATION = 'SyncBlockingIssuesCount'.freeze
+
+ disable_ddl_transaction!
+
+ class TmpIssueLink < ActiveRecord::Base
+ self.table_name = 'issue_links'
+
+ include EachBatch
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ issue_link_ids = SortedSet.new
+
+ TmpIssueLink.distinct.select(:source_id).where(link_type: 1).each_batch(of: 1000, column: :source_id) do |query|
+ issue_link_ids.merge(query.pluck(:source_id))
+ end
+
+ TmpIssueLink.distinct.select(:target_id).where(link_type: 2).each_batch(of: 1000, column: :target_id) do |query|
+ issue_link_ids.merge(query.pluck(:target_id))
+ end
+
+ issue_link_ids.each_slice(BATCH_SIZE).with_index do |items, index|
+ start_id, *, end_id = items
+
+ arguments = [start_id, end_id]
+
+ final_delay = DELAY_INTERVAL * (index + 1)
+ migrate_in(final_delay, MIGRATION, arguments)
+ end
+ end
+
+ def down
+ # NO OP
+ end
+end
diff --git a/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb b/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb
new file mode 100644
index 00000000000..7833d7c4c04
--- /dev/null
+++ b/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class ScheduleBlockedByLinksReplacement < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INTERVAL = 2.minutes
+ # at the time of writing there were 47600 blocked_by issues:
+ # estimated time is 48 batches * 2 minutes -> 100 minutes
+ BATCH_SIZE = 1000
+ MIGRATION = 'ReplaceBlockedByLinks'
+
+ disable_ddl_transaction!
+
+ class IssueLink < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'issue_links'
+ end
+
+ def up
+ relation = IssueLink.where(link_type: 2)
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ relation, MIGRATION, INTERVAL, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20201015154527_add_index_on_services_for_usage_data.rb b/db/post_migrate/20201015154527_add_index_on_services_for_usage_data.rb
new file mode 100644
index 00000000000..f85ab97420b
--- /dev/null
+++ b/db/post_migrate/20201015154527_add_index_on_services_for_usage_data.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnServicesForUsageData < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_services_on_type_id_when_active_and_project_id_not_null'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :services, [:type, :id], where: 'active = TRUE AND project_id IS NOT NULL', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :services, INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20200813135558 b/db/schema_migrations/20200813135558
new file mode 100644
index 00000000000..319f0a0b604
--- /dev/null
+++ b/db/schema_migrations/20200813135558
@@ -0,0 +1 @@
+5f7a5fa697d769f5ccc9f0a6f19a91c8935f2559e019d50895574819494baf7e \ No newline at end of file
diff --git a/db/schema_migrations/20200817195628 b/db/schema_migrations/20200817195628
new file mode 100644
index 00000000000..7d919242d89
--- /dev/null
+++ b/db/schema_migrations/20200817195628
@@ -0,0 +1 @@
+4da25ee40eabd81765b562929c819da1fc2b0f8afe1f4eefe6b769fcd8f0d4cd \ No newline at end of file
diff --git a/db/schema_migrations/20200901170135 b/db/schema_migrations/20200901170135
new file mode 100644
index 00000000000..4f0f5213a98
--- /dev/null
+++ b/db/schema_migrations/20200901170135
@@ -0,0 +1 @@
+fca99780272ca4ceb42fd38d16f67cd4a0a675ecdaf91e51c4c0728205212ed0 \ No newline at end of file
diff --git a/db/schema_migrations/20200905013247 b/db/schema_migrations/20200905013247
new file mode 100644
index 00000000000..b0926ca1d99
--- /dev/null
+++ b/db/schema_migrations/20200905013247
@@ -0,0 +1 @@
+860c45fd6293f2f8f10d7351cb5a2fbab2cc9147e56b538cb62d75469b039ef0 \ No newline at end of file
diff --git a/db/schema_migrations/20200907092610 b/db/schema_migrations/20200907092610
new file mode 100644
index 00000000000..63eecc83a3c
--- /dev/null
+++ b/db/schema_migrations/20200907092610
@@ -0,0 +1 @@
+de1051e8f2d9f042ac923686b8c61e743c695736e8c7ebfdf6f87ab1ed09a11f \ No newline at end of file
diff --git a/db/schema_migrations/20200907092715 b/db/schema_migrations/20200907092715
new file mode 100644
index 00000000000..700db177075
--- /dev/null
+++ b/db/schema_migrations/20200907092715
@@ -0,0 +1 @@
+2610104c89134b94d460a714f17c23e5e35d76147c1f25be6c02804a39725d6c \ No newline at end of file
diff --git a/db/schema_migrations/20200908064229 b/db/schema_migrations/20200908064229
new file mode 100644
index 00000000000..37958f04de8
--- /dev/null
+++ b/db/schema_migrations/20200908064229
@@ -0,0 +1 @@
+e73076f6d7540372ee16fe26dcb44e8b84dde69e27c46483ee26883e81059501 \ No newline at end of file
diff --git a/db/schema_migrations/20200908094810 b/db/schema_migrations/20200908094810
new file mode 100644
index 00000000000..a047e64107b
--- /dev/null
+++ b/db/schema_migrations/20200908094810
@@ -0,0 +1 @@
+327cd19cd6c0f273aea61ffebf10046fb7229516bc4ed28f3c0290bb3ad04755 \ No newline at end of file
diff --git a/db/schema_migrations/20200909040555 b/db/schema_migrations/20200909040555
new file mode 100644
index 00000000000..27855514146
--- /dev/null
+++ b/db/schema_migrations/20200909040555
@@ -0,0 +1 @@
+f68d29be164299e5ccf73347841d27b17f028941e37e3510d3da9d513762a17f \ No newline at end of file
diff --git a/db/schema_migrations/20200909083339 b/db/schema_migrations/20200909083339
new file mode 100644
index 00000000000..179a683412c
--- /dev/null
+++ b/db/schema_migrations/20200909083339
@@ -0,0 +1 @@
+8b2090e953e6205b65555408a88d3da7f6bce28b0baa52d1a43a3a3e8001b7e1 \ No newline at end of file
diff --git a/db/schema_migrations/20200909161624 b/db/schema_migrations/20200909161624
new file mode 100644
index 00000000000..941af468398
--- /dev/null
+++ b/db/schema_migrations/20200909161624
@@ -0,0 +1 @@
+2d7f514429e9a08ce13995feff43e221b3e2e74737ed48f81e104008d8ec24b9 \ No newline at end of file
diff --git a/db/schema_migrations/20200910155617 b/db/schema_migrations/20200910155617
new file mode 100644
index 00000000000..901b6c0545c
--- /dev/null
+++ b/db/schema_migrations/20200910155617
@@ -0,0 +1 @@
+6cba0aecae495458b3b161999417cb9d790e60b4edfb10bb26b9684d466e3fd2 \ No newline at end of file
diff --git a/db/schema_migrations/20200912152943 b/db/schema_migrations/20200912152943
new file mode 100644
index 00000000000..4dd1ae708cd
--- /dev/null
+++ b/db/schema_migrations/20200912152943
@@ -0,0 +1 @@
+b8d7a2ec9ecf51fd7cb9346e1484b45d5b472a85d90ad270d08c1cca1b44f039 \ No newline at end of file
diff --git a/db/schema_migrations/20200912153218 b/db/schema_migrations/20200912153218
new file mode 100644
index 00000000000..9c013281ea2
--- /dev/null
+++ b/db/schema_migrations/20200912153218
@@ -0,0 +1 @@
+fd632247f1588c537e83574edd7936c530e154091e3101d0404da3b7ef8b4bef \ No newline at end of file
diff --git a/db/schema_migrations/20200912193210 b/db/schema_migrations/20200912193210
new file mode 100644
index 00000000000..a6ce007630a
--- /dev/null
+++ b/db/schema_migrations/20200912193210
@@ -0,0 +1 @@
+bcc84e89e4e9772d3209aa8df1368c188b1c6334114bcf339870cae74e724d01 \ No newline at end of file
diff --git a/db/schema_migrations/20200914070140 b/db/schema_migrations/20200914070140
new file mode 100644
index 00000000000..b9cac3a3726
--- /dev/null
+++ b/db/schema_migrations/20200914070140
@@ -0,0 +1 @@
+8cabe224e89ef77fe4a2bc1f8bf7381faaa10d1cab4907a26aeb2162a126af52 \ No newline at end of file
diff --git a/db/schema_migrations/20200915134004 b/db/schema_migrations/20200915134004
new file mode 100644
index 00000000000..a8857de0ada
--- /dev/null
+++ b/db/schema_migrations/20200915134004
@@ -0,0 +1 @@
+dd630c76819641ad64a5f6ae40ad4f49e7fbe1c783398d97886dc7e9852a245e \ No newline at end of file
diff --git a/db/schema_migrations/20200915185707 b/db/schema_migrations/20200915185707
new file mode 100644
index 00000000000..2161aa5acf8
--- /dev/null
+++ b/db/schema_migrations/20200915185707
@@ -0,0 +1 @@
+e1ae80d6f0a6372bb329d45257d9a0a8ca5b6a83718d2a10ee295b8c4c97f60e \ No newline at end of file
diff --git a/db/schema_migrations/20200915191156 b/db/schema_migrations/20200915191156
new file mode 100644
index 00000000000..5005ee15989
--- /dev/null
+++ b/db/schema_migrations/20200915191156
@@ -0,0 +1 @@
+d8ddec6b234d59b3b85705dfa7b724d3be4974bfa57fae70aa5c2dbdd2e73cfa \ No newline at end of file
diff --git a/db/schema_migrations/20200916135044 b/db/schema_migrations/20200916135044
new file mode 100644
index 00000000000..8bb10fbb1e3
--- /dev/null
+++ b/db/schema_migrations/20200916135044
@@ -0,0 +1 @@
+299e6fb38da303f06ab006a25701ff1c58ce2abfa8cf93c3c8b866ee0b2bd1cc \ No newline at end of file
diff --git a/db/schema_migrations/20200916151442 b/db/schema_migrations/20200916151442
new file mode 100644
index 00000000000..36b2a4e9962
--- /dev/null
+++ b/db/schema_migrations/20200916151442
@@ -0,0 +1 @@
+aef52404e6ce83d5d4b3de65ad00b665334f5ff2e5b7b6c3c622f79313657f26 \ No newline at end of file
diff --git a/db/schema_migrations/20200916165232 b/db/schema_migrations/20200916165232
new file mode 100644
index 00000000000..8e97fcf3efa
--- /dev/null
+++ b/db/schema_migrations/20200916165232
@@ -0,0 +1 @@
+18a3981a3becefe6700dd5fea87e8ba9478c0e83ddc80de1b3ee2ed77c221ce6 \ No newline at end of file
diff --git a/db/schema_migrations/20200917121650 b/db/schema_migrations/20200917121650
new file mode 100644
index 00000000000..d0f26d40466
--- /dev/null
+++ b/db/schema_migrations/20200917121650
@@ -0,0 +1 @@
+3343b646d0c0ca2d92982740abe4372fb80931cb4bb4386229959d5d61c86587 \ No newline at end of file
diff --git a/db/schema_migrations/20200917135802 b/db/schema_migrations/20200917135802
new file mode 100644
index 00000000000..7b948de646b
--- /dev/null
+++ b/db/schema_migrations/20200917135802
@@ -0,0 +1 @@
+8d9e75f7c6344b03cb740fa691fcbb5bea1751802741229158701bc1af975897 \ No newline at end of file
diff --git a/db/schema_migrations/20200917165525 b/db/schema_migrations/20200917165525
new file mode 100644
index 00000000000..bf01a95ad14
--- /dev/null
+++ b/db/schema_migrations/20200917165525
@@ -0,0 +1 @@
+0080b9192ba5b4ea3853cfd930d58e10b9619f3d9a54016b574712e5ec2084f6 \ No newline at end of file
diff --git a/db/schema_migrations/20200919200318 b/db/schema_migrations/20200919200318
new file mode 100644
index 00000000000..29721a3ef2b
--- /dev/null
+++ b/db/schema_migrations/20200919200318
@@ -0,0 +1 @@
+f33c66297ca7848c576778dc275e42801f5f9d7cdcf8c4d2fb205d4eb9770937 \ No newline at end of file
diff --git a/db/schema_migrations/20200919204155 b/db/schema_migrations/20200919204155
new file mode 100644
index 00000000000..39b608deed4
--- /dev/null
+++ b/db/schema_migrations/20200919204155
@@ -0,0 +1 @@
+097cb7a36fdc831045f3a33a047f8bda6474b8165ef5fc95dbdeea45d0ac04a3 \ No newline at end of file
diff --git a/db/schema_migrations/20200921093826 b/db/schema_migrations/20200921093826
new file mode 100644
index 00000000000..4a405de5215
--- /dev/null
+++ b/db/schema_migrations/20200921093826
@@ -0,0 +1 @@
+8d14013bcb4d8302c91e331f619fb6f621ab79907aebc421d99c9484ecd7a5d8 \ No newline at end of file
diff --git a/db/schema_migrations/20200921113722 b/db/schema_migrations/20200921113722
new file mode 100644
index 00000000000..96dc1683f72
--- /dev/null
+++ b/db/schema_migrations/20200921113722
@@ -0,0 +1 @@
+723812a28afbabb6b7884fd76dcaf658c5e35a33a46e90a9a94aef12e735e604 \ No newline at end of file
diff --git a/db/schema_migrations/20200921130028 b/db/schema_migrations/20200921130028
new file mode 100644
index 00000000000..b718f21c156
--- /dev/null
+++ b/db/schema_migrations/20200921130028
@@ -0,0 +1 @@
+60835078e0a0bd191e9b1f0316f894c5223d6849277992b5034ed4ff9a798fe4 \ No newline at end of file
diff --git a/db/schema_migrations/20200921131313 b/db/schema_migrations/20200921131313
new file mode 100644
index 00000000000..559701acf69
--- /dev/null
+++ b/db/schema_migrations/20200921131313
@@ -0,0 +1 @@
+e4f9e918c86705409555cde065f30ba0c0c405dfd1918f47a169a5dc5c244a8d \ No newline at end of file
diff --git a/db/schema_migrations/20200921203231 b/db/schema_migrations/20200921203231
new file mode 100644
index 00000000000..544b7146ebf
--- /dev/null
+++ b/db/schema_migrations/20200921203231
@@ -0,0 +1 @@
+7f62ce5117a16213bad6537dfeae2af4016262c533f8fa6b7a19572077bcf8d7 \ No newline at end of file
diff --git a/db/schema_migrations/20200922052316 b/db/schema_migrations/20200922052316
new file mode 100644
index 00000000000..31bd12178ef
--- /dev/null
+++ b/db/schema_migrations/20200922052316
@@ -0,0 +1 @@
+384d022662437de21b4b3b97bf2f1dec2925be6afe4b62828c97dc9b3b3fc77c \ No newline at end of file
diff --git a/db/schema_migrations/20200922054642 b/db/schema_migrations/20200922054642
new file mode 100644
index 00000000000..443c13c256e
--- /dev/null
+++ b/db/schema_migrations/20200922054642
@@ -0,0 +1 @@
+ad63096e49440f7f2a15ea2747689ca39f52fdcebc1949a1feed82a22f432e9e \ No newline at end of file
diff --git a/db/schema_migrations/20200922075244 b/db/schema_migrations/20200922075244
new file mode 100644
index 00000000000..82a2fc5f304
--- /dev/null
+++ b/db/schema_migrations/20200922075244
@@ -0,0 +1 @@
+a8450c6c21b1182afd06c88af18c0d9be92b0e7fdc73505c07d4ab3fddd39abf \ No newline at end of file
diff --git a/db/schema_migrations/20200922093004 b/db/schema_migrations/20200922093004
new file mode 100644
index 00000000000..04dd5dbfcf6
--- /dev/null
+++ b/db/schema_migrations/20200922093004
@@ -0,0 +1 @@
+705d010620b1aa95e86c8fb5fb9175fe77778376d228003e9fd2c8d0bb20a347 \ No newline at end of file
diff --git a/db/schema_migrations/20200922095954 b/db/schema_migrations/20200922095954
new file mode 100644
index 00000000000..2282da76380
--- /dev/null
+++ b/db/schema_migrations/20200922095954
@@ -0,0 +1 @@
+c55f27f817afc60462e5dc43755a4ddd76f1399f5e461bab4b36bf5e5b26ce0a \ No newline at end of file
diff --git a/db/schema_migrations/20200922133949 b/db/schema_migrations/20200922133949
new file mode 100644
index 00000000000..8c1874198bb
--- /dev/null
+++ b/db/schema_migrations/20200922133949
@@ -0,0 +1 @@
+8196e28f6fe8cdb4cf710922b5cd218030ba587c629de7ee75dc061d05c7e1a9 \ No newline at end of file
diff --git a/db/schema_migrations/20200922170907 b/db/schema_migrations/20200922170907
new file mode 100644
index 00000000000..66ff701973d
--- /dev/null
+++ b/db/schema_migrations/20200922170907
@@ -0,0 +1 @@
+ab044b609a29e9a179813de79dab9770665917a8ed78db907755a64f2d4aa47c \ No newline at end of file
diff --git a/db/schema_migrations/20200922231755 b/db/schema_migrations/20200922231755
new file mode 100644
index 00000000000..504df45b957
--- /dev/null
+++ b/db/schema_migrations/20200922231755
@@ -0,0 +1 @@
+0019105cd2112e138b9926dc000b0c54b41fca6dfb2c4f658900040e0ecb3b70 \ No newline at end of file
diff --git a/db/schema_migrations/20200923071622 b/db/schema_migrations/20200923071622
new file mode 100644
index 00000000000..629b241ce0a
--- /dev/null
+++ b/db/schema_migrations/20200923071622
@@ -0,0 +1 @@
+1751fa6522a88582cb6a580acc95665f4e3f3a879f2365d5fd0a824ad1b4806d \ No newline at end of file
diff --git a/db/schema_migrations/20200923071644 b/db/schema_migrations/20200923071644
new file mode 100644
index 00000000000..431ed5af1f0
--- /dev/null
+++ b/db/schema_migrations/20200923071644
@@ -0,0 +1 @@
+0df2b1e65ef0dc563c55e575968e4fd768cec2e713e3b1c999cf584ef62b629d \ No newline at end of file
diff --git a/db/schema_migrations/20200923102312 b/db/schema_migrations/20200923102312
new file mode 100644
index 00000000000..52ed07034fc
--- /dev/null
+++ b/db/schema_migrations/20200923102312
@@ -0,0 +1 @@
+f19e61e3863905885c8b5b2129be2586d912d616a5b3b54e99a72c5760082059 \ No newline at end of file
diff --git a/db/schema_migrations/20200923130057 b/db/schema_migrations/20200923130057
new file mode 100644
index 00000000000..e95c2da0a1d
--- /dev/null
+++ b/db/schema_migrations/20200923130057
@@ -0,0 +1 @@
+84b272d61f6ab6e9f9f8eb059ba139a3fa0d2f1bbeb337f2e4e7cd4034822b44 \ No newline at end of file
diff --git a/db/schema_migrations/20200923140404 b/db/schema_migrations/20200923140404
new file mode 100644
index 00000000000..9c1bfd59b4c
--- /dev/null
+++ b/db/schema_migrations/20200923140404
@@ -0,0 +1 @@
+8a1898f62a47575c7ea428198163e04ff427e7ab6cd04eb9897930a6b7753681 \ No newline at end of file
diff --git a/db/schema_migrations/20200924035825 b/db/schema_migrations/20200924035825
new file mode 100644
index 00000000000..0c27ed47732
--- /dev/null
+++ b/db/schema_migrations/20200924035825
@@ -0,0 +1 @@
+d413e19c8ddaba4556cf36a38e03b1c7c46ee7edf7e56692028e066f97605784 \ No newline at end of file
diff --git a/db/schema_migrations/20200925112104 b/db/schema_migrations/20200925112104
new file mode 100644
index 00000000000..bb0f8032a84
--- /dev/null
+++ b/db/schema_migrations/20200925112104
@@ -0,0 +1 @@
+a14df9e9a115d39636b29bfe73fb175bb1e8d4510bee26e3e0c6c979949b13c4 \ No newline at end of file
diff --git a/db/schema_migrations/20200925114522 b/db/schema_migrations/20200925114522
new file mode 100644
index 00000000000..4b8d893833d
--- /dev/null
+++ b/db/schema_migrations/20200925114522
@@ -0,0 +1 @@
+7d43d2fa91e27eaf9399cf0ce9e4375e849deb71b12d4891455bc51392bce14a \ No newline at end of file
diff --git a/db/schema_migrations/20200925125321 b/db/schema_migrations/20200925125321
new file mode 100644
index 00000000000..103cd02c5e1
--- /dev/null
+++ b/db/schema_migrations/20200925125321
@@ -0,0 +1 @@
+d1d2f7d5f70e912b1d0a77417a96b9e16ffc620eb8c941ed4aa9a8c166ba26e0 \ No newline at end of file
diff --git a/db/schema_migrations/20200925153423 b/db/schema_migrations/20200925153423
new file mode 100644
index 00000000000..ffbdc2c81c2
--- /dev/null
+++ b/db/schema_migrations/20200925153423
@@ -0,0 +1 @@
+f445704e51dad2369719d8c0931c3314793fa90ba6b5a383df503ea4f6dafd20 \ No newline at end of file
diff --git a/db/schema_migrations/20200925193815 b/db/schema_migrations/20200925193815
new file mode 100644
index 00000000000..fdfa07c5a99
--- /dev/null
+++ b/db/schema_migrations/20200925193815
@@ -0,0 +1 @@
+a814b745b4911fc6c80971e6c0c19e6d64ca30cb94fa87a94bc1adf8c07b1c87 \ No newline at end of file
diff --git a/db/schema_migrations/20200925193906 b/db/schema_migrations/20200925193906
new file mode 100644
index 00000000000..dd9c1e4cd3b
--- /dev/null
+++ b/db/schema_migrations/20200925193906
@@ -0,0 +1 @@
+a915ccf5df0ec803286205916ffcd34b1410d1cc4da84f8299b63b3665d69e09 \ No newline at end of file
diff --git a/db/schema_migrations/20200925194006 b/db/schema_migrations/20200925194006
new file mode 100644
index 00000000000..fc89ebb9f7b
--- /dev/null
+++ b/db/schema_migrations/20200925194006
@@ -0,0 +1 @@
+28a71a380be0ef08389defac604c351f0a7f31b6c03a7c40aabe47bf09e6a485 \ No newline at end of file
diff --git a/db/schema_migrations/20200927224750 b/db/schema_migrations/20200927224750
new file mode 100644
index 00000000000..9454bec58c5
--- /dev/null
+++ b/db/schema_migrations/20200927224750
@@ -0,0 +1 @@
+8e0c5be3d6fe2d0d718c7b7a99d84b14dfc6006f780ec0622eb5aae937e6b367 \ No newline at end of file
diff --git a/db/schema_migrations/20200928095732 b/db/schema_migrations/20200928095732
new file mode 100644
index 00000000000..15f0d5e3eae
--- /dev/null
+++ b/db/schema_migrations/20200928095732
@@ -0,0 +1 @@
+5ff9bf6c542f686729abf18f282351d9bb5b895070c6f06c5fc8d125be4a38f7 \ No newline at end of file
diff --git a/db/schema_migrations/20200928100408 b/db/schema_migrations/20200928100408
new file mode 100644
index 00000000000..e49c397924d
--- /dev/null
+++ b/db/schema_migrations/20200928100408
@@ -0,0 +1 @@
+56984f720cfde6ad28b8612e092809252f948797fecb64dfc3b82d5b3b74f7ec \ No newline at end of file
diff --git a/db/schema_migrations/20200928125258 b/db/schema_migrations/20200928125258
new file mode 100644
index 00000000000..d9756bd6ee6
--- /dev/null
+++ b/db/schema_migrations/20200928125258
@@ -0,0 +1 @@
+46579fd0313068f3c9c1631f1da4a0b20513759a54dad4841bcea7d6c727646a \ No newline at end of file
diff --git a/db/schema_migrations/20200928131934 b/db/schema_migrations/20200928131934
new file mode 100644
index 00000000000..952e2121d35
--- /dev/null
+++ b/db/schema_migrations/20200928131934
@@ -0,0 +1 @@
+106757b0f30d3c89fcafa13be92271090fa107831fd538ee087d7ce212842492 \ No newline at end of file
diff --git a/db/schema_migrations/20200928164807 b/db/schema_migrations/20200928164807
new file mode 100644
index 00000000000..3efd3c56402
--- /dev/null
+++ b/db/schema_migrations/20200928164807
@@ -0,0 +1 @@
+346d0e913212d6e84528d47228ba7e6d0cf4a396e7fc921f7c684acfaaeeedb8 \ No newline at end of file
diff --git a/db/schema_migrations/20200928203531 b/db/schema_migrations/20200928203531
new file mode 100644
index 00000000000..229e2dc9b1f
--- /dev/null
+++ b/db/schema_migrations/20200928203531
@@ -0,0 +1 @@
+fc9719e0822d17eacb375b4adb2eac35afba04cafc2bd429c82c502d2fe5f12e \ No newline at end of file
diff --git a/db/schema_migrations/20200928210524 b/db/schema_migrations/20200928210524
new file mode 100644
index 00000000000..41905703d01
--- /dev/null
+++ b/db/schema_migrations/20200928210524
@@ -0,0 +1 @@
+788fd828a7aa8fb8741f13596f54fc4d9f4f5caeaf34d08aed47bbefe363ae75 \ No newline at end of file
diff --git a/db/schema_migrations/20200928233632 b/db/schema_migrations/20200928233632
new file mode 100644
index 00000000000..d66fc8310f2
--- /dev/null
+++ b/db/schema_migrations/20200928233632
@@ -0,0 +1 @@
+c390843c8a93ca429d1442d7b54f5f9dc01e0343c71ed1a046f11968cc10810d \ No newline at end of file
diff --git a/db/schema_migrations/20200929032729 b/db/schema_migrations/20200929032729
new file mode 100644
index 00000000000..cd38d67c78a
--- /dev/null
+++ b/db/schema_migrations/20200929032729
@@ -0,0 +1 @@
+77fa26f97216c1fa3d0b046dfabac92a5afa2a0eaf33439117b29ac81e740e4a \ No newline at end of file
diff --git a/db/schema_migrations/20200929052138 b/db/schema_migrations/20200929052138
new file mode 100644
index 00000000000..05c56a31270
--- /dev/null
+++ b/db/schema_migrations/20200929052138
@@ -0,0 +1 @@
+30b84d137fcb17eaca86f1bec52d6e20c972f7083d4c983e2bb397c9126b5f0c \ No newline at end of file
diff --git a/db/schema_migrations/20200929063159 b/db/schema_migrations/20200929063159
new file mode 100644
index 00000000000..b7815e9bb39
--- /dev/null
+++ b/db/schema_migrations/20200929063159
@@ -0,0 +1 @@
+9ef08404b964ccae3e12332340f16c6b8bb2bbdb2c04ba105fe1c0c7e6bf84f2 \ No newline at end of file
diff --git a/db/schema_migrations/20200929113254 b/db/schema_migrations/20200929113254
new file mode 100644
index 00000000000..172a6eabd66
--- /dev/null
+++ b/db/schema_migrations/20200929113254
@@ -0,0 +1 @@
+260f392c3ff257960dc7b198473056e7bf9b9a668403d2f05391d2b7989cf83c \ No newline at end of file
diff --git a/db/schema_migrations/20200929114107 b/db/schema_migrations/20200929114107
new file mode 100644
index 00000000000..f3b7a7a3bad
--- /dev/null
+++ b/db/schema_migrations/20200929114107
@@ -0,0 +1 @@
+f5d4b534c230f9ac7f285bccd096a7d51bf5c9e7a73f293fafaff89bb1ee12e1 \ No newline at end of file
diff --git a/db/schema_migrations/20200930094812 b/db/schema_migrations/20200930094812
new file mode 100644
index 00000000000..ad03614e47d
--- /dev/null
+++ b/db/schema_migrations/20200930094812
@@ -0,0 +1 @@
+b92b48a17bfd350a70017bfee99bcfb3dbc5ae9e33c8f23ab593666e5c3900aa \ No newline at end of file
diff --git a/db/schema_migrations/20200930131343 b/db/schema_migrations/20200930131343
new file mode 100644
index 00000000000..a872607f241
--- /dev/null
+++ b/db/schema_migrations/20200930131343
@@ -0,0 +1 @@
+45530bb3090d9e8df3a79f42a06b042e0c40f6e185078c6d79d7ec334175c7d5 \ No newline at end of file
diff --git a/db/schema_migrations/20200930132319 b/db/schema_migrations/20200930132319
new file mode 100644
index 00000000000..7bffd187de2
--- /dev/null
+++ b/db/schema_migrations/20200930132319
@@ -0,0 +1 @@
+1ded640c70d5e569f0f26729c96d2dc27c528bcb045e28f073ed8fce9f918d95 \ No newline at end of file
diff --git a/db/schema_migrations/20200930144340 b/db/schema_migrations/20200930144340
new file mode 100644
index 00000000000..4ac1bae7537
--- /dev/null
+++ b/db/schema_migrations/20200930144340
@@ -0,0 +1 @@
+febc66dbb48fbd281223ab9466cc5d94e945e8164fa9db0ee149c29e653b3eb2 \ No newline at end of file
diff --git a/db/schema_migrations/20201001022100 b/db/schema_migrations/20201001022100
new file mode 100644
index 00000000000..9c11e9e6094
--- /dev/null
+++ b/db/schema_migrations/20201001022100
@@ -0,0 +1 @@
+a581071767c5484e8286951854b0effe04d4b8951f208f10ceb4812940363959 \ No newline at end of file
diff --git a/db/schema_migrations/20201001101136 b/db/schema_migrations/20201001101136
new file mode 100644
index 00000000000..ecfc37cdfc5
--- /dev/null
+++ b/db/schema_migrations/20201001101136
@@ -0,0 +1 @@
+f3f9dd503d2c2695d5cd32ea87ff11e45832b1650df3186c7f71c984fc59ad24 \ No newline at end of file
diff --git a/db/schema_migrations/20201002012659 b/db/schema_migrations/20201002012659
new file mode 100644
index 00000000000..6a6d33389f9
--- /dev/null
+++ b/db/schema_migrations/20201002012659
@@ -0,0 +1 @@
+8a12c3c4f674d2a36df56a89bfd32e0f3945e73605460bdf2a8b0aa1308f5b19 \ No newline at end of file
diff --git a/db/schema_migrations/20201002094617 b/db/schema_migrations/20201002094617
new file mode 100644
index 00000000000..9c4d6155700
--- /dev/null
+++ b/db/schema_migrations/20201002094617
@@ -0,0 +1 @@
+823c72852eeb17eaf43c58e936ac25effdacb335f76562c68a4f90d5b1a32021 \ No newline at end of file
diff --git a/db/schema_migrations/20201002175953 b/db/schema_migrations/20201002175953
new file mode 100644
index 00000000000..df5f64c0deb
--- /dev/null
+++ b/db/schema_migrations/20201002175953
@@ -0,0 +1 @@
+619e788f8868a2ff602a06e0025154b0b10b17cd69edcce70378e11750d5e686 \ No newline at end of file
diff --git a/db/schema_migrations/20201004163918 b/db/schema_migrations/20201004163918
new file mode 100644
index 00000000000..e77e000bac8
--- /dev/null
+++ b/db/schema_migrations/20201004163918
@@ -0,0 +1 @@
+e25da3da50ed2396afe3bcb1ff441b5f1f0a43c0e23d66140a160d42f1b66a1a \ No newline at end of file
diff --git a/db/schema_migrations/20201005092703 b/db/schema_migrations/20201005092703
new file mode 100644
index 00000000000..54969553788
--- /dev/null
+++ b/db/schema_migrations/20201005092703
@@ -0,0 +1 @@
+550fb12fe5e180ab52bd6d012cf1869544130049e83ccbefd4b132831a074f71 \ No newline at end of file
diff --git a/db/schema_migrations/20201005092709 b/db/schema_migrations/20201005092709
new file mode 100644
index 00000000000..e0a7ecad91f
--- /dev/null
+++ b/db/schema_migrations/20201005092709
@@ -0,0 +1 @@
+5d9dbae8074627c41170e70849a3e6b71e20da473f312227df462c894c194efb \ No newline at end of file
diff --git a/db/schema_migrations/20201005092753 b/db/schema_migrations/20201005092753
new file mode 100644
index 00000000000..a519b6b3f1e
--- /dev/null
+++ b/db/schema_migrations/20201005092753
@@ -0,0 +1 @@
+b59670c031a146e7a1a8277ba51080a6c120724a00c7612933ff1ed44bc8dd60 \ No newline at end of file
diff --git a/db/schema_migrations/20201005094331 b/db/schema_migrations/20201005094331
new file mode 100644
index 00000000000..63b48d9fdaf
--- /dev/null
+++ b/db/schema_migrations/20201005094331
@@ -0,0 +1 @@
+b024bc44406810a30a3aebb33dd1355468448b4ebf9c76fe7811148044241551 \ No newline at end of file
diff --git a/db/schema_migrations/20201005153955 b/db/schema_migrations/20201005153955
new file mode 100644
index 00000000000..19d8b921ceb
--- /dev/null
+++ b/db/schema_migrations/20201005153955
@@ -0,0 +1 @@
+563f76e0635b54c2a5cb78cf5e87ea217acf3b6c853518588fcdeadef9dcc951 \ No newline at end of file
diff --git a/db/schema_migrations/20201006014605 b/db/schema_migrations/20201006014605
new file mode 100644
index 00000000000..92209fcd127
--- /dev/null
+++ b/db/schema_migrations/20201006014605
@@ -0,0 +1 @@
+d1a636c0b0c7f11bf5d6e882970a5286a28c3f060f89df3ac51df2e7c86f042e \ No newline at end of file
diff --git a/db/schema_migrations/20201007115209 b/db/schema_migrations/20201007115209
new file mode 100644
index 00000000000..acd0a056bbd
--- /dev/null
+++ b/db/schema_migrations/20201007115209
@@ -0,0 +1 @@
+761cad9a584d98e3086e716f7a5c1d9b4aba87b084efcfcee7272cfdf1179372 \ No newline at end of file
diff --git a/db/schema_migrations/20201009090954 b/db/schema_migrations/20201009090954
new file mode 100644
index 00000000000..5d5ca8ff29b
--- /dev/null
+++ b/db/schema_migrations/20201009090954
@@ -0,0 +1 @@
+d0944a864a1a89e9339eb1f8ffab683df1a5bb90f7b7a16cabd4871f34d1cd48 \ No newline at end of file
diff --git a/db/schema_migrations/20201012194936 b/db/schema_migrations/20201012194936
new file mode 100644
index 00000000000..c626e091e5e
--- /dev/null
+++ b/db/schema_migrations/20201012194936
@@ -0,0 +1 @@
+823d23d8ce8959762a7cadb883ed6d36a46fedaf238ea955d93136277d55cad5 \ No newline at end of file
diff --git a/db/schema_migrations/20201014142521 b/db/schema_migrations/20201014142521
new file mode 100644
index 00000000000..d87f01628c3
--- /dev/null
+++ b/db/schema_migrations/20201014142521
@@ -0,0 +1 @@
+aed103bb25b70eb8f6387d84225a8e51672a83c4586ccc65da3011ef010da4b1 \ No newline at end of file
diff --git a/db/schema_migrations/20201014205300 b/db/schema_migrations/20201014205300
new file mode 100644
index 00000000000..7d183f22624
--- /dev/null
+++ b/db/schema_migrations/20201014205300
@@ -0,0 +1 @@
+05352623a59d56c1633317ba7dbaba7d75bb8e529a748a90512dcf3641b8d3cb \ No newline at end of file
diff --git a/db/schema_migrations/20201015073808 b/db/schema_migrations/20201015073808
new file mode 100644
index 00000000000..c14d0b7a528
--- /dev/null
+++ b/db/schema_migrations/20201015073808
@@ -0,0 +1 @@
+e44ab2a7b3014b44d7d84de1f7e618d2fc89f98b8d59f5f6fa331544e206355f \ No newline at end of file
diff --git a/db/schema_migrations/20201015154527 b/db/schema_migrations/20201015154527
new file mode 100644
index 00000000000..995483bef49
--- /dev/null
+++ b/db/schema_migrations/20201015154527
@@ -0,0 +1 @@
+319502924c38f5e78e40226a55ad99db53b246aa0d35eb945ac9a96f9e55f584 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 6e921810cfb..4e6fc7e9260 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -19,7 +19,6 @@ IF (TG_OP = 'DELETE') THEN
ELSIF (TG_OP = 'UPDATE') THEN
UPDATE audit_events_part_5fc467ac26
SET author_id = NEW.author_id,
- type = NEW.type,
entity_id = NEW.entity_id,
entity_type = NEW.entity_type,
details = NEW.details,
@@ -34,7 +33,6 @@ ELSIF (TG_OP = 'UPDATE') THEN
ELSIF (TG_OP = 'INSERT') THEN
INSERT INTO audit_events_part_5fc467ac26 (id,
author_id,
- type,
entity_id,
entity_type,
details,
@@ -47,7 +45,6 @@ ELSIF (TG_OP = 'INSERT') THEN
created_at)
VALUES (NEW.id,
NEW.author_id,
- NEW.type,
NEW.entity_id,
NEW.entity_type,
NEW.details,
@@ -69,7 +66,6 @@ COMMENT ON FUNCTION table_sync_function_2be879775d() IS 'Partitioning migration:
CREATE TABLE audit_events_part_5fc467ac26 (
id bigint NOT NULL,
author_id integer NOT NULL,
- type character varying,
entity_id integer NOT NULL,
entity_type character varying NOT NULL,
details text,
@@ -8830,6 +8826,31 @@ CREATE SEQUENCE alert_management_alerts_id_seq
ALTER SEQUENCE alert_management_alerts_id_seq OWNED BY alert_management_alerts.id;
+CREATE TABLE alert_management_http_integrations (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ project_id bigint NOT NULL,
+ active boolean DEFAULT false NOT NULL,
+ encrypted_token text NOT NULL,
+ encrypted_token_iv text NOT NULL,
+ endpoint_identifier text NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_286943b636 CHECK ((char_length(encrypted_token_iv) <= 255)),
+ CONSTRAINT check_392143ccf4 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_e270820180 CHECK ((char_length(endpoint_identifier) <= 255)),
+ CONSTRAINT check_f68577c4af CHECK ((char_length(encrypted_token) <= 255))
+);
+
+CREATE SEQUENCE alert_management_http_integrations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE alert_management_http_integrations_id_seq OWNED BY alert_management_http_integrations.id;
+
CREATE TABLE alerts_service_data (
id bigint NOT NULL,
service_id integer NOT NULL,
@@ -9031,7 +9052,6 @@ CREATE TABLE application_settings (
session_expire_delay integer DEFAULT 10080 NOT NULL,
import_sources text,
help_page_text text,
- admin_notification_email character varying,
shared_runners_enabled boolean DEFAULT true NOT NULL,
max_artifacts_size integer DEFAULT 100 NOT NULL,
runners_registration_token character varying,
@@ -9146,7 +9166,6 @@ CREATE TABLE application_settings (
snowplow_enabled boolean DEFAULT false NOT NULL,
snowplow_collector_hostname character varying,
snowplow_cookie_domain character varying,
- instance_statistics_visibility_private boolean DEFAULT false NOT NULL,
web_ide_clientside_preview_enabled boolean DEFAULT false NOT NULL,
user_show_add_ssh_key_message boolean DEFAULT true NOT NULL,
custom_project_templates_group_id integer,
@@ -9196,7 +9215,6 @@ CREATE TABLE application_settings (
throttle_incident_management_notification_enabled boolean DEFAULT false NOT NULL,
throttle_incident_management_notification_period_in_seconds integer DEFAULT 3600,
throttle_incident_management_notification_per_period integer DEFAULT 3600,
- snowplow_iglu_registry_url character varying(255),
push_event_hooks_limit integer DEFAULT 3 NOT NULL,
push_event_activities_limit integer DEFAULT 3 NOT NULL,
custom_http_clone_url_root character varying(511),
@@ -9272,8 +9290,13 @@ CREATE TABLE application_settings (
elasticsearch_client_request_timeout integer DEFAULT 0 NOT NULL,
gitpod_enabled boolean DEFAULT false NOT NULL,
gitpod_url text DEFAULT 'https://gitpod.io/'::text,
+ abuse_notification_email character varying,
+ require_admin_approval_after_user_signup boolean DEFAULT false NOT NULL,
+ help_page_documentation_base_url text,
+ automatic_purchased_storage_allocation boolean DEFAULT false NOT NULL,
CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
+ CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)),
CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)),
CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)),
CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)),
@@ -9314,6 +9337,7 @@ CREATE TABLE approval_merge_request_rules (
rule_type smallint DEFAULT 1 NOT NULL,
report_type smallint,
section text,
+ modified_from_project_rule boolean DEFAULT false NOT NULL,
CONSTRAINT check_6fca5928b2 CHECK ((char_length(section) <= 255))
);
@@ -9514,7 +9538,6 @@ ALTER SEQUENCE atlassian_identities_user_id_seq OWNED BY atlassian_identities.us
CREATE TABLE audit_events (
id integer NOT NULL,
author_id integer NOT NULL,
- type character varying,
entity_id integer NOT NULL,
entity_type character varying NOT NULL,
details text,
@@ -9793,6 +9816,73 @@ CREATE SEQUENCE broadcast_messages_id_seq
ALTER SEQUENCE broadcast_messages_id_seq OWNED BY broadcast_messages.id;
+CREATE TABLE bulk_import_configurations (
+ id bigint NOT NULL,
+ bulk_import_id integer NOT NULL,
+ encrypted_url text,
+ encrypted_url_iv text,
+ encrypted_access_token text,
+ encrypted_access_token_iv text,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE bulk_import_configurations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE bulk_import_configurations_id_seq OWNED BY bulk_import_configurations.id;
+
+CREATE TABLE bulk_import_entities (
+ id bigint NOT NULL,
+ bulk_import_id bigint NOT NULL,
+ parent_id bigint,
+ namespace_id bigint,
+ project_id bigint,
+ source_type smallint NOT NULL,
+ source_full_path text NOT NULL,
+ destination_name text NOT NULL,
+ destination_namespace text NOT NULL,
+ status smallint NOT NULL,
+ jid text,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ CONSTRAINT check_13f279f7da CHECK ((char_length(source_full_path) <= 255)),
+ CONSTRAINT check_715d725ea2 CHECK ((char_length(destination_name) <= 255)),
+ CONSTRAINT check_796a4d9cc6 CHECK ((char_length(jid) <= 255)),
+ CONSTRAINT check_b834fff4d9 CHECK ((char_length(destination_namespace) <= 255))
+);
+
+CREATE SEQUENCE bulk_import_entities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id;
+
+CREATE TABLE bulk_imports (
+ id bigint NOT NULL,
+ user_id integer NOT NULL,
+ source_type smallint NOT NULL,
+ status smallint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE bulk_imports_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE bulk_imports_id_seq OWNED BY bulk_imports.id;
+
CREATE TABLE chat_names (
id integer NOT NULL,
user_id integer NOT NULL,
@@ -9889,7 +9979,8 @@ CREATE TABLE ci_build_trace_chunks (
chunk_index integer NOT NULL,
data_store integer NOT NULL,
raw_data bytea,
- checksum bytea
+ checksum bytea,
+ lock_version integer DEFAULT 0 NOT NULL
);
CREATE SEQUENCE ci_build_trace_chunks_id_seq
@@ -10050,6 +10141,24 @@ CREATE SEQUENCE ci_daily_build_group_report_results_id_seq
ALTER SEQUENCE ci_daily_build_group_report_results_id_seq OWNED BY ci_daily_build_group_report_results.id;
+CREATE TABLE ci_deleted_objects (
+ id bigint NOT NULL,
+ file_store smallint DEFAULT 1 NOT NULL,
+ pick_up_at timestamp with time zone DEFAULT now() NOT NULL,
+ store_dir text NOT NULL,
+ file text NOT NULL,
+ CONSTRAINT check_5e151d6912 CHECK ((char_length(store_dir) <= 1024))
+);
+
+CREATE SEQUENCE ci_deleted_objects_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_deleted_objects_id_seq OWNED BY ci_deleted_objects.id;
+
CREATE TABLE ci_freeze_periods (
id bigint NOT NULL,
project_id bigint NOT NULL,
@@ -10701,7 +10810,6 @@ ALTER SEQUENCE cluster_projects_id_seq OWNED BY cluster_projects.id;
CREATE TABLE cluster_providers_aws (
id bigint NOT NULL,
cluster_id bigint NOT NULL,
- created_by_user_id integer,
num_nodes integer NOT NULL,
status integer NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -11063,6 +11171,27 @@ CREATE SEQUENCE commit_user_mentions_id_seq
ALTER SEQUENCE commit_user_mentions_id_seq OWNED BY commit_user_mentions.id;
+CREATE TABLE compliance_management_frameworks (
+ id bigint NOT NULL,
+ group_id bigint,
+ name text NOT NULL,
+ description text NOT NULL,
+ color text NOT NULL,
+ namespace_id integer NOT NULL,
+ CONSTRAINT check_08cd34b2c2 CHECK ((char_length(color) <= 10)),
+ CONSTRAINT check_1617e0b87e CHECK ((char_length(description) <= 255)),
+ CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255))
+);
+
+CREATE SEQUENCE compliance_management_frameworks_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE compliance_management_frameworks_id_seq OWNED BY compliance_management_frameworks.id;
+
CREATE TABLE container_expiration_policies (
project_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -11083,7 +11212,8 @@ CREATE TABLE container_repositories (
name character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
- status smallint
+ status smallint,
+ expiration_policy_started_at timestamp with time zone
);
CREATE SEQUENCE container_repositories_id_seq
@@ -11169,6 +11299,9 @@ CREATE TABLE dast_scanner_profiles (
spider_timeout smallint,
target_timeout smallint,
name text NOT NULL,
+ scan_type smallint DEFAULT 1 NOT NULL,
+ use_ajax_spider boolean DEFAULT false NOT NULL,
+ show_debug_messages boolean DEFAULT false NOT NULL,
CONSTRAINT check_568568fabf CHECK ((char_length(name) <= 255))
);
@@ -11233,7 +11366,9 @@ CREATE TABLE dast_site_validations (
validation_strategy smallint NOT NULL,
url_base text NOT NULL,
url_path text NOT NULL,
+ state text DEFAULT 'pending'::text NOT NULL,
CONSTRAINT check_13b34efe4b CHECK ((char_length(url_path) <= 255)),
+ CONSTRAINT check_283be72e9b CHECK ((char_length(state) <= 255)),
CONSTRAINT check_cd3b538210 CHECK ((char_length(url_base) <= 255))
);
@@ -11411,7 +11546,8 @@ CREATE TABLE design_management_designs (
project_id integer NOT NULL,
issue_id integer,
filename character varying NOT NULL,
- relative_position integer
+ relative_position integer,
+ CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255))
);
CREATE SEQUENCE design_management_designs_id_seq
@@ -12488,6 +12624,7 @@ CREATE TABLE group_import_states (
status smallint DEFAULT 0 NOT NULL,
jid text,
last_error text,
+ user_id bigint,
CONSTRAINT check_87b58f6b30 CHECK ((char_length(last_error) <= 255)),
CONSTRAINT check_96558fff96 CHECK ((char_length(jid) <= 100))
);
@@ -12669,11 +12806,44 @@ CREATE SEQUENCE issuable_severities_id_seq
ALTER SEQUENCE issuable_severities_id_seq OWNED BY issuable_severities.id;
+CREATE TABLE issuable_slas (
+ id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ due_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE issuable_slas_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE issuable_slas_id_seq OWNED BY issuable_slas.id;
+
CREATE TABLE issue_assignees (
user_id integer NOT NULL,
issue_id integer NOT NULL
);
+CREATE TABLE issue_email_participants (
+ id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ email text NOT NULL,
+ CONSTRAINT check_2c321d408d CHECK ((char_length(email) <= 255))
+);
+
+CREATE SEQUENCE issue_email_participants_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE issue_email_participants_id_seq OWNED BY issue_email_participants.id;
+
CREATE TABLE issue_links (
id integer NOT NULL,
source_id integer NOT NULL,
@@ -13561,7 +13731,10 @@ CREATE TABLE namespace_settings (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
namespace_id integer NOT NULL,
- prevent_forking_outside_group boolean DEFAULT false NOT NULL
+ prevent_forking_outside_group boolean DEFAULT false NOT NULL,
+ allow_mfa_for_subgroups boolean DEFAULT true NOT NULL,
+ default_branch_name text,
+ CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255))
);
CREATE TABLE namespace_statistics (
@@ -13727,7 +13900,8 @@ CREATE TABLE notification_settings (
notification_email character varying,
fixed_pipeline boolean,
new_release boolean,
- moved_project boolean DEFAULT true NOT NULL
+ moved_project boolean DEFAULT true NOT NULL,
+ change_reviewer_merge_request boolean
);
CREATE SEQUENCE notification_settings_id_seq
@@ -14069,6 +14243,25 @@ CREATE SEQUENCE packages_dependency_links_id_seq
ALTER SEQUENCE packages_dependency_links_id_seq OWNED BY packages_dependency_links.id;
+CREATE TABLE packages_events (
+ id bigint NOT NULL,
+ event_type smallint NOT NULL,
+ event_scope smallint NOT NULL,
+ originator_type smallint NOT NULL,
+ originator bigint,
+ created_at timestamp with time zone NOT NULL,
+ package_id bigint
+);
+
+CREATE SEQUENCE packages_events_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_events_id_seq OWNED BY packages_events.id;
+
CREATE TABLE packages_maven_metadata (
id bigint NOT NULL,
package_id bigint NOT NULL,
@@ -14121,7 +14314,8 @@ CREATE TABLE packages_package_files (
verified_at timestamp with time zone,
verification_failure character varying(255),
verification_retry_count integer,
- verification_checksum bytea
+ verification_checksum bytea,
+ CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL))
);
CREATE SEQUENCE packages_package_files_id_seq
@@ -14363,7 +14557,10 @@ CREATE TABLE plan_limits (
nuget_max_file_size bigint DEFAULT 524288000 NOT NULL,
pypi_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
generic_packages_max_file_size bigint DEFAULT '5368709120'::bigint NOT NULL,
- project_feature_flags integer DEFAULT 200 NOT NULL
+ golang_max_file_size bigint DEFAULT 104857600 NOT NULL,
+ debian_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
+ project_feature_flags integer DEFAULT 200 NOT NULL,
+ ci_max_artifact_size_api_fuzzing integer DEFAULT 0 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
@@ -14409,6 +14606,43 @@ CREATE SEQUENCE pool_repositories_id_seq
ALTER SEQUENCE pool_repositories_id_seq OWNED BY pool_repositories.id;
+CREATE VIEW postgres_indexes AS
+ SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname AS schema,
+ pg_class.relname AS name,
+ pg_index.indisunique AS "unique",
+ pg_index.indisvalid AS valid_index,
+ pg_class.relispartition AS partitioned,
+ pg_index.indisexclusion AS exclusion,
+ pg_indexes.indexdef AS definition,
+ pg_relation_size((pg_class.oid)::regclass) AS ondisk_size_bytes
+ FROM (((pg_index
+ JOIN pg_class ON ((pg_class.oid = pg_index.indexrelid)))
+ JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid)))
+ JOIN pg_indexes ON ((pg_class.relname = pg_indexes.indexname)))
+ WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])));
+
+CREATE TABLE postgres_reindex_actions (
+ id bigint NOT NULL,
+ action_start timestamp with time zone NOT NULL,
+ action_end timestamp with time zone,
+ ondisk_size_bytes_start bigint NOT NULL,
+ ondisk_size_bytes_end bigint,
+ state smallint DEFAULT 0 NOT NULL,
+ index_identifier text NOT NULL,
+ CONSTRAINT check_f12527622c CHECK ((char_length(index_identifier) <= 255))
+);
+
+CREATE SEQUENCE postgres_reindex_actions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE postgres_reindex_actions_id_seq OWNED BY postgres_reindex_actions.id;
+
CREATE TABLE programming_languages (
id integer NOT NULL,
name character varying NOT NULL,
@@ -14497,7 +14731,9 @@ ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id;
CREATE TABLE project_compliance_framework_settings (
project_id bigint NOT NULL,
- framework smallint NOT NULL
+ framework smallint NOT NULL,
+ framework_id bigint,
+ CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL))
);
CREATE SEQUENCE project_compliance_framework_settings_project_id_seq
@@ -14664,6 +14900,8 @@ CREATE TABLE project_incident_management_settings (
encrypted_pagerduty_token bytea,
encrypted_pagerduty_token_iv bytea,
auto_close_incident boolean DEFAULT true NOT NULL,
+ sla_timer boolean DEFAULT false,
+ sla_timer_minutes integer,
CONSTRAINT pagerduty_token_iv_length_constraint CHECK ((octet_length(encrypted_pagerduty_token_iv) <= 12)),
CONSTRAINT pagerduty_token_length_constraint CHECK ((octet_length(encrypted_pagerduty_token) <= 255))
);
@@ -14710,7 +14948,8 @@ ALTER SEQUENCE project_mirror_data_id_seq OWNED BY project_mirror_data.id;
CREATE TABLE project_pages_metadata (
project_id bigint NOT NULL,
deployed boolean DEFAULT false NOT NULL,
- artifacts_archive_id bigint
+ artifacts_archive_id bigint,
+ pages_deployment_id bigint
);
CREATE TABLE project_repositories (
@@ -15314,6 +15553,22 @@ CREATE TABLE repository_languages (
share double precision NOT NULL
);
+CREATE TABLE required_code_owners_sections (
+ id bigint NOT NULL,
+ protected_branch_id bigint NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_e58d53741e CHECK ((char_length(name) <= 1024))
+);
+
+CREATE SEQUENCE required_code_owners_sections_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE required_code_owners_sections_id_seq OWNED BY required_code_owners_sections.id;
+
CREATE TABLE requirements (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -15324,7 +15579,10 @@ CREATE TABLE requirements (
cached_markdown_version integer,
state smallint DEFAULT 1 NOT NULL,
title character varying(255) NOT NULL,
- title_html text
+ title_html text,
+ description text,
+ description_html text,
+ CONSTRAINT check_785ae25b9d CHECK ((char_length(description) <= 10000))
);
CREATE SEQUENCE requirements_id_seq
@@ -15494,6 +15752,25 @@ CREATE SEQUENCE routes_id_seq
ALTER SEQUENCE routes_id_seq OWNED BY routes.id;
+CREATE TABLE saml_group_links (
+ id bigint NOT NULL,
+ access_level smallint NOT NULL,
+ group_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ saml_group_name text NOT NULL,
+ CONSTRAINT check_1b3fc49d1e CHECK ((char_length(saml_group_name) <= 255))
+);
+
+CREATE SEQUENCE saml_group_links_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE saml_group_links_id_seq OWNED BY saml_group_links.id;
+
CREATE TABLE saml_providers (
id integer NOT NULL,
group_id integer NOT NULL,
@@ -16910,6 +17187,7 @@ CREATE TABLE webauthn_registrations (
credential_xid text NOT NULL,
name text NOT NULL,
public_key text NOT NULL,
+ u2f_registration_id integer,
CONSTRAINT check_242f0cc65c CHECK ((char_length(credential_xid) <= 255)),
CONSTRAINT check_2f02e74321 CHECK ((char_length(name) <= 255))
);
@@ -17043,6 +17321,8 @@ ALTER TABLE ONLY alert_management_alert_user_mentions ALTER COLUMN id SET DEFAUL
ALTER TABLE ONLY alert_management_alerts ALTER COLUMN id SET DEFAULT nextval('alert_management_alerts_id_seq'::regclass);
+ALTER TABLE ONLY alert_management_http_integrations ALTER COLUMN id SET DEFAULT nextval('alert_management_http_integrations_id_seq'::regclass);
+
ALTER TABLE ONLY alerts_service_data ALTER COLUMN id SET DEFAULT nextval('alerts_service_data_id_seq'::regclass);
ALTER TABLE ONLY allowed_email_domains ALTER COLUMN id SET DEFAULT nextval('allowed_email_domains_id_seq'::regclass);
@@ -17111,6 +17391,12 @@ ALTER TABLE ONLY boards_epic_user_preferences ALTER COLUMN id SET DEFAULT nextva
ALTER TABLE ONLY broadcast_messages ALTER COLUMN id SET DEFAULT nextval('broadcast_messages_id_seq'::regclass);
+ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval('bulk_import_configurations_id_seq'::regclass);
+
+ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass);
+
+ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass);
+
ALTER TABLE ONLY chat_names ALTER COLUMN id SET DEFAULT nextval('chat_names_id_seq'::regclass);
ALTER TABLE ONLY chat_teams ALTER COLUMN id SET DEFAULT nextval('chat_teams_id_seq'::regclass);
@@ -17133,6 +17419,8 @@ ALTER TABLE ONLY ci_builds_runner_session ALTER COLUMN id SET DEFAULT nextval('c
ALTER TABLE ONLY ci_daily_build_group_report_results ALTER COLUMN id SET DEFAULT nextval('ci_daily_build_group_report_results_id_seq'::regclass);
+ALTER TABLE ONLY ci_deleted_objects ALTER COLUMN id SET DEFAULT nextval('ci_deleted_objects_id_seq'::regclass);
+
ALTER TABLE ONLY ci_freeze_periods ALTER COLUMN id SET DEFAULT nextval('ci_freeze_periods_id_seq'::regclass);
ALTER TABLE ONLY ci_group_variables ALTER COLUMN id SET DEFAULT nextval('ci_group_variables_id_seq'::regclass);
@@ -17229,6 +17517,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_management_frameworks ALTER COLUMN id SET DEFAULT nextval('compliance_management_frameworks_id_seq'::regclass);
+
ALTER TABLE ONLY container_repositories ALTER COLUMN id SET DEFAULT nextval('container_repositories_id_seq'::regclass);
ALTER TABLE ONLY conversational_development_index_metrics ALTER COLUMN id SET DEFAULT nextval('conversational_development_index_metrics_id_seq'::regclass);
@@ -17379,6 +17669,10 @@ ALTER TABLE ONLY ip_restrictions ALTER COLUMN id SET DEFAULT nextval('ip_restric
ALTER TABLE ONLY issuable_severities ALTER COLUMN id SET DEFAULT nextval('issuable_severities_id_seq'::regclass);
+ALTER TABLE ONLY issuable_slas ALTER COLUMN id SET DEFAULT nextval('issuable_slas_id_seq'::regclass);
+
+ALTER TABLE ONLY issue_email_participants ALTER COLUMN id SET DEFAULT nextval('issue_email_participants_id_seq'::regclass);
+
ALTER TABLE ONLY issue_links ALTER COLUMN id SET DEFAULT nextval('issue_links_id_seq'::regclass);
ALTER TABLE ONLY issue_metrics ALTER COLUMN id SET DEFAULT nextval('issue_metrics_id_seq'::regclass);
@@ -17495,6 +17789,8 @@ ALTER TABLE ONLY packages_dependencies ALTER COLUMN id SET DEFAULT nextval('pack
ALTER TABLE ONLY packages_dependency_links ALTER COLUMN id SET DEFAULT nextval('packages_dependency_links_id_seq'::regclass);
+ALTER TABLE ONLY packages_events ALTER COLUMN id SET DEFAULT nextval('packages_events_id_seq'::regclass);
+
ALTER TABLE ONLY packages_maven_metadata ALTER COLUMN id SET DEFAULT nextval('packages_maven_metadata_id_seq'::regclass);
ALTER TABLE ONLY packages_package_files ALTER COLUMN id SET DEFAULT nextval('packages_package_files_id_seq'::regclass);
@@ -17521,6 +17817,8 @@ ALTER TABLE ONLY plans ALTER COLUMN id SET DEFAULT nextval('plans_id_seq'::regcl
ALTER TABLE ONLY pool_repositories ALTER COLUMN id SET DEFAULT nextval('pool_repositories_id_seq'::regclass);
+ALTER TABLE ONLY postgres_reindex_actions ALTER COLUMN id SET DEFAULT nextval('postgres_reindex_actions_id_seq'::regclass);
+
ALTER TABLE ONLY product_analytics_events_experimental ALTER COLUMN id SET DEFAULT nextval('product_analytics_events_experimental_id_seq'::regclass);
ALTER TABLE ONLY programming_languages ALTER COLUMN id SET DEFAULT nextval('programming_languages_id_seq'::regclass);
@@ -17599,6 +17897,8 @@ ALTER TABLE ONLY releases ALTER COLUMN id SET DEFAULT nextval('releases_id_seq':
ALTER TABLE ONLY remote_mirrors ALTER COLUMN id SET DEFAULT nextval('remote_mirrors_id_seq'::regclass);
+ALTER TABLE ONLY required_code_owners_sections ALTER COLUMN id SET DEFAULT nextval('required_code_owners_sections_id_seq'::regclass);
+
ALTER TABLE ONLY requirements ALTER COLUMN id SET DEFAULT nextval('requirements_id_seq'::regclass);
ALTER TABLE ONLY requirements_management_test_reports ALTER COLUMN id SET DEFAULT nextval('requirements_management_test_reports_id_seq'::regclass);
@@ -17617,6 +17917,8 @@ ALTER TABLE ONLY reviews ALTER COLUMN id SET DEFAULT nextval('reviews_id_seq'::r
ALTER TABLE ONLY routes ALTER COLUMN id SET DEFAULT nextval('routes_id_seq'::regclass);
+ALTER TABLE ONLY saml_group_links ALTER COLUMN id SET DEFAULT nextval('saml_group_links_id_seq'::regclass);
+
ALTER TABLE ONLY saml_providers ALTER COLUMN id SET DEFAULT nextval('saml_providers_id_seq'::regclass);
ALTER TABLE ONLY scim_identities ALTER COLUMN id SET DEFAULT nextval('scim_identities_id_seq'::regclass);
@@ -17956,6 +18258,9 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT alert_management_alerts_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY alert_management_http_integrations
+ ADD CONSTRAINT alert_management_http_integrations_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY alerts_service_data
ADD CONSTRAINT alerts_service_data_pkey PRIMARY KEY (id);
@@ -18070,20 +18375,26 @@ ALTER TABLE ONLY boards
ALTER TABLE ONLY broadcast_messages
ADD CONSTRAINT broadcast_messages_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY bulk_import_configurations
+ ADD CONSTRAINT bulk_import_configurations_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY bulk_import_entities
+ ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY bulk_imports
+ ADD CONSTRAINT bulk_imports_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY chat_names
ADD CONSTRAINT chat_names_pkey PRIMARY KEY (id);
ALTER TABLE ONLY chat_teams
ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);
-ALTER TABLE design_management_designs
- ADD CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)) NOT VALID;
-
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
-ALTER TABLE packages_package_files
- ADD CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL)) NOT VALID;
+ALTER TABLE group_import_states
+ ADD CONSTRAINT check_cda75c7c3f CHECK ((user_id IS NOT NULL)) NOT VALID;
ALTER TABLE ONLY ci_build_needs
ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id);
@@ -18112,6 +18423,9 @@ ALTER TABLE ONLY ci_builds_runner_session
ALTER TABLE ONLY ci_daily_build_group_report_results
ADD CONSTRAINT ci_daily_build_group_report_results_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_deleted_objects
+ ADD CONSTRAINT ci_deleted_objects_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY ci_freeze_periods
ADD CONSTRAINT ci_freeze_periods_pkey PRIMARY KEY (id);
@@ -18256,6 +18570,9 @@ ALTER TABLE ONLY clusters
ALTER TABLE ONLY commit_user_mentions
ADD CONSTRAINT commit_user_mentions_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY compliance_management_frameworks
+ ADD CONSTRAINT compliance_management_frameworks_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY container_expiration_policies
ADD CONSTRAINT container_expiration_policies_pkey PRIMARY KEY (project_id);
@@ -18493,6 +18810,12 @@ ALTER TABLE ONLY ip_restrictions
ALTER TABLE ONLY issuable_severities
ADD CONSTRAINT issuable_severities_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY issuable_slas
+ ADD CONSTRAINT issuable_slas_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY issue_email_participants
+ ADD CONSTRAINT issue_email_participants_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY issue_links
ADD CONSTRAINT issue_links_pkey PRIMARY KEY (id);
@@ -18688,6 +19011,9 @@ ALTER TABLE ONLY packages_dependencies
ALTER TABLE ONLY packages_dependency_links
ADD CONSTRAINT packages_dependency_links_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY packages_events
+ ADD CONSTRAINT packages_events_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY packages_maven_metadata
ADD CONSTRAINT packages_maven_metadata_pkey PRIMARY KEY (id);
@@ -18736,6 +19062,9 @@ ALTER TABLE ONLY plans
ALTER TABLE ONLY pool_repositories
ADD CONSTRAINT pool_repositories_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY postgres_reindex_actions
+ ADD CONSTRAINT postgres_reindex_actions_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY programming_languages
ADD CONSTRAINT programming_languages_pkey PRIMARY KEY (id);
@@ -18868,6 +19197,9 @@ ALTER TABLE ONLY releases
ALTER TABLE ONLY remote_mirrors
ADD CONSTRAINT remote_mirrors_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY required_code_owners_sections
+ ADD CONSTRAINT required_code_owners_sections_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY requirements_management_test_reports
ADD CONSTRAINT requirements_management_test_reports_pkey PRIMARY KEY (id);
@@ -18895,6 +19227,9 @@ ALTER TABLE ONLY reviews
ALTER TABLE ONLY routes
ADD CONSTRAINT routes_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY saml_group_links
+ ADD CONSTRAINT saml_group_links_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY saml_providers
ADD CONSTRAINT saml_providers_pkey PRIMARY KEY (id);
@@ -19287,7 +19622,7 @@ CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_ev
CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1);
-CREATE INDEX idx_container_scanning_findings ON vulnerability_occurrences USING btree (id) WHERE (report_type = 2);
+CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled);
CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace);
@@ -19317,6 +19652,8 @@ CREATE INDEX idx_members_created_at_user_id_invite_token ON members USING btree
CREATE INDEX idx_merge_requests_on_id_and_merge_jid ON merge_requests USING btree (id, merge_jid) WHERE ((merge_jid IS NOT NULL) AND (state_id = 4));
+CREATE INDEX idx_merge_requests_on_merged_state ON merge_requests USING btree (id) WHERE (state_id = 3);
+
CREATE INDEX idx_merge_requests_on_source_project_and_branch_state_opened ON merge_requests USING btree (source_project_id, source_branch) WHERE (state_id = 1);
CREATE INDEX idx_merge_requests_on_state_id_and_merge_status ON merge_requests USING btree (state_id, merge_status) WHERE ((state_id = 1) AND ((merge_status)::text = 'can_be_merged'::text));
@@ -19329,6 +19666,8 @@ CREATE UNIQUE INDEX idx_metrics_users_starred_dashboard_on_user_project_dashboar
CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_commit_diff_files USING btree (merge_request_context_commit_id, sha);
+CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name);
+
CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type);
CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type);
@@ -19381,6 +19720,8 @@ CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_iid ON alert
CREATE INDEX index_alert_management_alerts_on_prometheus_alert_id ON alert_management_alerts USING btree (prometheus_alert_id) WHERE (prometheus_alert_id IS NOT NULL);
+CREATE INDEX index_alert_management_http_integrations_on_project_id ON alert_management_http_integrations USING btree (project_id);
+
CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id ON alert_management_alert_user_mentions USING btree (alert_management_alert_id) WHERE (note_id IS NULL);
CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id_and_note_id ON alert_management_alert_user_mentions USING btree (alert_management_alert_id, note_id);
@@ -19447,6 +19788,8 @@ CREATE UNIQUE INDEX index_approval_project_rules_groups_1 ON approval_project_ru
CREATE INDEX index_approval_project_rules_groups_2 ON approval_project_rules_groups USING btree (group_id);
+CREATE INDEX index_approval_project_rules_on_id_with_regular_type ON approval_project_rules USING btree (id) WHERE (rule_type = 0);
+
CREATE INDEX index_approval_project_rules_on_project_id ON approval_project_rules USING btree (project_id);
CREATE INDEX index_approval_project_rules_on_rule_type ON approval_project_rules USING btree (rule_type);
@@ -19459,6 +19802,8 @@ CREATE UNIQUE INDEX index_approval_project_rules_users_1 ON approval_project_rul
CREATE INDEX index_approval_project_rules_users_2 ON approval_project_rules_users USING btree (user_id);
+CREATE INDEX index_approval_project_rules_users_on_approval_project_rule_id ON approval_project_rules_users USING btree (approval_project_rule_id);
+
CREATE UNIQUE INDEX index_approval_rule_name_for_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id, name) WHERE ((rule_type = 2) AND (section IS NULL));
CREATE UNIQUE INDEX index_approval_rule_name_for_sectional_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id, name, section) WHERE (rule_type = 2);
@@ -19481,6 +19826,8 @@ CREATE UNIQUE INDEX index_atlassian_identities_on_extern_uid ON atlassian_identi
CREATE INDEX index_authentication_events_on_provider ON authentication_events USING btree (provider);
+CREATE INDEX index_authentication_events_on_provider_user_id_created_at ON authentication_events USING btree (provider, user_id, created_at) WHERE (result = 1);
+
CREATE INDEX index_authentication_events_on_user_id ON authentication_events USING btree (user_id);
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON award_emoji USING btree (awardable_type, awardable_id);
@@ -19547,6 +19894,18 @@ CREATE INDEX index_boards_on_project_id ON boards USING btree (project_id);
CREATE INDEX index_broadcast_message_on_ends_at_and_broadcast_type_and_id ON broadcast_messages USING btree (ends_at, broadcast_type, id);
+CREATE INDEX index_bulk_import_configurations_on_bulk_import_id ON bulk_import_configurations USING btree (bulk_import_id);
+
+CREATE INDEX index_bulk_import_entities_on_bulk_import_id ON bulk_import_entities USING btree (bulk_import_id);
+
+CREATE INDEX index_bulk_import_entities_on_namespace_id ON bulk_import_entities USING btree (namespace_id);
+
+CREATE INDEX index_bulk_import_entities_on_parent_id ON bulk_import_entities USING btree (parent_id);
+
+CREATE INDEX index_bulk_import_entities_on_project_id ON bulk_import_entities USING btree (project_id);
+
+CREATE INDEX index_bulk_imports_on_user_id ON bulk_imports USING btree (user_id);
+
CREATE UNIQUE INDEX index_chat_names_on_service_id_and_team_id_and_chat_id ON chat_names USING btree (service_id, team_id, chat_id);
CREATE UNIQUE INDEX index_chat_names_on_user_id_and_service_id ON chat_names USING btree (user_id, service_id);
@@ -19625,6 +19984,8 @@ CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runn
CREATE INDEX index_ci_daily_build_group_report_results_on_last_pipeline_id ON ci_daily_build_group_report_results USING btree (last_pipeline_id);
+CREATE INDEX index_ci_deleted_objects_on_pick_up_at ON ci_deleted_objects USING btree (pick_up_at);
+
CREATE INDEX index_ci_freeze_periods_on_project_id ON ci_freeze_periods USING btree (project_id);
CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key ON ci_group_variables USING btree (group_id, key);
@@ -19709,7 +20070,7 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_user_id_and_status_and_ref ON
CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON ci_pipelines USING btree (project_id, ref, id DESC);
-CREATE INDEX index_ci_pipelines_on_status ON ci_pipelines USING btree (status);
+CREATE INDEX index_ci_pipelines_on_status_and_id ON ci_pipelines USING btree (status, id);
CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_config_source ON ci_pipelines USING btree (user_id, created_at, config_source);
@@ -19785,8 +20146,6 @@ CREATE INDEX index_cluster_agent_tokens_on_agent_id ON cluster_agent_tokens USIN
CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_agent_tokens USING btree (token_encrypted);
-CREATE INDEX index_cluster_agents_on_project_id ON cluster_agents USING btree (project_id);
-
CREATE UNIQUE INDEX index_cluster_agents_on_project_id_and_name ON cluster_agents USING btree (project_id, name);
CREATE UNIQUE INDEX index_cluster_groups_on_cluster_id_and_group_id ON cluster_groups USING btree (cluster_id, group_id);
@@ -19803,8 +20162,6 @@ CREATE UNIQUE INDEX index_cluster_providers_aws_on_cluster_id ON cluster_provide
CREATE INDEX index_cluster_providers_aws_on_cluster_id_and_status ON cluster_providers_aws USING btree (cluster_id, status);
-CREATE INDEX index_cluster_providers_aws_on_created_by_user_id ON cluster_providers_aws USING btree (created_by_user_id);
-
CREATE INDEX index_cluster_providers_gcp_on_cloud_run ON cluster_providers_gcp USING btree (cloud_run);
CREATE UNIQUE INDEX index_cluster_providers_gcp_on_cluster_id ON cluster_providers_gcp USING btree (cluster_id);
@@ -19933,6 +20290,8 @@ CREATE INDEX index_deployments_on_project_id_and_status_and_created_at ON deploy
CREATE INDEX index_deployments_on_project_id_and_updated_at_and_id ON deployments USING btree (project_id, updated_at DESC, id DESC);
+CREATE INDEX index_deployments_on_project_id_sha ON deployments USING btree (project_id, sha);
+
CREATE INDEX index_deployments_on_user_id_and_status_and_created_at ON deployments USING btree (user_id, status, created_at);
CREATE INDEX index_description_versions_on_epic_id ON description_versions USING btree (epic_id) WHERE (epic_id IS NOT NULL);
@@ -20219,12 +20578,16 @@ CREATE INDEX index_group_group_links_on_shared_with_group_id ON group_group_link
CREATE INDEX index_group_import_states_on_group_id ON group_import_states USING btree (group_id);
+CREATE INDEX index_group_import_states_on_user_id ON group_import_states USING btree (user_id) WHERE (user_id IS NOT NULL);
+
CREATE UNIQUE INDEX index_group_stages_on_group_id_group_value_stream_id_and_name ON analytics_cycle_analytics_group_stages USING btree (group_id, group_value_stream_id, name);
CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_repositories USING btree (disk_path);
CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositories USING btree (shard_id);
+CREATE UNIQUE INDEX index_http_integrations_on_active_and_project_and_endpoint ON alert_management_http_integrations USING btree (active, project_id, endpoint_identifier) WHERE active;
+
CREATE INDEX index_identities_on_saml_provider_id ON identities USING btree (saml_provider_id) WHERE (saml_provider_id IS NOT NULL);
CREATE INDEX index_identities_on_user_id ON identities USING btree (user_id);
@@ -20263,10 +20626,14 @@ CREATE INDEX index_ip_restrictions_on_group_id ON ip_restrictions USING btree (g
CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities USING btree (issue_id);
+CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree (issue_id);
+
CREATE UNIQUE INDEX index_issue_assignees_on_issue_id_and_user_id ON issue_assignees USING btree (issue_id, user_id);
CREATE INDEX index_issue_assignees_on_user_id ON issue_assignees USING btree (user_id);
+CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_email ON issue_email_participants USING btree (issue_id, email);
+
CREATE INDEX index_issue_links_on_source_id ON issue_links USING btree (source_id);
CREATE UNIQUE INDEX index_issue_links_on_source_id_and_target_id ON issue_links USING btree (source_id, target_id);
@@ -20309,8 +20676,6 @@ CREATE UNIQUE INDEX index_issues_on_project_id_and_iid ON issues USING btree (pr
CREATE INDEX index_issues_on_promoted_to_epic_id ON issues USING btree (promoted_to_epic_id) WHERE (promoted_to_epic_id IS NOT NULL);
-CREATE INDEX index_issues_on_relative_position ON issues USING btree (relative_position);
-
CREATE INDEX index_issues_on_sprint_id ON issues USING btree (sprint_id);
CREATE INDEX index_issues_on_title_trigram ON issues USING gin (title gin_trgm_ops);
@@ -20319,6 +20684,8 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);
CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);
+CREATE INDEX index_issues_project_id_issue_type_incident ON issues USING btree (project_id) WHERE (issue_type = 1);
+
CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key);
CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id);
@@ -20489,6 +20856,8 @@ CREATE INDEX index_merge_requests_on_target_project_id_and_created_at_and_id ON
CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON merge_requests USING btree (target_project_id, iid);
+CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON merge_requests USING btree (target_project_id, iid, state_id);
+
CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true));
CREATE INDEX index_merge_requests_on_title ON merge_requests USING btree (title);
@@ -20573,7 +20942,7 @@ CREATE UNIQUE INDEX index_namespaces_on_runners_token_encrypted ON namespaces US
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_type_partial ON namespaces USING btree (type) WHERE (type IS NOT NULL);
+CREATE INDEX index_namespaces_on_type_and_id_partial ON namespaces USING btree (type, id) WHERE (type IS NOT NULL);
CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON members USING btree (source_id, source_type) WHERE ((requested_at IS NULL) AND ((type)::text = 'ProjectMember'::text));
@@ -20669,14 +21038,14 @@ CREATE UNIQUE INDEX index_packages_dependencies_on_name_and_version_pattern ON p
CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_dependency_links USING btree (dependency_id);
+CREATE INDEX index_packages_events_on_package_id ON packages_events USING btree (package_id);
+
CREATE INDEX index_packages_maven_metadata_on_package_id_and_path ON packages_maven_metadata USING btree (package_id, path);
CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_nuget_dependency_link_metadata USING btree (dependency_link_id);
CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 7);
-CREATE INDEX index_packages_package_files_file_store_is_null ON packages_package_files USING btree (id) WHERE (file_store IS NULL);
-
CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store);
CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name);
@@ -20733,6 +21102,8 @@ CREATE INDEX index_pages_domains_on_wildcard ON pages_domains USING btree (wildc
CREATE UNIQUE INDEX index_partial_am_alerts_on_project_id_and_fingerprint ON alert_management_alerts USING btree (project_id, fingerprint) WHERE (status <> 2);
+CREATE INDEX index_partial_ci_builds_on_user_id_name_parser_features ON ci_builds USING btree (user_id, name) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('secret_detection'::character varying)::text])));
+
CREATE UNIQUE INDEX index_partitioned_foreign_keys_unique_index ON partitioned_foreign_keys USING btree (to_table, from_table, from_column);
CREATE INDEX index_pat_on_user_id_and_expires_at ON personal_access_tokens USING btree (user_id, expires_at);
@@ -20757,6 +21128,8 @@ CREATE INDEX index_pool_repositories_on_shard_id ON pool_repositories USING btre
CREATE UNIQUE INDEX index_pool_repositories_on_source_project_id_and_shard_id ON pool_repositories USING btree (source_project_id, shard_id);
+CREATE INDEX index_postgres_reindex_actions_on_index_identifier ON postgres_reindex_actions USING btree (index_identifier);
+
CREATE UNIQUE INDEX index_programming_languages_on_name ON programming_languages USING btree (name);
CREATE INDEX index_project_access_tokens_on_project_id ON project_access_tokens USING btree (project_id);
@@ -20773,6 +21146,8 @@ CREATE UNIQUE INDEX index_project_auto_devops_on_project_id ON project_auto_devo
CREATE UNIQUE INDEX index_project_ci_cd_settings_on_project_id ON project_ci_cd_settings USING btree (project_id);
+CREATE INDEX index_project_compliance_framework_settings_on_framework_id ON project_compliance_framework_settings USING btree (framework_id);
+
CREATE INDEX index_project_compliance_framework_settings_on_project_id ON project_compliance_framework_settings USING btree (project_id);
CREATE INDEX index_project_custom_attributes_on_key_and_value ON project_custom_attributes USING btree (key, value);
@@ -20817,6 +21192,8 @@ CREATE INDEX index_project_mirror_data_on_status ON project_mirror_data USING bt
CREATE INDEX index_project_pages_metadata_on_artifacts_archive_id ON project_pages_metadata USING btree (artifacts_archive_id);
+CREATE INDEX index_project_pages_metadata_on_pages_deployment_id ON project_pages_metadata USING btree (pages_deployment_id);
+
CREATE UNIQUE INDEX index_project_pages_metadata_on_project_id ON project_pages_metadata USING btree (project_id);
CREATE INDEX index_project_pages_metadata_on_project_id_and_deployed_is_true ON project_pages_metadata USING btree (project_id) WHERE (deployed = true);
@@ -21019,6 +21396,8 @@ CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (p
CREATE UNIQUE INDEX index_repository_languages_on_project_and_languages_id ON repository_languages USING btree (project_id, programming_language_id);
+CREATE INDEX index_required_code_owners_sections_on_protected_branch_id ON required_code_owners_sections USING btree (protected_branch_id);
+
CREATE INDEX index_requirements_management_test_reports_on_author_id ON requirements_management_test_reports USING btree (author_id);
CREATE INDEX index_requirements_management_test_reports_on_build_id ON requirements_management_test_reports USING btree (build_id);
@@ -21101,6 +21480,8 @@ CREATE INDEX index_routes_on_path_trigram ON routes USING gin (path gin_trgm_ops
CREATE UNIQUE INDEX index_routes_on_source_type_and_source_id ON routes USING btree (source_type, source_id);
+CREATE UNIQUE INDEX index_saml_group_links_on_group_id_and_saml_group_name ON saml_group_links USING btree (group_id, saml_group_name);
+
CREATE INDEX index_saml_providers_on_group_id ON saml_providers USING btree (group_id);
CREATE INDEX index_scim_identities_on_group_id ON scim_identities USING btree (group_id);
@@ -21153,6 +21534,8 @@ CREATE UNIQUE INDEX index_services_on_type_and_instance_partial ON services USIN
CREATE UNIQUE INDEX index_services_on_type_and_template_partial ON services USING btree (type, template) WHERE (template = true);
+CREATE INDEX index_services_on_type_id_when_active_and_project_id_not_null ON services USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL));
+
CREATE INDEX index_services_on_type_id_when_active_not_instance_not_template ON services USING btree (type, id) WHERE ((active = true) AND (instance = false) AND (template = false));
CREATE UNIQUE INDEX index_services_on_unique_group_id_and_type ON services USING btree (group_id, type);
@@ -21329,6 +21712,8 @@ CREATE UNIQUE INDEX index_user_interacted_projects_on_project_id_and_user_id ON
CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id);
+CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled);
+
CREATE UNIQUE INDEX index_user_preferences_on_user_id ON user_preferences USING btree (user_id);
CREATE INDEX index_user_statuses_on_user_id ON user_statuses USING btree (user_id);
@@ -21407,12 +21792,14 @@ CREATE INDEX index_vulnerabilities_on_milestone_id ON vulnerabilities USING btre
CREATE INDEX index_vulnerabilities_on_project_id ON vulnerabilities USING btree (project_id);
-CREATE INDEX index_vulnerabilities_on_project_id_and_id ON vulnerabilities USING btree (project_id, id);
-
CREATE INDEX index_vulnerabilities_on_resolved_by_id ON vulnerabilities USING btree (resolved_by_id);
CREATE INDEX index_vulnerabilities_on_start_date_sourcing_milestone_id ON vulnerabilities USING btree (start_date_sourcing_milestone_id);
+CREATE INDEX index_vulnerabilities_on_state_case_id ON vulnerabilities USING btree (array_position(ARRAY[(1)::smallint, (4)::smallint, (3)::smallint, (2)::smallint], state), id DESC);
+
+CREATE INDEX index_vulnerabilities_on_state_case_id_desc ON vulnerabilities USING btree (array_position(ARRAY[(1)::smallint, (4)::smallint, (3)::smallint, (2)::smallint], state) DESC, id DESC);
+
CREATE INDEX index_vulnerabilities_on_updated_by_id ON vulnerabilities USING btree (updated_by_id);
CREATE INDEX index_vulnerability_exports_on_author_id ON vulnerability_exports USING btree (author_id);
@@ -21483,6 +21870,8 @@ CREATE INDEX index_web_hooks_on_type ON web_hooks USING btree (type);
CREATE UNIQUE INDEX index_webauthn_registrations_on_credential_xid ON webauthn_registrations USING btree (credential_xid);
+CREATE INDEX index_webauthn_registrations_on_u2f_registration_id ON webauthn_registrations USING btree (u2f_registration_id) WHERE (u2f_registration_id IS NOT NULL);
+
CREATE INDEX index_webauthn_registrations_on_user_id ON webauthn_registrations USING btree (user_id);
CREATE INDEX index_wiki_page_meta_on_project_id ON wiki_page_meta USING btree (project_id);
@@ -21563,15 +21952,15 @@ CREATE INDEX terraform_state_versions_verification_checksum_partial ON terraform
CREATE INDEX terraform_state_versions_verification_failure_partial ON terraform_state_versions USING btree (verification_failure) WHERE (verification_failure IS NOT NULL);
-CREATE INDEX terraform_states_verification_checksum_partial ON terraform_states USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL);
+CREATE INDEX tmp_build_stage_position_index ON ci_builds USING btree (stage_id, stage_idx) WHERE (stage_idx IS NOT NULL);
-CREATE INDEX terraform_states_verification_failure_partial ON terraform_states USING btree (verification_failure) WHERE (verification_failure IS NOT NULL);
+CREATE INDEX tmp_idx_blocked_by_type_links ON issue_links USING btree (target_id) WHERE (link_type = 2);
-CREATE INDEX tmp_build_stage_position_index ON ci_builds USING btree (stage_id, stage_idx) WHERE (stage_idx IS NOT NULL);
+CREATE INDEX tmp_idx_blocking_type_links ON issue_links USING btree (source_id) WHERE (link_type = 1);
-CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL);
+CREATE INDEX tmp_idx_index_issues_with_outdate_blocking_count ON issues USING btree (id) WHERE ((state_id = 1) AND (blocking_issues_count = 0));
-CREATE INDEX tmp_index_for_fixing_inconsistent_vulnerability_occurrences ON vulnerability_occurrences USING btree (id) WHERE ((length(location_fingerprint) = 40) AND (report_type = 2));
+CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL);
CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);
@@ -21872,6 +22261,9 @@ ALTER TABLE ONLY notification_settings
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_0d3f677137 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;
+ALTER TABLE ONLY project_pages_metadata
+ ADD CONSTRAINT fk_0fd5b22688 FOREIGN KEY (pages_deployment_id) REFERENCES pages_deployments(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY group_deletion_schedules
ADD CONSTRAINT fk_11e3ebfcdd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -21881,6 +22273,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 webauthn_registrations
+ ADD CONSTRAINT fk_13e04d719a FOREIGN KEY (u2f_registration_id) REFERENCES u2f_registrations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY protected_branch_push_access_levels
ADD CONSTRAINT fk_15d2a7a4ae FOREIGN KEY (deploy_key_id) REFERENCES keys(id) ON DELETE CASCADE;
@@ -22115,6 +22510,9 @@ ALTER TABLE ONLY merge_requests
ALTER TABLE ONLY merge_request_metrics
ADD CONSTRAINT fk_7f28d925f3 FOREIGN KEY (merged_by_id) REFERENCES users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY group_import_states
+ ADD CONSTRAINT fk_8053b3ebd6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY sprints
ADD CONSTRAINT fk_80aa8a1f95 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -22145,6 +22543,9 @@ ALTER TABLE ONLY ci_builds
ALTER TABLE ONLY vulnerabilities
ADD CONSTRAINT fk_88b4d546ef FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;
+ALTER TABLE ONLY bulk_import_entities
+ ADD CONSTRAINT fk_88c725229f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issues
ADD CONSTRAINT fk_899c8f3231 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -22223,6 +22624,9 @@ ALTER TABLE ONLY ci_builds
ALTER TABLE ONLY ci_pipelines
ADD CONSTRAINT fk_a23be95014 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY bulk_import_entities
+ ADD CONSTRAINT fk_a44ff95be5 FOREIGN KEY (parent_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY users
ADD CONSTRAINT fk_a4b8fefe3e FOREIGN KEY (managing_group_id) REFERENCES namespaces(id) ON DELETE SET NULL;
@@ -22265,6 +22669,12 @@ ALTER TABLE ONLY project_access_tokens
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 bulk_import_entities
+ ADD CONSTRAINT fk_b69fa2b2df FOREIGN KEY (bulk_import_id) REFERENCES bulk_imports(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY compliance_management_frameworks
+ ADD CONSTRAINT fk_b74c45b71f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issue_assignees
ADD CONSTRAINT fk_b7d881734a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -22280,6 +22690,9 @@ ALTER TABLE ONLY gitlab_subscriptions
ALTER TABLE ONLY metrics_users_starred_dashboards
ADD CONSTRAINT fk_bd6ae32fac FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY project_compliance_framework_settings
+ ADD CONSTRAINT fk_be413374a9 FOREIGN KEY (framework_id) REFERENCES compliance_management_frameworks(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY snippets
ADD CONSTRAINT fk_be41fd4bb7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -22319,6 +22732,9 @@ ALTER TABLE ONLY todos
ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_cff7185ad2 FOREIGN KEY (reset_checksum_event_id) REFERENCES geo_reset_checksum_events(id) ON DELETE CASCADE;
+ALTER TABLE ONLY bulk_import_entities
+ ADD CONSTRAINT fk_d06d023c30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY project_mirror_data
ADD CONSTRAINT fk_d1aad367d7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -22523,6 +22939,9 @@ ALTER TABLE ONLY user_synced_attributes_metadata
ALTER TABLE ONLY project_authorizations
ADD CONSTRAINT fk_rails_0f84bb11f3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY issue_email_participants
+ ADD CONSTRAINT fk_rails_0fdfd8b811 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_request_context_commits
ADD CONSTRAINT fk_rails_0fe0039f60 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
@@ -22556,6 +22975,9 @@ ALTER TABLE ONLY project_statistics
ALTER TABLE ONLY user_details
ADD CONSTRAINT fk_rails_12e0b3043d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY bulk_imports
+ ADD CONSTRAINT fk_rails_130a09357d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY diff_note_positions
ADD CONSTRAINT fk_rails_13c7212859 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
@@ -22595,6 +23017,9 @@ ALTER TABLE ONLY gpg_signatures
ALTER TABLE ONLY vulnerability_user_mentions
ADD CONSTRAINT fk_rails_1a41c485cd FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;
+ALTER TABLE ONLY issuable_slas
+ ADD CONSTRAINT fk_rails_1b8768cd63 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY board_assignees
ADD CONSTRAINT fk_rails_1c0ff59e82 FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -22628,6 +23053,9 @@ ALTER TABLE ONLY clusters_applications_runners
ALTER TABLE ONLY service_desk_settings
ADD CONSTRAINT fk_rails_223a296a85 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY saml_group_links
+ ADD CONSTRAINT fk_rails_22e312c530 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY group_custom_attributes
ADD CONSTRAINT fk_rails_246e0db83a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -22865,6 +23293,9 @@ ALTER TABLE ONLY status_page_settings
ALTER TABLE ONLY project_repository_storage_moves
ADD CONSTRAINT fk_rails_5106dbd44a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY bulk_import_configurations
+ ADD CONSTRAINT fk_rails_536b96bff1 FOREIGN KEY (bulk_import_id) REFERENCES bulk_imports(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY x509_commit_signatures
ADD CONSTRAINT fk_rails_53fe41188f FOREIGN KEY (x509_certificate_id) REFERENCES x509_certificates(id) ON DELETE CASCADE;
@@ -23111,6 +23542,9 @@ ALTER TABLE ONLY clusters_kubernetes_namespaces
ALTER TABLE ONLY approval_merge_request_rules_users
ADD CONSTRAINT fk_rails_80e6801803 FOREIGN KEY (approval_merge_request_rule_id) REFERENCES approval_merge_request_rules(id) ON DELETE CASCADE;
+ALTER TABLE ONLY required_code_owners_sections
+ ADD CONSTRAINT fk_rails_817708cf2d FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY dast_site_profiles
ADD CONSTRAINT fk_rails_83e309d69e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -23399,6 +23833,9 @@ ALTER TABLE ONLY elasticsearch_indexed_namespaces
ALTER TABLE ONLY vulnerability_occurrence_identifiers
ADD CONSTRAINT fk_rails_be2e49e1d0 FOREIGN KEY (identifier_id) REFERENCES vulnerability_identifiers(id) ON DELETE CASCADE;
+ALTER TABLE ONLY alert_management_http_integrations
+ ADD CONSTRAINT fk_rails_bec49f52cc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_occurrences
ADD CONSTRAINT fk_rails_bf5b788ca7 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;
@@ -23444,6 +23881,9 @@ ALTER TABLE ONLY merge_request_user_mentions
ALTER TABLE ONLY ci_job_artifacts
ADD CONSTRAINT fk_rails_c5137cb2c1 FOREIGN KEY (job_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_events
+ ADD CONSTRAINT fk_rails_c6c20d0094 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY project_settings
ADD CONSTRAINT fk_rails_c6df6e6328 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -23606,9 +24046,6 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY snippet_statistics
ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;
-ALTER TABLE ONLY cluster_providers_aws
- ADD CONSTRAINT fk_rails_ed1fdfaeb2 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY project_security_settings
ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;