Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-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
112 files changed, 1336 insertions, 67 deletions
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