summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /db
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/26_packages.rb6
-rw-r--r--db/fixtures/development/29_usage_trends.rb (renamed from db/fixtures/development/29_instance_statistics.rb)5
-rw-r--r--db/fixtures/development/30_composer_packages.rb8
-rw-r--r--db/migrate/20200816133024_add_cve_id_request_project_setting.rb13
-rw-r--r--db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb23
-rw-r--r--db/migrate/20201228110136_create_iterations_cadence.rb29
-rw-r--r--db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb22
-rw-r--r--db/migrate/20210106191305_rename_indexes_on_git_lab_com.rb57
-rw-r--r--db/migrate/20210127152613_add_iterations_cadence_date_range_constraint.rb30
-rw-r--r--db/migrate/20210127202613_remove_iteration_group_date_range_constraint.rb30
-rw-r--r--db/migrate/20210128172149_create_background_migration_tracking_tables.rb59
-rw-r--r--db/migrate/20210201034649_add_active_periods_to_on_call_rotations.rb10
-rw-r--r--db/migrate/20210205134213_add_creator_id_to_custom_emoji.rb23
-rw-r--r--db/migrate/20210208103243_add_issue_created_at_to_onboarding_progress.rb9
-rw-r--r--db/migrate/20210208200914_add_ends_at_to_oncall_rotations.rb9
-rw-r--r--db/migrate/20210209110019_create_external_approval_rules.rb44
-rw-r--r--db/migrate/20210209232508_add_markdown_surround_selection_to_user_preferences.rb21
-rw-r--r--db/migrate/20210212153934_make_the_geo_oauth_application_trusted_by_default.rb20
-rw-r--r--db/migrate/20210212163231_add_merge_when_pipeline_succeeds_to_notification_settings.rb12
-rw-r--r--db/migrate/20210214201118_add_delayed_project_removal_to_namespace_settings.rb9
-rw-r--r--db/migrate/20210214205155_add_index_to_namespaces_delayed_project_removal.rb18
-rw-r--r--db/migrate/20210216122140_add_in_product_marketing_emails_enabled_setting.rb9
-rw-r--r--db/migrate/20210216193620_add_description_to_cluster_token.rb21
-rw-r--r--db/migrate/20210216223335_remove_index_on_issues_where_service_desk_reply_to_is_not_null.rb21
-rw-r--r--db/migrate/20210217101901_create_epic_list_user_preferences.rb20
-rw-r--r--db/migrate/20210218040814_add_environment_scope_to_group_variables.rb45
-rw-r--r--db/migrate/20210218142626_change_finding_fingerprint_enum.rb15
-rw-r--r--db/migrate/20210218144056_add_sprints_start_date_not_null_check_constraint.rb17
-rw-r--r--db/migrate/20210218144656_add_sprints_due_date_not_null_check_constraint.rb17
-rw-r--r--db/migrate/20210219100137_add_creator_foreign_key_to_custom_emoji.rb23
-rw-r--r--db/migrate/20210219111040_add_epic_issue_composite_index.rb18
-rw-r--r--db/migrate/20210222030537_add_is_removed_to_oncall_participant.rb19
-rw-r--r--db/migrate/20210222042745_add_is_removed_index_to_oncall_participant.rb21
-rw-r--r--db/migrate/20210222070356_add_storage_size_to_namespace_statistics.rb19
-rw-r--r--db/migrate/20210222070413_add_wiki_size_to_namespace_statistics.rb19
-rw-r--r--db/migrate/20210222085529_add_epic_board_user_preference_user_fk.rb19
-rw-r--r--db/migrate/20210222085551_add_epic_board_user_preference_epic_list_fk.rb19
-rw-r--r--db/migrate/20210222105120_add_container_registry_access_level.rb25
-rw-r--r--db/migrate/20210223053451_add_branch_name_to_dast_profile.rb23
-rw-r--r--db/migrate/20210223132934_add_foreign_key_to_external_approval_rules.rb18
-rw-r--r--db/migrate/20210223133116_add_foreign_key_to_external_approval_rules_protected_branches.rb18
-rw-r--r--db/migrate/20210224132547_add_null_constraint_to_terraform_state_name.rb11
-rw-r--r--db/migrate/20210224133337_add_name_field_to_cluster_agent_token.rb12
-rw-r--r--db/migrate/20210225090801_create_dora_daily_metrics.rb31
-rw-r--r--db/migrate/20210225135533_limit_cluster_token_size.rb17
-rw-r--r--db/migrate/20210225153522_add_allow_force_push_to_protected_branches.rb19
-rw-r--r--db/migrate/20210301150451_add_tier_to_environments.rb19
-rw-r--r--db/migrate/20210301193412_add_optional_to_ci_build_needs.rb19
-rw-r--r--db/migrate/20210301200601_rename_asset_proxy_allowlist_on_application_settings.rb8
-rw-r--r--db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb19
-rw-r--r--db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb18
-rw-r--r--db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb18
-rw-r--r--db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb35
-rw-r--r--db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb19
-rw-r--r--db/migrate/20210303091651_add_index_to_environments_tier.rb19
-rw-r--r--db/migrate/20210303165201_add_index_for_succeeded_deployments.rb18
-rw-r--r--db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb18
-rw-r--r--db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb21
-rw-r--r--db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb16
-rw-r--r--db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb29
-rw-r--r--db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb17
-rw-r--r--db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20210306121300_partition_web_hook_logs.rb19
-rw-r--r--db/migrate/20210308125742_add_info_column_into_security_scans_table.rb9
-rw-r--r--db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb10
-rw-r--r--db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb9
-rw-r--r--db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb24
-rw-r--r--db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb14
-rw-r--r--db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb18
-rw-r--r--db/post_migrate/20201112130715_schedule_recalculate_uuid_on_vulnerabilities_occurrences.rb37
-rw-r--r--db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb26
-rw-r--r--db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb10
-rw-r--r--db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb8
-rw-r--r--db/post_migrate/20210111075206_schedule_uuid_population_for_security_findings2.rb34
-rw-r--r--db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb6
-rw-r--r--db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb84
-rw-r--r--db/post_migrate/20210215095328_migrate_delayed_project_removal_from_namespaces_to_namespace_settings.rb28
-rw-r--r--db/post_migrate/20210215144909_migrate_usage_trends_sidekiq_queue.rb19
-rw-r--r--db/post_migrate/20210217100728_move_create_release_evidence_queue_out_of_cronjob_namespace.rb16
-rw-r--r--db/post_migrate/20210218105431_remove_deprecated_ci_builds_columns.rb36
-rw-r--r--db/post_migrate/20210218110552_remove_deprecated_ci_runner_column.rb22
-rw-r--r--db/post_migrate/20210219102900_reschedule_set_default_iteration_cadences.rb30
-rw-r--r--db/post_migrate/20210222185538_remove_backup_labels_foreign_keys.rb21
-rw-r--r--db/post_migrate/20210222192144_remove_backup_labels_table.rb36
-rw-r--r--db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb44
-rw-r--r--db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb25
-rw-r--r--db/post_migrate/20210302074524_backfill_namespace_statistics_with_wiki_size.rb29
-rw-r--r--db/post_migrate/20210303064112_add_not_null_constraints_to_gitlab_subscriptions_namespace_id.rb19
-rw-r--r--db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb24
-rw-r--r--db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb25
-rw-r--r--db/post_migrate/20210304133508_schedule_remove_duplicate_vulnerabilities_findings2.rb32
-rw-r--r--db/post_migrate/20210306121310_backfill_partitioned_web_hook_logs.rb17
-rw-r--r--db/schema_migrations/201904022247491
-rw-r--r--db/schema_migrations/202008161330241
-rw-r--r--db/schema_migrations/202011121307151
-rw-r--r--db/schema_migrations/202012091631131
-rw-r--r--db/schema_migrations/202012281101361
-rw-r--r--db/schema_migrations/202012281102381
-rw-r--r--db/schema_migrations/202012311339211
-rw-r--r--db/schema_migrations/202101061913051
-rw-r--r--db/schema_migrations/202101110752061
-rw-r--r--db/schema_migrations/202101271526131
-rw-r--r--db/schema_migrations/202101272026131
-rw-r--r--db/schema_migrations/202101281721491
-rw-r--r--db/schema_migrations/202102010346491
-rw-r--r--db/schema_migrations/202102051342131
-rw-r--r--db/schema_migrations/202102081032431
-rw-r--r--db/schema_migrations/202102082009141
-rw-r--r--db/schema_migrations/202102091100191
-rw-r--r--db/schema_migrations/202102092325081
-rw-r--r--db/schema_migrations/202102102210061
-rw-r--r--db/schema_migrations/202102121539341
-rw-r--r--db/schema_migrations/202102121632311
-rw-r--r--db/schema_migrations/202102142011181
-rw-r--r--db/schema_migrations/202102142051551
-rw-r--r--db/schema_migrations/202102150953281
-rw-r--r--db/schema_migrations/202102151449091
-rw-r--r--db/schema_migrations/202102161221401
-rw-r--r--db/schema_migrations/202102161936201
-rw-r--r--db/schema_migrations/202102162233351
-rw-r--r--db/schema_migrations/202102171007281
-rw-r--r--db/schema_migrations/202102171019011
-rw-r--r--db/schema_migrations/202102180408141
-rw-r--r--db/schema_migrations/202102181054311
-rw-r--r--db/schema_migrations/202102181105521
-rw-r--r--db/schema_migrations/202102181426261
-rw-r--r--db/schema_migrations/202102181440561
-rw-r--r--db/schema_migrations/202102181446561
-rw-r--r--db/schema_migrations/202102191001371
-rw-r--r--db/schema_migrations/202102191029001
-rw-r--r--db/schema_migrations/202102191110401
-rw-r--r--db/schema_migrations/202102220305371
-rw-r--r--db/schema_migrations/202102220427451
-rw-r--r--db/schema_migrations/202102220703561
-rw-r--r--db/schema_migrations/202102220704131
-rw-r--r--db/schema_migrations/202102220855291
-rw-r--r--db/schema_migrations/202102220855511
-rw-r--r--db/schema_migrations/202102221051201
-rw-r--r--db/schema_migrations/202102221855381
-rw-r--r--db/schema_migrations/202102221921441
-rw-r--r--db/schema_migrations/202102230534511
-rw-r--r--db/schema_migrations/202102231329341
-rw-r--r--db/schema_migrations/202102231331161
-rw-r--r--db/schema_migrations/202102241325471
-rw-r--r--db/schema_migrations/202102241333371
-rw-r--r--db/schema_migrations/202102241505061
-rw-r--r--db/schema_migrations/202102250908011
-rw-r--r--db/schema_migrations/202102251355331
-rw-r--r--db/schema_migrations/202102251535221
-rw-r--r--db/schema_migrations/202102261208511
-rw-r--r--db/schema_migrations/202103011504511
-rw-r--r--db/schema_migrations/202103011934121
-rw-r--r--db/schema_migrations/202103020745241
-rw-r--r--db/schema_migrations/202103021038511
-rw-r--r--db/schema_migrations/202103021559041
-rw-r--r--db/schema_migrations/202103021605441
-rw-r--r--db/schema_migrations/202103022126231
-rw-r--r--db/schema_migrations/202103030533411
-rw-r--r--db/schema_migrations/202103030641121
-rw-r--r--db/schema_migrations/202103030641421
-rw-r--r--db/schema_migrations/202103030916511
-rw-r--r--db/schema_migrations/202103031652011
-rw-r--r--db/schema_migrations/202103031653011
-rw-r--r--db/schema_migrations/202103031653021
-rw-r--r--db/schema_migrations/202103031935441
-rw-r--r--db/schema_migrations/202103031936051
-rw-r--r--db/schema_migrations/202103041335081
-rw-r--r--db/schema_migrations/202103050020161
-rw-r--r--db/schema_migrations/202103050135091
-rw-r--r--db/schema_migrations/202103051456221
-rw-r--r--db/schema_migrations/202103061213001
-rw-r--r--db/schema_migrations/202103061213101
-rw-r--r--db/schema_migrations/202103081257421
-rw-r--r--db/schema_migrations/202103081904131
-rw-r--r--db/schema_migrations/202103091810191
-rw-r--r--db/schema_migrations/202103100006271
-rw-r--r--db/schema_migrations/202103101110091
-rw-r--r--db/structure.sql486
178 files changed, 2438 insertions, 119 deletions
diff --git a/db/fixtures/development/26_packages.rb b/db/fixtures/development/26_packages.rb
index 2a7f80c18a3..c09d3f1fef9 100644
--- a/db/fixtures/development/26_packages.rb
+++ b/db/fixtures/development/26_packages.rb
@@ -103,8 +103,10 @@ class Gitlab::Seeder::Packages
name = "MyNugetApp.Package#{i}"
version = "4.2.#{i}"
- pkg = ::Packages::Nuget::CreatePackageService.new(project, project.creator, {}).execute
- # when using ::Packages::Nuget::CreatePackageService, packages have a fixed name and a fixed version.
+ pkg = ::Packages::CreateTemporaryPackageService.new(
+ project, project.creator, {}
+ ).execute(:nuget, name: Packages::Nuget::TEMPORARY_PACKAGE_NAME)
+ # when using ::Packages::CreateTemporaryPackageService, packages have a fixed name and a fixed version.
pkg.update!(name: name, version: version)
filename = 'package.nupkg'
diff --git a/db/fixtures/development/29_instance_statistics.rb b/db/fixtures/development/29_usage_trends.rb
index 02afdc61339..f6496e5cd3d 100644
--- a/db/fixtures/development/29_instance_statistics.rb
+++ b/db/fixtures/development/29_usage_trends.rb
@@ -7,9 +7,10 @@ Gitlab::Seeder.quiet do
max_increase = 10000
max_decrease = 1000
- model_class = Analytics::InstanceStatistics::Measurement
+ model_class = Analytics::UsageTrends::Measurement
- measurements = model_class.identifiers.flat_map do |_, id|
+ # Skip generating data for billable_users, to avoid license check problems
+ measurements = model_class.identifiers.except(:billable_users).each_value.flat_map do |id|
recorded_at = 60.days.ago
current_count = rand(1_000_000)
diff --git a/db/fixtures/development/30_composer_packages.rb b/db/fixtures/development/30_composer_packages.rb
index fa8c648de9e..a30d838ad8c 100644
--- a/db/fixtures/development/30_composer_packages.rb
+++ b/db/fixtures/development/30_composer_packages.rb
@@ -110,9 +110,11 @@ Gitlab::Seeder.quiet do
next
end
- ::Packages::Composer::CreatePackageService
- .new(project, project.owner, params)
- .execute
+ Sidekiq::Worker.skipping_transaction_check do
+ ::Packages::Composer::CreatePackageService
+ .new(project, project.owner, params)
+ .execute
+ end
puts "version #{version.inspect} created!"
end
diff --git a/db/migrate/20200816133024_add_cve_id_request_project_setting.rb b/db/migrate/20200816133024_add_cve_id_request_project_setting.rb
new file mode 100644
index 00000000000..c4fe86845eb
--- /dev/null
+++ b/db/migrate/20200816133024_add_cve_id_request_project_setting.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddCveIdRequestProjectSetting < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column :project_settings, :cve_id_request_enabled, :boolean, default: true, null: false
+ end
+
+ def down
+ remove_column :project_settings, :cve_id_request_enabled
+ end
+end
diff --git a/db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb b/db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb
new file mode 100644
index 00000000000..9cbf68fd63a
--- /dev/null
+++ b/db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class RecreateIndexIssueEmailParticipantsOnIssueIdAndEmail < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_issue_email_participants_on_issue_id_and_email'
+ NEW_INDEX_NAME = 'index_issue_email_participants_on_issue_id_and_lower_email'
+
+ def up
+ # This table is currently empty, so no need to worry about unique index violations
+ add_concurrent_index :issue_email_participants, 'issue_id, lower(email)', unique: true, name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :issue_email_participants, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :issue_email_participants, [:issue_id, :email], unique: true, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :issue_email_participants, NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20201228110136_create_iterations_cadence.rb b/db/migrate/20201228110136_create_iterations_cadence.rb
new file mode 100644
index 00000000000..95601ab4b29
--- /dev/null
+++ b/db/migrate/20201228110136_create_iterations_cadence.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateIterationsCadence < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :iterations_cadences do |t|
+ t.references :group, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.date :start_date, null: false
+ t.date :last_run_date
+ t.integer :duration_in_weeks
+ t.integer :iterations_in_advance
+ t.boolean :active, default: true, null: false
+ t.boolean :automatic, default: true, null: false
+ t.text :title, null: false
+
+ t.text_limit :title, 255
+ end
+ end
+
+ def down
+ drop_table :iterations_cadences if table_exists?(:iterations_cadences)
+ end
+end
diff --git a/db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb b/db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb
new file mode 100644
index 00000000000..9d9026a265b
--- /dev/null
+++ b/db/migrate/20201228110238_add_iterations_cadence_to_sprints.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddIterationsCadenceToSprints < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_sprints_iterations_cadence_id'
+
+ def up
+ add_column :sprints, :iterations_cadence_id, :integer unless column_exists?(:sprints, :iterations_cadence_id)
+
+ add_concurrent_index :sprints, :iterations_cadence_id, name: INDEX_NAME
+ add_concurrent_foreign_key :sprints, :iterations_cadences, column: :iterations_cadence_id, on_delete: :cascade
+ end
+
+ def down
+ remove_column :sprints, :iterations_cadence_id if column_exists?(:sprints, :iterations_cadence_id)
+ end
+end
diff --git a/db/migrate/20210106191305_rename_indexes_on_git_lab_com.rb b/db/migrate/20210106191305_rename_indexes_on_git_lab_com.rb
new file mode 100644
index 00000000000..5238192e1d1
--- /dev/null
+++ b/db/migrate/20210106191305_rename_indexes_on_git_lab_com.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+# This migration aligns an existing database schema with what we actually expect
+# and fixes inconsistencies with index names and similar issues.
+#
+# This is intended for GitLab.com, but can be run on any instance.
+class RenameIndexesOnGitLabCom < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ rename_index_if_exists :ldap_group_links, 'ldap_groups_pkey', 'ldap_group_links_pkey'
+
+ # Removes unique constraint, add unique index instead
+ replace_unique_constraint_with_index :emails, :email, 'emails_email_key', 'index_emails_on_email'
+ replace_unique_constraint_with_index :users, :confirmation_token, 'users_confirmation_token_key', 'index_users_on_confirmation_token'
+ replace_unique_constraint_with_index :users, :reset_password_token, 'users_reset_password_token_key', 'index_users_on_reset_password_token'
+ replace_unique_constraint_with_index :users, :email, 'users_email_key', 'index_users_on_email'
+
+ upgrade_to_primary_key(:schema_migrations, :version, 'schema_migrations_version_key', 'schema_migrations_pkey')
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def replace_unique_constraint_with_index(table, columns, old_name, new_name)
+ return unless index_exists_by_name?(table, old_name)
+
+ add_concurrent_index table, columns, unique: true, name: new_name
+ execute "ALTER TABLE #{quote_table_name(table)} DROP CONSTRAINT #{quote_table_name(old_name)}"
+ end
+
+ def rename_index_if_exists(table, old_name, new_name)
+ return unless index_exists_by_name?(table, old_name)
+ return if index_exists_by_name?(table, new_name)
+
+ with_lock_retries do
+ rename_index table, old_name, new_name
+ end
+ end
+
+ def upgrade_to_primary_key(table, column, old_name, new_name)
+ return unless index_exists_by_name?(table, old_name)
+ return if index_exists_by_name?(table, new_name)
+
+ return if primary_key(table)
+
+ execute "ALTER TABLE #{quote_table_name(table)} ADD CONSTRAINT #{new_name} PRIMARY KEY (#{column})"
+ execute "ALTER TABLE #{quote_table_name(table)} DROP CONSTRAINT #{old_name}"
+ end
+end
diff --git a/db/migrate/20210127152613_add_iterations_cadence_date_range_constraint.rb b/db/migrate/20210127152613_add_iterations_cadence_date_range_constraint.rb
new file mode 100644
index 00000000000..95ecd167076
--- /dev/null
+++ b/db/migrate/20210127152613_add_iterations_cadence_date_range_constraint.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class AddIterationsCadenceDateRangeConstraint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE sprints
+ ADD CONSTRAINT iteration_start_and_due_date_iterations_cadence_id_constraint
+ EXCLUDE USING gist
+ ( iterations_cadence_id WITH =,
+ daterange(start_date, due_date, '[]') WITH &&
+ )
+ WHERE (group_id IS NOT NULL)
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE sprints
+ DROP CONSTRAINT IF EXISTS iteration_start_and_due_date_iterations_cadence_id_constraint
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20210127202613_remove_iteration_group_date_range_constraint.rb b/db/migrate/20210127202613_remove_iteration_group_date_range_constraint.rb
new file mode 100644
index 00000000000..e6c5eb1b411
--- /dev/null
+++ b/db/migrate/20210127202613_remove_iteration_group_date_range_constraint.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RemoveIterationGroupDateRangeConstraint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE sprints
+ DROP CONSTRAINT IF EXISTS iteration_start_and_due_daterange_group_id_constraint
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE sprints
+ ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint
+ EXCLUDE USING gist
+ ( group_id WITH =,
+ daterange(start_date, due_date, '[]') WITH &&
+ )
+ WHERE (group_id IS NOT NULL)
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20210128172149_create_background_migration_tracking_tables.rb b/db/migrate/20210128172149_create_background_migration_tracking_tables.rb
new file mode 100644
index 00000000000..767bd8737a3
--- /dev/null
+++ b/db/migrate/20210128172149_create_background_migration_tracking_tables.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+class CreateBackgroundMigrationTrackingTables < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table_with_constraints :batched_background_migrations do |t|
+ t.timestamps_with_timezone
+ t.bigint :min_value, null: false, default: 1
+ t.bigint :max_value, null: false
+ t.integer :batch_size, null: false
+ t.integer :sub_batch_size, null: false
+ t.integer :interval, limit: 2, null: false
+ t.integer :status, limit: 2, null: false, default: 0
+ t.text :job_class_name, null: false
+ t.text :batch_class_name, null: false,
+ default: 'Gitlab::Database::BackgroundMigration::PrimaryKeyBatchingStrategy'
+ t.text :table_name, null: false
+ t.text :column_name, null: false
+ t.jsonb :job_arguments, null: false, default: '[]'
+
+ t.text_limit :job_class_name, 100
+ t.text_limit :batch_class_name, 100
+ t.text_limit :table_name, 63
+ t.text_limit :column_name, 63
+
+ t.check_constraint :check_positive_min_value, 'min_value > 0'
+ t.check_constraint :check_max_value_in_range, 'max_value >= min_value'
+
+ t.check_constraint :check_positive_sub_batch_size, 'sub_batch_size > 0'
+ t.check_constraint :check_batch_size_in_range, 'batch_size >= sub_batch_size'
+
+ t.index %i[job_class_name table_name column_name], name: :index_batched_migrations_on_job_table_and_column_name
+ end
+
+ create_table :batched_background_migration_jobs do |t|
+ t.timestamps_with_timezone
+ t.datetime_with_timezone :started_at
+ t.datetime_with_timezone :finished_at
+ t.references :batched_background_migration, null: false, index: false, foreign_key: { on_delete: :cascade }
+ t.bigint :min_value, null: false
+ t.bigint :max_value, null: false
+ t.integer :batch_size, null: false
+ t.integer :sub_batch_size, null: false
+ t.integer :status, limit: 2, null: false, default: 0
+ t.integer :attempts, limit: 2, null: false, default: 0
+
+ t.index [:batched_background_migration_id, :id], name: :index_batched_jobs_by_batched_migration_id_and_id
+ end
+ end
+
+ def down
+ drop_table :batched_background_migration_jobs
+
+ drop_table :batched_background_migrations
+ end
+end
diff --git a/db/migrate/20210201034649_add_active_periods_to_on_call_rotations.rb b/db/migrate/20210201034649_add_active_periods_to_on_call_rotations.rb
new file mode 100644
index 00000000000..714187f60e0
--- /dev/null
+++ b/db/migrate/20210201034649_add_active_periods_to_on_call_rotations.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddActivePeriodsToOnCallRotations < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :incident_management_oncall_rotations, :active_period_start, :time, null: true
+ add_column :incident_management_oncall_rotations, :active_period_end, :time, null: true
+ end
+end
diff --git a/db/migrate/20210205134213_add_creator_id_to_custom_emoji.rb b/db/migrate/20210205134213_add_creator_id_to_custom_emoji.rb
new file mode 100644
index 00000000000..c01335767a8
--- /dev/null
+++ b/db/migrate/20210205134213_add_creator_id_to_custom_emoji.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddCreatorIdToCustomEmoji < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ # Custom Emoji is at the moment behind a default-disabled feature flag. It
+ # will be unlikely there are any records in this table, but to able to
+ # ensure a not-null constraint delete any existing rows.
+ # Roll-out issue: https://gitlab.com/gitlab-org/gitlab/-/issues/231317
+ execute 'DELETE FROM custom_emoji'
+
+ add_reference :custom_emoji, # rubocop:disable Migration/AddReference
+ :creator,
+ index: true,
+ null: false, # rubocop:disable Rails/NotNullColumn
+ foreign_key: false # FK is added in 20210219100137
+ end
+
+ def down
+ remove_reference :custom_emoji, :creator
+ end
+end
diff --git a/db/migrate/20210208103243_add_issue_created_at_to_onboarding_progress.rb b/db/migrate/20210208103243_add_issue_created_at_to_onboarding_progress.rb
new file mode 100644
index 00000000000..e8318ecd929
--- /dev/null
+++ b/db/migrate/20210208103243_add_issue_created_at_to_onboarding_progress.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddIssueCreatedAtToOnboardingProgress < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :onboarding_progresses, :issue_created_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210208200914_add_ends_at_to_oncall_rotations.rb b/db/migrate/20210208200914_add_ends_at_to_oncall_rotations.rb
new file mode 100644
index 00000000000..5cd179c9a80
--- /dev/null
+++ b/db/migrate/20210208200914_add_ends_at_to_oncall_rotations.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddEndsAtToOncallRotations < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :incident_management_oncall_rotations, :ends_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210209110019_create_external_approval_rules.rb b/db/migrate/20210209110019_create_external_approval_rules.rb
new file mode 100644
index 00000000000..5d6780ec412
--- /dev/null
+++ b/db/migrate/20210209110019_create_external_approval_rules.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class CreateExternalApprovalRules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+
+ def up
+ create_table_with_constraints :external_approval_rules, if_not_exists: true do |t|
+ t.references :project, foreign_key: { on_delete: :cascade }, null: false, index: false
+ t.timestamps_with_timezone
+ t.text :external_url, null: false
+ t.text_limit :external_url, 255
+ t.text :name, null: false
+ t.text_limit :name, 255
+
+ t.index([:project_id, :name],
+ unique: true,
+ name: 'idx_on_external_approval_rules_project_id_name')
+ t.index([:project_id, :external_url],
+ unique: true,
+ name: 'idx_on_external_approval_rules_project_id_external_url')
+ end
+
+ create_table :external_approval_rules_protected_branches do |t|
+ t.bigint :external_approval_rule_id, null: false, index: { name: 'idx_eaprpb_external_approval_rule_id' }
+ t.bigint :protected_branch_id, null: false
+ t.index([:protected_branch_id, :external_approval_rule_id],
+ unique: true,
+ name: 'idx_protected_branch_id_external_approval_rule_id')
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :external_approval_rules_protected_branches, force: :cascade, if_exists: true
+ end
+
+ with_lock_retries do
+ drop_table :external_approval_rules, force: :cascade, if_exists: true
+ end
+ end
+end
diff --git a/db/migrate/20210209232508_add_markdown_surround_selection_to_user_preferences.rb b/db/migrate/20210209232508_add_markdown_surround_selection_to_user_preferences.rb
new file mode 100644
index 00000000000..c4063a55d18
--- /dev/null
+++ b/db/migrate/20210209232508_add_markdown_surround_selection_to_user_preferences.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddMarkdownSurroundSelectionToUserPreferences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :user_preferences, :markdown_surround_selection, :boolean, default: true, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :user_preferences, :markdown_surround_selection, :boolean
+ end
+ end
+end
diff --git a/db/migrate/20210212153934_make_the_geo_oauth_application_trusted_by_default.rb b/db/migrate/20210212153934_make_the_geo_oauth_application_trusted_by_default.rb
new file mode 100644
index 00000000000..ab0343887e4
--- /dev/null
+++ b/db/migrate/20210212153934_make_the_geo_oauth_application_trusted_by_default.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class MakeTheGeoOauthApplicationTrustedByDefault < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ execute(<<-SQL.squish)
+ UPDATE oauth_applications
+ SET confidential = true, trusted = true
+ WHERE id IN (SELECT oauth_application_id FROM geo_nodes);
+ SQL
+ end
+
+ def down
+ # We won't be able to tell which trusted applications weren't
+ # confidential before the migration and setting all trusted
+ # applications are not confidential would introduce security
+ # issues.
+ end
+end
diff --git a/db/migrate/20210212163231_add_merge_when_pipeline_succeeds_to_notification_settings.rb b/db/migrate/20210212163231_add_merge_when_pipeline_succeeds_to_notification_settings.rb
new file mode 100644
index 00000000000..08d0a99436e
--- /dev/null
+++ b/db/migrate/20210212163231_add_merge_when_pipeline_succeeds_to_notification_settings.rb
@@ -0,0 +1,12 @@
+# 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 AddMergeWhenPipelineSucceedsToNotificationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :notification_settings, :merge_when_pipeline_succeeds, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210214201118_add_delayed_project_removal_to_namespace_settings.rb b/db/migrate/20210214201118_add_delayed_project_removal_to_namespace_settings.rb
new file mode 100644
index 00000000000..1c6e0b0c27c
--- /dev/null
+++ b/db/migrate/20210214201118_add_delayed_project_removal_to_namespace_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddDelayedProjectRemovalToNamespaceSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :namespace_settings, :delayed_project_removal, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210214205155_add_index_to_namespaces_delayed_project_removal.rb b/db/migrate/20210214205155_add_index_to_namespaces_delayed_project_removal.rb
new file mode 100644
index 00000000000..8d09a5c9269
--- /dev/null
+++ b/db/migrate/20210214205155_add_index_to_namespaces_delayed_project_removal.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexToNamespacesDelayedProjectRemoval < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'tmp_idx_on_namespaces_delayed_project_removal'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :namespaces, :id, name: INDEX_NAME, where: 'delayed_project_removal = TRUE'
+ end
+
+ def down
+ remove_concurrent_index_by_name :namespaces, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210216122140_add_in_product_marketing_emails_enabled_setting.rb b/db/migrate/20210216122140_add_in_product_marketing_emails_enabled_setting.rb
new file mode 100644
index 00000000000..5813b1b5f33
--- /dev/null
+++ b/db/migrate/20210216122140_add_in_product_marketing_emails_enabled_setting.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddInProductMarketingEmailsEnabledSetting < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :in_product_marketing_emails_enabled, :boolean, null: false, default: true
+ end
+end
diff --git a/db/migrate/20210216193620_add_description_to_cluster_token.rb b/db/migrate/20210216193620_add_description_to_cluster_token.rb
new file mode 100644
index 00000000000..67f7c6bd522
--- /dev/null
+++ b/db/migrate/20210216193620_add_description_to_cluster_token.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddDescriptionToClusterToken < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:cluster_agent_tokens, :description)
+ add_column :cluster_agent_tokens, :description, :text
+ end
+
+ add_text_limit :cluster_agent_tokens, :description, 1024
+ end
+
+ def down
+ remove_column :cluster_agent_tokens, :description
+ end
+end
diff --git a/db/migrate/20210216223335_remove_index_on_issues_where_service_desk_reply_to_is_not_null.rb b/db/migrate/20210216223335_remove_index_on_issues_where_service_desk_reply_to_is_not_null.rb
new file mode 100644
index 00000000000..5224b6f7031
--- /dev/null
+++ b/db/migrate/20210216223335_remove_index_on_issues_where_service_desk_reply_to_is_not_null.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnIssuesWhereServiceDeskReplyToIsNotNull < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_TABLE = :issues
+ INDEX_NAME = 'idx_on_issues_where_service_desk_reply_to_is_not_null'
+
+ def up
+ Gitlab::BackgroundMigration.steal('PopulateIssueEmailParticipants')
+ remove_concurrent_index_by_name INDEX_TABLE, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index(INDEX_TABLE, [:id], name: INDEX_NAME, where: 'service_desk_reply_to IS NOT NULL')
+ end
+end
diff --git a/db/migrate/20210217101901_create_epic_list_user_preferences.rb b/db/migrate/20210217101901_create_epic_list_user_preferences.rb
new file mode 100644
index 00000000000..5aacea1938d
--- /dev/null
+++ b/db/migrate/20210217101901_create_epic_list_user_preferences.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class CreateEpicListUserPreferences < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ create_table :boards_epic_list_user_preferences do |t|
+ t.bigint :user_id, null: false
+ t.bigint :epic_list_id, index: true, null: false
+ t.timestamps_with_timezone null: false
+ t.boolean :collapsed, null: false, default: false
+ end
+
+ add_index :boards_epic_list_user_preferences, [:user_id, :epic_list_id], unique: true, name: 'index_epic_board_list_preferences_on_user_and_list'
+ end
+
+ def down
+ drop_table :boards_epic_list_user_preferences
+ end
+end
diff --git a/db/migrate/20210218040814_add_environment_scope_to_group_variables.rb b/db/migrate/20210218040814_add_environment_scope_to_group_variables.rb
new file mode 100644
index 00000000000..5cc41f570aa
--- /dev/null
+++ b/db/migrate/20210218040814_add_environment_scope_to_group_variables.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+class AddEnvironmentScopeToGroupVariables < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX = 'index_ci_group_variables_on_group_id_and_key'
+ NEW_INDEX = 'index_ci_group_variables_on_group_id_and_key_and_environment'
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:ci_group_variables, :environment_scope)
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # Added in 20210305013509_add_text_limit_to_group_ci_variables_environment_scope
+ add_column :ci_group_variables, :environment_scope, :text, null: false, default: '*'
+ # rubocop:enable Migration/AddLimitToTextColumns
+ end
+
+ add_concurrent_index :ci_group_variables, [:group_id, :key, :environment_scope], unique: true, name: NEW_INDEX
+ remove_concurrent_index_by_name :ci_group_variables, OLD_INDEX
+ end
+
+ def down
+ remove_duplicates!
+
+ add_concurrent_index :ci_group_variables, [:group_id, :key], unique: true, name: OLD_INDEX
+ remove_concurrent_index_by_name :ci_group_variables, NEW_INDEX
+
+ remove_column :ci_group_variables, :environment_scope
+ end
+
+ private
+
+ def remove_duplicates!
+ execute <<-SQL
+ DELETE FROM ci_group_variables
+ WHERE id NOT IN (
+ SELECT MIN(id)
+ FROM ci_group_variables
+ GROUP BY group_id, key
+ )
+ SQL
+ end
+end
diff --git a/db/migrate/20210218142626_change_finding_fingerprint_enum.rb b/db/migrate/20210218142626_change_finding_fingerprint_enum.rb
new file mode 100644
index 00000000000..615509e0c04
--- /dev/null
+++ b/db/migrate/20210218142626_change_finding_fingerprint_enum.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ChangeFindingFingerprintEnum < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ change_column :vulnerability_finding_fingerprints, :algorithm_type, :integer, limit: 2
+ end
+
+ def down
+ change_column :vulnerability_finding_fingerprints, :algorithm_type, :integer
+ end
+end
diff --git a/db/migrate/20210218144056_add_sprints_start_date_not_null_check_constraint.rb b/db/migrate/20210218144056_add_sprints_start_date_not_null_check_constraint.rb
new file mode 100644
index 00000000000..243080f49b2
--- /dev/null
+++ b/db/migrate/20210218144056_add_sprints_start_date_not_null_check_constraint.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddSprintsStartDateNotNullCheckConstraint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint(:sprints, :start_date, validate: false)
+ end
+
+ def down
+ remove_not_null_constraint(:sprints, :start_date)
+ end
+end
diff --git a/db/migrate/20210218144656_add_sprints_due_date_not_null_check_constraint.rb b/db/migrate/20210218144656_add_sprints_due_date_not_null_check_constraint.rb
new file mode 100644
index 00000000000..9f3ed6fd13a
--- /dev/null
+++ b/db/migrate/20210218144656_add_sprints_due_date_not_null_check_constraint.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddSprintsDueDateNotNullCheckConstraint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint(:sprints, :due_date, validate: false)
+ end
+
+ def down
+ remove_not_null_constraint(:sprints, :due_date)
+ end
+end
diff --git a/db/migrate/20210219100137_add_creator_foreign_key_to_custom_emoji.rb b/db/migrate/20210219100137_add_creator_foreign_key_to_custom_emoji.rb
new file mode 100644
index 00000000000..a954ba5ba3b
--- /dev/null
+++ b/db/migrate/20210219100137_add_creator_foreign_key_to_custom_emoji.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddCreatorForeignKeyToCustomEmoji < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ FK_NAME = 'fk_custom_emoji_creator_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :custom_emoji, :users,
+ on_delete: :cascade,
+ column: :creator_id,
+ name: FK_NAME
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :custom_emoji, name: FK_NAME
+ end
+ end
+end
diff --git a/db/migrate/20210219111040_add_epic_issue_composite_index.rb b/db/migrate/20210219111040_add_epic_issue_composite_index.rb
new file mode 100644
index 00000000000..f1344baf0c7
--- /dev/null
+++ b/db/migrate/20210219111040_add_epic_issue_composite_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddEpicIssueCompositeIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_epic_issues_on_epic_id_and_issue_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :epic_issues, [:epic_id, :issue_id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :epic_issues, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210222030537_add_is_removed_to_oncall_participant.rb b/db/migrate/20210222030537_add_is_removed_to_oncall_participant.rb
new file mode 100644
index 00000000000..83b81a067ab
--- /dev/null
+++ b/db/migrate/20210222030537_add_is_removed_to_oncall_participant.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIsRemovedToOncallParticipant < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :incident_management_oncall_participants, :is_removed, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :incident_management_oncall_participants, :is_removed
+ end
+ end
+end
diff --git a/db/migrate/20210222042745_add_is_removed_index_to_oncall_participant.rb b/db/migrate/20210222042745_add_is_removed_index_to_oncall_participant.rb
new file mode 100644
index 00000000000..cfa9b1b89c9
--- /dev/null
+++ b/db/migrate/20210222042745_add_is_removed_index_to_oncall_participant.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddIsRemovedIndexToOncallParticipant < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+ EXISTING_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_rotation_id'
+ NEW_INDEX_NAME = 'index_inc_mgmnt_oncall_pcpnt_on_oncall_rotation_id_is_removed'
+
+ def up
+ add_concurrent_index :incident_management_oncall_participants, [:oncall_rotation_id, :is_removed], name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name(:incident_management_oncall_participants, EXISTING_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index :incident_management_oncall_participants, :oncall_rotation_id, name: EXISTING_INDEX_NAME
+ remove_concurrent_index_by_name(:incident_management_oncall_participants, NEW_INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210222070356_add_storage_size_to_namespace_statistics.rb b/db/migrate/20210222070356_add_storage_size_to_namespace_statistics.rb
new file mode 100644
index 00000000000..838c22382c6
--- /dev/null
+++ b/db/migrate/20210222070356_add_storage_size_to_namespace_statistics.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddStorageSizeToNamespaceStatistics < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :namespace_statistics, :storage_size, :bigint, default: 0, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_statistics, :storage_size
+ end
+ end
+end
diff --git a/db/migrate/20210222070413_add_wiki_size_to_namespace_statistics.rb b/db/migrate/20210222070413_add_wiki_size_to_namespace_statistics.rb
new file mode 100644
index 00000000000..9e6ced9fd64
--- /dev/null
+++ b/db/migrate/20210222070413_add_wiki_size_to_namespace_statistics.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddWikiSizeToNamespaceStatistics < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :namespace_statistics, :wiki_size, :bigint, default: 0, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_statistics, :wiki_size
+ end
+ end
+end
diff --git a/db/migrate/20210222085529_add_epic_board_user_preference_user_fk.rb b/db/migrate/20210222085529_add_epic_board_user_preference_user_fk.rb
new file mode 100644
index 00000000000..52de892a177
--- /dev/null
+++ b/db/migrate/20210222085529_add_epic_board_user_preference_user_fk.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddEpicBoardUserPreferenceUserFk < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :boards_epic_list_user_preferences, :users, column: :user_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :boards_epic_list_user_preferences, :users
+ end
+ end
+end
diff --git a/db/migrate/20210222085551_add_epic_board_user_preference_epic_list_fk.rb b/db/migrate/20210222085551_add_epic_board_user_preference_epic_list_fk.rb
new file mode 100644
index 00000000000..3f62036b899
--- /dev/null
+++ b/db/migrate/20210222085551_add_epic_board_user_preference_epic_list_fk.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddEpicBoardUserPreferenceEpicListFk < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :boards_epic_list_user_preferences, :boards_epic_lists, column: :epic_list_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :boards_epic_list_user_preferences, :boards_epic_lists
+ end
+ end
+end
diff --git a/db/migrate/20210222105120_add_container_registry_access_level.rb b/db/migrate/20210222105120_add_container_registry_access_level.rb
new file mode 100644
index 00000000000..2324866b0ef
--- /dev/null
+++ b/db/migrate/20210222105120_add_container_registry_access_level.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class AddContainerRegistryAccessLevel < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column(
+ :project_features,
+ :container_registry_access_level,
+ :integer,
+ default: 0, # ProjectFeature::DISABLED value
+ null: false
+ )
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :project_features, :container_registry_access_level
+ end
+ end
+end
diff --git a/db/migrate/20210223053451_add_branch_name_to_dast_profile.rb b/db/migrate/20210223053451_add_branch_name_to_dast_profile.rb
new file mode 100644
index 00000000000..311e809103f
--- /dev/null
+++ b/db/migrate/20210223053451_add_branch_name_to_dast_profile.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddBranchNameToDastProfile < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :dast_profiles, :branch_name, :text
+ end
+
+ add_text_limit :dast_profiles, :branch_name, 255
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :dast_profiles, :branch_name
+ end
+ end
+end
diff --git a/db/migrate/20210223132934_add_foreign_key_to_external_approval_rules.rb b/db/migrate/20210223132934_add_foreign_key_to_external_approval_rules.rb
new file mode 100644
index 00000000000..b5f04672813
--- /dev/null
+++ b/db/migrate/20210223132934_add_foreign_key_to_external_approval_rules.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToExternalApprovalRules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :external_approval_rules_protected_branches, :external_approval_rules, column: :external_approval_rule_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :external_approval_rules_protected_branches, column: :external_approval_rule_id
+ end
+ end
+end
diff --git a/db/migrate/20210223133116_add_foreign_key_to_external_approval_rules_protected_branches.rb b/db/migrate/20210223133116_add_foreign_key_to_external_approval_rules_protected_branches.rb
new file mode 100644
index 00000000000..ad51f765d8a
--- /dev/null
+++ b/db/migrate/20210223133116_add_foreign_key_to_external_approval_rules_protected_branches.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToExternalApprovalRulesProtectedBranches < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :external_approval_rules_protected_branches, :protected_branches, column: :protected_branch_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :external_approval_rules_protected_branches, column: :protected_branch_id
+ end
+ end
+end
diff --git a/db/migrate/20210224132547_add_null_constraint_to_terraform_state_name.rb b/db/migrate/20210224132547_add_null_constraint_to_terraform_state_name.rb
new file mode 100644
index 00000000000..d9f23311cf5
--- /dev/null
+++ b/db/migrate/20210224132547_add_null_constraint_to_terraform_state_name.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddNullConstraintToTerraformStateName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ change_column_null :terraform_states, :name, false
+ end
+end
diff --git a/db/migrate/20210224133337_add_name_field_to_cluster_agent_token.rb b/db/migrate/20210224133337_add_name_field_to_cluster_agent_token.rb
new file mode 100644
index 00000000000..2cec37f8477
--- /dev/null
+++ b/db/migrate/20210224133337_add_name_field_to_cluster_agent_token.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddNameFieldToClusterAgentToken < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in LimitClusterTokenSize
+ def change
+ add_column :cluster_agent_tokens, :name, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20210225090801_create_dora_daily_metrics.rb b/db/migrate/20210225090801_create_dora_daily_metrics.rb
new file mode 100644
index 00000000000..65c1dbc23e4
--- /dev/null
+++ b/db/migrate/20210225090801_create_dora_daily_metrics.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateDoraDailyMetrics < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ create_table :dora_daily_metrics, if_not_exists: true do |t|
+ t.references :environment, null: false, foreign_key: { on_delete: :cascade }, index: false
+ t.date :date, null: false
+ t.integer :deployment_frequency
+ t.integer :lead_time_for_changes_in_seconds
+
+ t.index [:environment_id, :date], unique: true
+ end
+ end
+
+ add_check_constraint :dora_daily_metrics, "deployment_frequency >= 0", 'dora_daily_metrics_deployment_frequency_positive'
+ add_check_constraint :dora_daily_metrics, "lead_time_for_changes_in_seconds >= 0", 'dora_daily_metrics_lead_time_for_changes_in_seconds_positive'
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :dora_daily_metrics
+ end
+ end
+end
diff --git a/db/migrate/20210225135533_limit_cluster_token_size.rb b/db/migrate/20210225135533_limit_cluster_token_size.rb
new file mode 100644
index 00000000000..6a1b6b7b4e8
--- /dev/null
+++ b/db/migrate/20210225135533_limit_cluster_token_size.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class LimitClusterTokenSize < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :cluster_agent_tokens, :name, 255
+ end
+
+ def down
+ remove_text_limit :cluster_agent_tokens, :name
+ end
+end
diff --git a/db/migrate/20210225153522_add_allow_force_push_to_protected_branches.rb b/db/migrate/20210225153522_add_allow_force_push_to_protected_branches.rb
new file mode 100644
index 00000000000..92a15cb45dd
--- /dev/null
+++ b/db/migrate/20210225153522_add_allow_force_push_to_protected_branches.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddAllowForcePushToProtectedBranches < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :protected_branches, :allow_force_push, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :protected_branches, :allow_force_push
+ end
+ end
+end
diff --git a/db/migrate/20210301150451_add_tier_to_environments.rb b/db/migrate/20210301150451_add_tier_to_environments.rb
new file mode 100644
index 00000000000..28592dd2bf6
--- /dev/null
+++ b/db/migrate/20210301150451_add_tier_to_environments.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddTierToEnvironments < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :environments, :tier, :smallint
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :environments, :tier
+ end
+ end
+end
diff --git a/db/migrate/20210301193412_add_optional_to_ci_build_needs.rb b/db/migrate/20210301193412_add_optional_to_ci_build_needs.rb
new file mode 100644
index 00000000000..2c6e85f930d
--- /dev/null
+++ b/db/migrate/20210301193412_add_optional_to_ci_build_needs.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddOptionalToCiBuildNeeds < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :ci_build_needs, :optional, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :ci_build_needs, :optional
+ end
+ end
+end
diff --git a/db/migrate/20210301200601_rename_asset_proxy_allowlist_on_application_settings.rb b/db/migrate/20210301200601_rename_asset_proxy_allowlist_on_application_settings.rb
index 8a9acd8b86e..8ac334fc6a4 100644
--- a/db/migrate/20210301200601_rename_asset_proxy_allowlist_on_application_settings.rb
+++ b/db/migrate/20210301200601_rename_asset_proxy_allowlist_on_application_settings.rb
@@ -8,6 +8,10 @@ class RenameAssetProxyAllowlistOnApplicationSettings < ActiveRecord::Migration[6
disable_ddl_transaction!
def up
+ cleanup_concurrent_column_rename :application_settings,
+ :asset_proxy_whitelist,
+ :asset_proxy_allowlist
+
rename_column_concurrently :application_settings,
:asset_proxy_allowlist,
:asset_proxy_whitelist
@@ -17,5 +21,9 @@ class RenameAssetProxyAllowlistOnApplicationSettings < ActiveRecord::Migration[6
undo_rename_column_concurrently :application_settings,
:asset_proxy_allowlist,
:asset_proxy_whitelist
+
+ undo_cleanup_concurrent_column_rename :application_settings,
+ :asset_proxy_whitelist,
+ :asset_proxy_allowlist
end
end
diff --git a/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb b/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb
new file mode 100644
index 00000000000..e10e9a912cc
--- /dev/null
+++ b/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddDeployedDeploymentIdIndexToProjectPagesMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_on_pages_metadata_not_migrated'
+
+ def up
+ add_concurrent_index :project_pages_metadata, :project_id, where: "deployed = TRUE AND pages_deployment_id is NULL", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :project_pages_metadata, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb b/db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb
new file mode 100644
index 00000000000..5d2594f2b9e
--- /dev/null
+++ b/db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveIndexForSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_sop_configs_on_security_policy_management_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:security_orchestration_policy_configurations, INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:security_orchestration_policy_configurations, :security_policy_management_project_id, name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb b/db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb
new file mode 100644
index 00000000000..4750e2bdb79
--- /dev/null
+++ b/db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexToSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX = 'index_sop_configurations_project_id_policy_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :security_orchestration_policy_configurations, [:security_policy_management_project_id, :project_id], name: INDEX
+ end
+
+ def down
+ remove_concurrent_index_by_name :security_orchestration_policy_configurations, INDEX
+ end
+end
diff --git a/db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb b/db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb
new file mode 100644
index 00000000000..0f431fbeda5
--- /dev/null
+++ b/db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RenameVulnFingerprintsIndexes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ FINGERPRINT_IDX = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint
+ FINGERPRINT_IDX_RENAMED = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint_sha256
+ UNIQ_IDX = :idx_vuln_fingerprints_uniqueness
+ UNIQ_IDX_RENAMED = :idx_vuln_fingerprints_uniqueness_fingerprint_sha256
+
+ disable_ddl_transaction!
+
+ def up
+ # These `unless` checks are necessary for re-running the migrations multiple times
+ unless index_exists_by_name?(:vulnerability_finding_fingerprints, FINGERPRINT_IDX_RENAMED)
+ rename_index :vulnerability_finding_fingerprints, FINGERPRINT_IDX, FINGERPRINT_IDX_RENAMED
+ end
+
+ unless index_exists_by_name?(:vulnerability_finding_fingerprints, UNIQ_IDX_RENAMED)
+ rename_index :vulnerability_finding_fingerprints, UNIQ_IDX, UNIQ_IDX_RENAMED
+ end
+ end
+
+ def down
+ unless index_exists_by_name?(:vulnerability_finding_fingerprints, FINGERPRINT_IDX)
+ rename_index :vulnerability_finding_fingerprints, FINGERPRINT_IDX_RENAMED, FINGERPRINT_IDX
+ end
+
+ unless index_exists_by_name?(:vulnerability_finding_fingerprints, UNIQ_IDX)
+ rename_index :vulnerability_finding_fingerprints, UNIQ_IDX_RENAMED, UNIQ_IDX
+ end
+ end
+end
diff --git a/db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb b/db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb
new file mode 100644
index 00000000000..b6f4da202fa
--- /dev/null
+++ b/db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddLastEditedAtAndLastEditedByIdToNotes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :notes, :last_edited_at, :datetime_with_timezone
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :notes, :last_edited_at
+ end
+ end
+end
diff --git a/db/migrate/20210303091651_add_index_to_environments_tier.rb b/db/migrate/20210303091651_add_index_to_environments_tier.rb
new file mode 100644
index 00000000000..0ec876945d9
--- /dev/null
+++ b/db/migrate/20210303091651_add_index_to_environments_tier.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexToEnvironmentsTier < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_environments_on_project_id_and_tier'
+
+ DOWNTIME = false
+
+ def up
+ add_concurrent_index :environments, [:project_id, :tier], where: 'tier IS NOT NULL', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :environments, :state, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210303165201_add_index_for_succeeded_deployments.rb b/db/migrate/20210303165201_add_index_for_succeeded_deployments.rb
new file mode 100644
index 00000000000..1ae5b36d2f2
--- /dev/null
+++ b/db/migrate/20210303165201_add_index_for_succeeded_deployments.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexForSucceededDeployments < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_deployments_on_environment_id_status_and_finished_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:deployments, %i[environment_id status finished_at], name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:deployments, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb b/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb
new file mode 100644
index 00000000000..5fc8970b8f9
--- /dev/null
+++ b/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintToClusterTokenName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ # This will add the `NOT NULL` constraint WITHOUT validating it
+ add_not_null_constraint :cluster_agent_tokens, :name, validate: false
+ end
+
+ def down
+ remove_not_null_constraint :cluster_agent_tokens, :name
+ end
+end
diff --git a/db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb b/db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb
new file mode 100644
index 00000000000..a2d3d6daf09
--- /dev/null
+++ b/db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddConcurrentFieldsToBulkImportsTrackers < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # rubocop:disable Rails/NotNullColumn
+ def up
+ add_column :bulk_import_trackers, :jid, :text
+ add_column :bulk_import_trackers, :stage, :smallint, default: 0, null: false
+ add_column :bulk_import_trackers, :status, :smallint, default: 0, null: false
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+ # rubocop:enable Rails/NotNullColumn
+
+ def down
+ remove_column :bulk_import_trackers, :jid, :text
+ remove_column :bulk_import_trackers, :stage, :smallint
+ remove_column :bulk_import_trackers, :status, :smallint
+ end
+end
diff --git a/db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb b/db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb
new file mode 100644
index 00000000000..7686dd0343b
--- /dev/null
+++ b/db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddTextLimitsToBulkImportsTrackersJidAndPipelineName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :bulk_import_trackers, :jid, 255
+ end
+
+ def down
+ remove_text_limit :bulk_import_trackers, :jid
+ end
+end
diff --git a/db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb b/db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb
new file mode 100644
index 00000000000..aa4a4e9c928
--- /dev/null
+++ b/db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class UpdateTerraformStatesLockedByUserIdForeignKey < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_FOREIGN_KEY = 'fk_rails_558901b030'
+ NEW_FOREIGN_KEY = 'fk_558901b030'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :terraform_states, :users,
+ column: :locked_by_user_id, on_delete: :nullify, name: NEW_FOREIGN_KEY
+
+ with_lock_retries do
+ remove_foreign_key :terraform_states, :users, name: OLD_FOREIGN_KEY
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key :terraform_states, :users,
+ column: :locked_by_user_id, on_delete: nil, name: OLD_FOREIGN_KEY
+
+ with_lock_retries do
+ remove_foreign_key :terraform_states, :users, name: NEW_FOREIGN_KEY
+ end
+ end
+end
diff --git a/db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb b/db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb
new file mode 100644
index 00000000000..f5fa073b954
--- /dev/null
+++ b/db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTextLimitToGroupCiVariablesEnvironmentScope < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :ci_group_variables, :environment_scope, 255
+ end
+
+ def down
+ remove_text_limit :ci_group_variables, :environment_scope
+ end
+end
diff --git a/db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb b/db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb
new file mode 100644
index 00000000000..d2342a66549
--- /dev/null
+++ b/db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddTerraformModuleMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :plan_limits, :terraform_module_max_file_size, :bigint, default: 1.gigabyte, null: false
+ end
+end
diff --git a/db/migrate/20210306121300_partition_web_hook_logs.rb b/db/migrate/20210306121300_partition_web_hook_logs.rb
new file mode 100644
index 00000000000..ff35a19648e
--- /dev/null
+++ b/db/migrate/20210306121300_partition_web_hook_logs.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class PartitionWebHookLogs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ partition_table_by_date :web_hook_logs, :created_at
+ end
+
+ def down
+ drop_partitioned_table_for :web_hook_logs
+ end
+end
diff --git a/db/migrate/20210308125742_add_info_column_into_security_scans_table.rb b/db/migrate/20210308125742_add_info_column_into_security_scans_table.rb
new file mode 100644
index 00000000000..d701fa98259
--- /dev/null
+++ b/db/migrate/20210308125742_add_info_column_into_security_scans_table.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddInfoColumnIntoSecurityScansTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :security_scans, :info, :jsonb, null: false, default: {}
+ end
+end
diff --git a/db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb b/db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb
new file mode 100644
index 00000000000..f841c1e9bd5
--- /dev/null
+++ b/db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class ChangeBatchedBackgroundMigrationsBatchClassNameDefault < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_default :batched_background_migrations, :batch_class_name,
+ from: 'Gitlab::Database::BackgroundMigration::PrimaryKeyBatchingStrategy', to: 'PrimaryKeyBatchingStrategy'
+ end
+end
diff --git a/db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb b/db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb
new file mode 100644
index 00000000000..2a29ab374e5
--- /dev/null
+++ b/db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddLastUsedAtToClusterAgentToken < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :cluster_agent_tokens, :last_used_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb b/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb
new file mode 100644
index 00000000000..5ffcc005225
--- /dev/null
+++ b/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIdxVulnerabilityOccurrencesDedup < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ TABLE = :vulnerability_occurrences
+ INDEX_NAME = 'index_vulnerability_occurrences_deduplication'
+ COLUMNS = %i[project_id report_type project_fingerprint]
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb b/db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb
new file mode 100644
index 00000000000..088f400efb9
--- /dev/null
+++ b/db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class AddSettingsToGroupMergeRequestApprovalSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_table(:group_merge_request_approval_settings, bulk: true) do |t|
+ t.column :allow_committer_approval, :boolean, null: false, default: false
+ t.column :allow_overrides_to_approver_list_per_merge_request, :boolean, null: false, default: false
+ t.column :retain_approvals_on_push, :boolean, null: false, default: false
+ t.column :require_password_to_approve, :boolean, null: false, default: false
+ end
+ end
+end
diff --git a/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb b/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
deleted file mode 100644
index 8ec6a4a24ec..00000000000
--- a/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleMergeRequestAssigneesMigrationProgressCheck < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- MIGRATION = 'MergeRequestAssigneesMigrationProgressCheck'
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- BackgroundMigrationWorker.perform_async(MIGRATION)
- end
-
- def down
- end
-end
diff --git a/db/post_migrate/20201112130715_schedule_recalculate_uuid_on_vulnerabilities_occurrences.rb b/db/post_migrate/20201112130715_schedule_recalculate_uuid_on_vulnerabilities_occurrences.rb
new file mode 100644
index 00000000000..7bb97a39bda
--- /dev/null
+++ b/db/post_migrate/20201112130715_schedule_recalculate_uuid_on_vulnerabilities_occurrences.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class ScheduleRecalculateUuidOnVulnerabilitiesOccurrences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ MIGRATION = 'RecalculateVulnerabilitiesOccurrencesUuid'
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 2_500
+
+ disable_ddl_transaction!
+
+ class VulnerabilitiesFinding < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = "vulnerability_occurrences"
+ end
+
+ def up
+ # Make sure that RemoveDuplicateVulnerabilitiesFindings has finished running
+ # so that we don't run into duplicate UUID issues
+ Gitlab::BackgroundMigration.steal('RemoveDuplicateVulnerabilitiesFindings')
+
+ say "Scheduling #{MIGRATION} jobs"
+ queue_background_migration_jobs_by_range_at_intervals(
+ VulnerabilitiesFinding,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb b/db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb
new file mode 100644
index 00000000000..32645430e19
--- /dev/null
+++ b/db/post_migrate/20201231133921_schedule_set_default_iteration_cadences.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ScheduleSetDefaultIterationCadences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ DELAY_INTERVAL = 2.minutes.to_i
+ MIGRATION_CLASS = 'SetDefaultIterationCadences'
+
+ class Iteration < ActiveRecord::Base # rubocop:disable Style/Documentation
+ include EachBatch
+
+ self.table_name = 'sprints'
+ end
+
+ disable_ddl_transaction!
+
+ def up
+ # Do nothing, rescheduling migration: 20210219102900_reschedule_set_default_iteration_cadences.rb
+ end
+
+ def down
+ # Not needed
+ end
+end
diff --git a/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb b/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb
index 8f6d312ae5e..87f391e240d 100644
--- a/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb
+++ b/db/post_migrate/20210105052229_clean_up_asset_proxy_whitelist_rename_on_application_settings.rb
@@ -8,14 +8,12 @@ class CleanUpAssetProxyWhitelistRenameOnApplicationSettings < ActiveRecord::Migr
disable_ddl_transaction!
def up
- cleanup_concurrent_column_rename :application_settings,
- :asset_proxy_whitelist,
- :asset_proxy_allowlist
+ # This migration has been made a no-op in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56352
+ # because to revert the rename in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55419 we need
+ # to cleanup the triggers on the `asset_proxy_allowlist` column. As such, this migration would do nothing.
end
def down
- undo_cleanup_concurrent_column_rename :application_settings,
- :asset_proxy_whitelist,
- :asset_proxy_allowlist
+ # no-op
end
end
diff --git a/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb b/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb
index 92241378495..43cfb27b94c 100644
--- a/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb
+++ b/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb
@@ -11,13 +11,7 @@ class ScheduleUuidPopulationForSecurityFindings < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
- Gitlab::BackgroundMigration::PopulateUuidsForSecurityFindings.security_findings.each_batch(column: :scan_id, of: BATCH_SIZE) do |batch, index|
- migrate_in(
- DELAY_INTERVAL * index,
- MIGRATION_CLASS,
- batch.pluck(:scan_id)
- )
- end
+ # no-op, replaced by 20210111075206_schedule_uuid_population_for_security_findings2.rb
end
def down
diff --git a/db/post_migrate/20210111075206_schedule_uuid_population_for_security_findings2.rb b/db/post_migrate/20210111075206_schedule_uuid_population_for_security_findings2.rb
new file mode 100644
index 00000000000..00569581ca4
--- /dev/null
+++ b/db/post_migrate/20210111075206_schedule_uuid_population_for_security_findings2.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+# This replaces the previous post-deployment migration 20210111075105_schedule_uuid_population_for_security_findings.rb,
+# we have to run this again due to a bug in how we were receiving the arguments in the background migration.
+class ScheduleUuidPopulationForSecurityFindings2 < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION_CLASS = 'PopulateUuidsForSecurityFindings'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 25
+
+ disable_ddl_transaction!
+
+ def up
+ ::Gitlab::BackgroundMigration.steal(MIGRATION_CLASS) do |job|
+ job.delete
+
+ false
+ end
+
+ Gitlab::BackgroundMigration::PopulateUuidsForSecurityFindings.security_findings.each_batch(column: :scan_id, of: BATCH_SIZE) do |batch, index|
+ migrate_in(
+ DELAY_INTERVAL * index,
+ MIGRATION_CLASS,
+ batch.pluck(:scan_id)
+ )
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb b/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb
index 0631cc8095e..efd0eeb9d47 100644
--- a/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb
+++ b/db/post_migrate/20210210093901_backfill_updated_at_after_repository_storage_move.rb
@@ -10,16 +10,16 @@ class BackfillUpdatedAtAfterRepositoryStorageMove < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
- class ProjectRepositoryStorageMove < ActiveRecord::Base
+ class RepositoryStorageMove < ActiveRecord::Base
include EachBatch
self.table_name = 'project_repository_storage_moves'
end
def up
- ProjectRepositoryStorageMove.reset_column_information
+ RepositoryStorageMove.reset_column_information
- ProjectRepositoryStorageMove.select(:project_id).distinct.each_batch(of: BATCH_SIZE, column: :project_id) do |batch, index|
+ RepositoryStorageMove.select(:project_id).distinct.each_batch(of: BATCH_SIZE, column: :project_id) do |batch, index|
migrate_in(
INTERVAL * index,
MIGRATION_CLASS,
diff --git a/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb b/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb
new file mode 100644
index 00000000000..4b8bf014066
--- /dev/null
+++ b/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb
@@ -0,0 +1,84 @@
+# frozen_string_literal: true
+
+class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true'.freeze
+ BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+
+ class Service < ActiveRecord::Base
+ include EachBatch
+ belongs_to :project
+
+ self.table_name = 'services'
+ self.inheritance_column = :_type_disabled
+ end
+
+ class Project < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'projects'
+ end
+
+ def up
+ update_projects_with_active_external_issue_trackers
+ update_projects_without_active_external_issue_trackers
+ end
+
+ def down
+ # no-op : can't go back to incorrect data
+ end
+
+ private
+
+ def update_projects_with_active_external_issue_trackers
+ scope = Service.where(active: true, category: 'issue_tracker').where.not(project_id: nil).distinct(:project_id)
+
+ scope.each_batch(of: BATCH_SIZE) do |relation|
+ scope_with_projects = relation
+ .joins(:project)
+ .select('project_id')
+ .merge(Project.where(has_external_issue_tracker: false).where(pending_delete: false))
+
+ execute(<<~SQL)
+ WITH project_ids_to_update (id) AS (
+ #{scope_with_projects.to_sql}
+ )
+ UPDATE projects SET has_external_issue_tracker = true WHERE id IN (SELECT id FROM project_ids_to_update)
+ SQL
+ end
+ end
+
+ def update_projects_without_active_external_issue_trackers
+ # Add a temporary index to speed up the scoping of projects.
+ index_where = <<~SQL
+ "projects"."has_external_issue_tracker" = TRUE
+ AND "projects"."pending_delete" = FALSE
+ SQL
+
+ add_concurrent_index(:projects, :id, where: index_where, name: TMP_INDEX_NAME)
+
+ services_sub_query = Service
+ .select('1')
+ .where('services.project_id = projects.id')
+ .where(category: 'issue_tracker')
+ .where(active: true)
+
+ # 322 projects are scoped in this query on GitLab.com.
+ Project.where(index_where).each_batch(of: BATCH_SIZE) do |relation|
+ relation_with_exists_query = relation.where('NOT EXISTS (?)', services_sub_query)
+ execute(<<~SQL)
+ WITH project_ids_to_update (id) AS (
+ #{relation_with_exists_query.select(:id).to_sql}
+ )
+ UPDATE projects SET has_external_issue_tracker = false WHERE id IN (SELECT id FROM project_ids_to_update)
+ SQL
+ end
+
+ # Drop the temporary index.
+ remove_concurrent_index_by_name(:projects, TMP_INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20210215095328_migrate_delayed_project_removal_from_namespaces_to_namespace_settings.rb b/db/post_migrate/20210215095328_migrate_delayed_project_removal_from_namespaces_to_namespace_settings.rb
new file mode 100644
index 00000000000..12e156d3b8a
--- /dev/null
+++ b/db/post_migrate/20210215095328_migrate_delayed_project_removal_from_namespaces_to_namespace_settings.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class MigrateDelayedProjectRemovalFromNamespacesToNamespaceSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ class Namespace < ActiveRecord::Base
+ self.table_name = 'namespaces'
+
+ include ::EachBatch
+ end
+
+ def up
+ Namespace.select(:id).where(delayed_project_removal: true).each_batch do |batch|
+ values = batch.map { |record| "(#{record.id}, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)" }
+
+ execute <<-EOF.strip_heredoc
+ INSERT INTO namespace_settings (namespace_id, delayed_project_removal, created_at, updated_at)
+ VALUES #{values.join(', ')}
+ ON CONFLICT (namespace_id) DO UPDATE
+ SET delayed_project_removal = TRUE
+ EOF
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210215144909_migrate_usage_trends_sidekiq_queue.rb b/db/post_migrate/20210215144909_migrate_usage_trends_sidekiq_queue.rb
new file mode 100644
index 00000000000..3e6eabfba97
--- /dev/null
+++ b/db/post_migrate/20210215144909_migrate_usage_trends_sidekiq_queue.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class MigrateUsageTrendsSidekiqQueue < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ sidekiq_queue_migrate 'cronjob:analytics_instance_statistics_count_job_trigger', to: 'cronjob:analytics_usage_trends_count_job_trigger'
+ sidekiq_queue_migrate 'analytics_instance_statistics_counter_job', to: 'analytics_usage_trends_counter_job'
+ end
+
+ def down
+ sidekiq_queue_migrate 'cronjob:analytics_usage_trends_count_job_trigger', to: 'cronjob:analytics_instance_statistics_count_job_trigger'
+ sidekiq_queue_migrate 'analytics_usage_trends_counter_job', to: 'analytics_instance_statistics_counter_job'
+ end
+end
diff --git a/db/post_migrate/20210217100728_move_create_release_evidence_queue_out_of_cronjob_namespace.rb b/db/post_migrate/20210217100728_move_create_release_evidence_queue_out_of_cronjob_namespace.rb
new file mode 100644
index 00000000000..22bead87dc1
--- /dev/null
+++ b/db/post_migrate/20210217100728_move_create_release_evidence_queue_out_of_cronjob_namespace.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class MoveCreateReleaseEvidenceQueueOutOfCronjobNamespace < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def up
+ sidekiq_queue_migrate 'cronjob:releases_create_evidence', to: 'releases_create_evidence'
+ end
+
+ def down
+ sidekiq_queue_migrate 'releases_create_evidence', to: 'cronjob:releases_create_evidence'
+ end
+end
diff --git a/db/post_migrate/20210218105431_remove_deprecated_ci_builds_columns.rb b/db/post_migrate/20210218105431_remove_deprecated_ci_builds_columns.rb
new file mode 100644
index 00000000000..6fa7a15a90d
--- /dev/null
+++ b/db/post_migrate/20210218105431_remove_deprecated_ci_builds_columns.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class RemoveDeprecatedCiBuildsColumns < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_column :ci_builds, :artifacts_file
+ remove_column :ci_builds, :artifacts_file_store
+ remove_column :ci_builds, :artifacts_metadata
+ remove_column :ci_builds, :artifacts_metadata_store
+ remove_column :ci_builds, :artifacts_size
+ remove_column :ci_builds, :commands
+ end
+ end
+
+ def down
+ # rubocop:disable Migration/AddColumnsToWideTables
+ with_lock_retries do
+ add_column :ci_builds, :artifacts_file, :text
+ add_column :ci_builds, :artifacts_file_store, :integer
+ add_column :ci_builds, :artifacts_metadata, :text
+ add_column :ci_builds, :artifacts_metadata_store, :integer
+ add_column :ci_builds, :artifacts_size, :bigint
+ add_column :ci_builds, :commands, :text
+ end
+ # rubocop:enable Migration/AddColumnsToWideTables
+
+ add_concurrent_index :ci_builds, :artifacts_expire_at, where: "artifacts_file <> ''::text", name: 'index_ci_builds_on_artifacts_expire_at'
+ end
+end
diff --git a/db/post_migrate/20210218110552_remove_deprecated_ci_runner_column.rb b/db/post_migrate/20210218110552_remove_deprecated_ci_runner_column.rb
new file mode 100644
index 00000000000..06fd900590b
--- /dev/null
+++ b/db/post_migrate/20210218110552_remove_deprecated_ci_runner_column.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class RemoveDeprecatedCiRunnerColumn < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_column :ci_runners, :is_shared
+ end
+ end
+
+ def down
+ add_column :ci_runners, :is_shared, :boolean, default: false unless column_exists?(:ci_runners, :is_shared)
+
+ add_concurrent_index :ci_runners, :is_shared
+ end
+end
diff --git a/db/post_migrate/20210219102900_reschedule_set_default_iteration_cadences.rb b/db/post_migrate/20210219102900_reschedule_set_default_iteration_cadences.rb
new file mode 100644
index 00000000000..6c7b46737aa
--- /dev/null
+++ b/db/post_migrate/20210219102900_reschedule_set_default_iteration_cadences.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RescheduleSetDefaultIterationCadences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ DELAY_INTERVAL = 2.minutes.to_i
+ MIGRATION_CLASS = 'SetDefaultIterationCadences'
+
+ class Iteration < ActiveRecord::Base # rubocop:disable Style/Documentation
+ include EachBatch
+
+ self.table_name = 'sprints'
+ end
+
+ disable_ddl_transaction!
+
+ def up
+ Iteration.select(:group_id).distinct.each_batch(of: BATCH_SIZE, column: :group_id) do |batch, index|
+ group_ids = batch.pluck(:group_id)
+
+ migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, group_ids)
+ end
+ end
+
+ def down
+ # Not needed
+ end
+end
diff --git a/db/post_migrate/20210222185538_remove_backup_labels_foreign_keys.rb b/db/post_migrate/20210222185538_remove_backup_labels_foreign_keys.rb
new file mode 100644
index 00000000000..614ec4875d6
--- /dev/null
+++ b/db/post_migrate/20210222185538_remove_backup_labels_foreign_keys.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveBackupLabelsForeignKeys < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:backup_labels, :projects)
+ remove_foreign_key_if_exists(:backup_labels, :namespaces)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:backup_labels, :projects, column: :project_id, on_delete: :cascade)
+ add_concurrent_foreign_key(:backup_labels, :namespaces, column: :group_id, on_delete: :cascade)
+ end
+end
diff --git a/db/post_migrate/20210222192144_remove_backup_labels_table.rb b/db/post_migrate/20210222192144_remove_backup_labels_table.rb
new file mode 100644
index 00000000000..1208c3c970f
--- /dev/null
+++ b/db/post_migrate/20210222192144_remove_backup_labels_table.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class RemoveBackupLabelsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ drop_table :backup_labels
+ end
+
+ def down
+ create_table :backup_labels, id: false do |t|
+ t.integer :id, null: false
+ t.string :title
+ t.string :color
+ t.integer :project_id
+ t.timestamps null: true # rubocop:disable Migration/Timestamps
+ t.boolean :template, default: false
+ t.string :description
+ t.text :description_html
+ t.string :type
+ t.integer :group_id
+ t.integer :cached_markdown_version
+ t.integer :restore_action
+ t.string :new_title
+ end
+
+ execute 'ALTER TABLE backup_labels ADD PRIMARY KEY (id)'
+
+ add_index :backup_labels, [:group_id, :project_id, :title], name: 'backup_labels_group_id_project_id_title_idx', unique: true
+ add_index :backup_labels, [:group_id, :title], where: 'project_id = NULL::integer', name: 'backup_labels_group_id_title_idx'
+ add_index :backup_labels, :project_id, name: 'backup_labels_project_id_idx'
+ add_index :backup_labels, :template, name: 'backup_labels_template_idx', where: 'template'
+ add_index :backup_labels, :title, name: 'backup_labels_title_idx'
+ add_index :backup_labels, [:type, :project_id], name: 'backup_labels_type_project_id_idx'
+ end
+end
diff --git a/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb b/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb
new file mode 100644
index 00000000000..af5c474e2ba
--- /dev/null
+++ b/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class RescheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'BackfillArtifactExpiryDate'.freeze
+ SWITCH_DATE = Date.new(2020, 06, 22).freeze
+
+ disable_ddl_transaction!
+
+ class JobArtifact < ActiveRecord::Base
+ include EachBatch
+
+ self.inheritance_column = :_type_disabled
+ self.table_name = 'ci_job_artifacts'
+
+ scope :without_expiry_date, -> { where(expire_at: nil) }
+ scope :before_switch, -> { where("date(created_at AT TIME ZONE 'UTC') < ?::date", SWITCH_DATE) }
+ end
+
+ def up
+ Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
+ job.delete
+
+ false
+ end
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ JobArtifact.without_expiry_date.before_switch,
+ MIGRATION,
+ 2.minutes,
+ batch_size: 200_000
+ )
+ end
+
+ def down
+ Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
+ job.delete
+
+ false
+ end
+ end
+end
diff --git a/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb b/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb
new file mode 100644
index 00000000000..7bc7a0e49f7
--- /dev/null
+++ b/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class MoveContainerRegistryEnabledToProjectFeatures < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ BATCH_SIZE = 50_000
+ MIGRATION = 'MoveContainerRegistryEnabledToProjectFeature'
+
+ disable_ddl_transaction!
+
+ class Project < ActiveRecord::Base
+ include EachBatch
+ self.table_name = 'projects'
+ end
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210302074524_backfill_namespace_statistics_with_wiki_size.rb b/db/post_migrate/20210302074524_backfill_namespace_statistics_with_wiki_size.rb
new file mode 100644
index 00000000000..e04f69f4206
--- /dev/null
+++ b/db/post_migrate/20210302074524_backfill_namespace_statistics_with_wiki_size.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class BackfillNamespaceStatisticsWithWikiSize < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 500
+ MIGRATION = 'PopulateNamespaceStatistics'
+
+ disable_ddl_transaction!
+
+ def up
+ return unless Gitlab.ee?
+
+ groups = exec_query <<~SQL
+ SELECT group_wiki_repositories.group_id
+ FROM group_wiki_repositories
+ SQL
+
+ groups.rows.flatten.in_groups_of(BATCH_SIZE, false).each_with_index do |group_ids, index|
+ migrate_in(index * DELAY_INTERVAL, MIGRATION, [group_ids, [:wiki_size]])
+ end
+ end
+
+ def down
+ # No-op
+ end
+end
diff --git a/db/post_migrate/20210303064112_add_not_null_constraints_to_gitlab_subscriptions_namespace_id.rb b/db/post_migrate/20210303064112_add_not_null_constraints_to_gitlab_subscriptions_namespace_id.rb
new file mode 100644
index 00000000000..f1d2d80a0f3
--- /dev/null
+++ b/db/post_migrate/20210303064112_add_not_null_constraints_to_gitlab_subscriptions_namespace_id.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintsToGitlabSubscriptionsNamespaceId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ # This will add the `NOT NULL` constraint WITHOUT validating it
+ add_not_null_constraint :gitlab_subscriptions, :namespace_id, validate: false
+ end
+
+ def down
+ # Down is required as `add_not_null_constraint` is not reversible
+ remove_not_null_constraint :gitlab_subscriptions, :namespace_id
+ end
+end
diff --git a/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb b/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb
new file mode 100644
index 00000000000..1fcfb3d43c0
--- /dev/null
+++ b/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class CleanupGitlabSubscriptionsWithNullNamespaceId < ActiveRecord::Migration[6.0]
+ disable_ddl_transaction!
+
+ class GitlabSubscription < ActiveRecord::Base
+ self.table_name = 'gitlab_subscriptions'
+ end
+
+ def up
+ # As of today, there is 0 records whose namespace_id is null on GitLab.com.
+ # And we expect no such records on non GitLab.com instance.
+ # So this post-migration cleanup script is just for extra safe.
+ #
+ # This will be fast on GitLab.com, because:
+ # - gitlab_subscriptions.count=5021850
+ # - namespace_id is indexed, so the query is pretty fast. Try on database-lab, this uses 5.931 ms
+ GitlabSubscription.where('namespace_id IS NULL').delete_all
+ end
+
+ def down
+ # no-op : can't go back to `NULL` without first dropping the `NOT NULL` constraint
+ end
+end
diff --git a/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb b/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb
new file mode 100644
index 00000000000..80ea1748eed
--- /dev/null
+++ b/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class CleanupClusterTokensWithNullName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ class AgentToken < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'cluster_agent_tokens'
+ end
+
+ def up
+ AgentToken.each_batch(of: BATCH_SIZE) do |relation|
+ relation.where('name IS NULL').update_all("name = 'agent-token-' || id")
+ end
+ end
+
+ def down
+ # no-op : can't go back to `NULL` without first dropping the `NOT NULL` constraint
+ end
+end
diff --git a/db/post_migrate/20210304133508_schedule_remove_duplicate_vulnerabilities_findings2.rb b/db/post_migrate/20210304133508_schedule_remove_duplicate_vulnerabilities_findings2.rb
new file mode 100644
index 00000000000..78574921fea
--- /dev/null
+++ b/db/post_migrate/20210304133508_schedule_remove_duplicate_vulnerabilities_findings2.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class ScheduleRemoveDuplicateVulnerabilitiesFindings2 < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ MIGRATION = 'RemoveDuplicateVulnerabilitiesFindings'
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 5_000
+
+ disable_ddl_transaction!
+
+ class VulnerabilitiesFinding < ActiveRecord::Base
+ include ::EachBatch
+ self.table_name = "vulnerability_occurrences"
+ end
+
+ def up
+ say "Scheduling #{MIGRATION} jobs"
+ queue_background_migration_jobs_by_range_at_intervals(
+ VulnerabilitiesFinding,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210306121310_backfill_partitioned_web_hook_logs.rb b/db/post_migrate/20210306121310_backfill_partitioned_web_hook_logs.rb
new file mode 100644
index 00000000000..3a37d8a8510
--- /dev/null
+++ b/db/post_migrate/20210306121310_backfill_partitioned_web_hook_logs.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class BackfillPartitionedWebHookLogs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ enqueue_partitioning_data_migration :web_hook_logs
+ end
+
+ def down
+ cleanup_partitioning_data_migration :web_hook_logs
+ end
+end
diff --git a/db/schema_migrations/20190402224749 b/db/schema_migrations/20190402224749
deleted file mode 100644
index 3d02e4435c5..00000000000
--- a/db/schema_migrations/20190402224749
+++ /dev/null
@@ -1 +0,0 @@
-f655a3f9f1f41710ae501c3e4ef0893791c28971d87e12f87d4b65131502b812 \ No newline at end of file
diff --git a/db/schema_migrations/20200816133024 b/db/schema_migrations/20200816133024
new file mode 100644
index 00000000000..1637f166857
--- /dev/null
+++ b/db/schema_migrations/20200816133024
@@ -0,0 +1 @@
+37196d54d03791f7509e411d5c545f22aa70f7c07d1f13d76f70008a06e72b57 \ No newline at end of file
diff --git a/db/schema_migrations/20201112130715 b/db/schema_migrations/20201112130715
new file mode 100644
index 00000000000..b241214e15e
--- /dev/null
+++ b/db/schema_migrations/20201112130715
@@ -0,0 +1 @@
+fc821ffb2e2298bfdf3555bb255e2300f3722141cadc8f89e62646fd6f22faf0 \ No newline at end of file
diff --git a/db/schema_migrations/20201209163113 b/db/schema_migrations/20201209163113
new file mode 100644
index 00000000000..a850a8d90a2
--- /dev/null
+++ b/db/schema_migrations/20201209163113
@@ -0,0 +1 @@
+a7397b8f5d00b85f8c963f04ae062393b21313d97c9b9875a88a76608b98f826 \ No newline at end of file
diff --git a/db/schema_migrations/20201228110136 b/db/schema_migrations/20201228110136
new file mode 100644
index 00000000000..51496856ff9
--- /dev/null
+++ b/db/schema_migrations/20201228110136
@@ -0,0 +1 @@
+6488e3542276042f302d79533e3e84c43a4ef471535137bcef11e73a0e4d961f \ No newline at end of file
diff --git a/db/schema_migrations/20201228110238 b/db/schema_migrations/20201228110238
new file mode 100644
index 00000000000..300b53bacee
--- /dev/null
+++ b/db/schema_migrations/20201228110238
@@ -0,0 +1 @@
+7be98c4f62df9fd837f7a547916dd5481c0b4da2d4fc6680b104b2a998be1eed \ No newline at end of file
diff --git a/db/schema_migrations/20201231133921 b/db/schema_migrations/20201231133921
new file mode 100644
index 00000000000..40f792eac8f
--- /dev/null
+++ b/db/schema_migrations/20201231133921
@@ -0,0 +1 @@
+26bf4abb73a53f71fbcb8b5cd1ae1e1539ec59e7052b3bbed95ab1de3fda3de7 \ No newline at end of file
diff --git a/db/schema_migrations/20210106191305 b/db/schema_migrations/20210106191305
new file mode 100644
index 00000000000..5fd79e227e6
--- /dev/null
+++ b/db/schema_migrations/20210106191305
@@ -0,0 +1 @@
+938977d6379e484a53857304c339a024c32d8b71c2175574a72314e461d67e3b \ No newline at end of file
diff --git a/db/schema_migrations/20210111075206 b/db/schema_migrations/20210111075206
new file mode 100644
index 00000000000..369c5316124
--- /dev/null
+++ b/db/schema_migrations/20210111075206
@@ -0,0 +1 @@
+9da5955d9f71d671a41e6d03f76f87370d6e67b6853707adb164f7ffa8c75082 \ No newline at end of file
diff --git a/db/schema_migrations/20210127152613 b/db/schema_migrations/20210127152613
new file mode 100644
index 00000000000..f5d42ea2bc5
--- /dev/null
+++ b/db/schema_migrations/20210127152613
@@ -0,0 +1 @@
+32f636ffad4d2c6a002129d6e3eaeaf5d8f420dcc1273665129dc4d23f2e0dbe \ No newline at end of file
diff --git a/db/schema_migrations/20210127202613 b/db/schema_migrations/20210127202613
new file mode 100644
index 00000000000..42d38d4c1d7
--- /dev/null
+++ b/db/schema_migrations/20210127202613
@@ -0,0 +1 @@
+951f46f88c1b07505e0b560e802a8bd701db7d379342d97b0bff3ad90e81fb02 \ No newline at end of file
diff --git a/db/schema_migrations/20210128172149 b/db/schema_migrations/20210128172149
new file mode 100644
index 00000000000..cc0e050be3e
--- /dev/null
+++ b/db/schema_migrations/20210128172149
@@ -0,0 +1 @@
+1cf1305ad5eaaef51f99f057b8a2e81731d69a6d02629c0c9a7d94dfdecbea47 \ No newline at end of file
diff --git a/db/schema_migrations/20210201034649 b/db/schema_migrations/20210201034649
new file mode 100644
index 00000000000..5cc99ebc893
--- /dev/null
+++ b/db/schema_migrations/20210201034649
@@ -0,0 +1 @@
+e5492820a8618d5599429ece04ea941e869c84c22d213d536644bcefc5775363 \ No newline at end of file
diff --git a/db/schema_migrations/20210205134213 b/db/schema_migrations/20210205134213
new file mode 100644
index 00000000000..bc2525e85cd
--- /dev/null
+++ b/db/schema_migrations/20210205134213
@@ -0,0 +1 @@
+7c368cad497ccfd86c6a92e2edfec1d2a16879eb749184b1d20c5ab4c702b974 \ No newline at end of file
diff --git a/db/schema_migrations/20210208103243 b/db/schema_migrations/20210208103243
new file mode 100644
index 00000000000..c251beb4b2f
--- /dev/null
+++ b/db/schema_migrations/20210208103243
@@ -0,0 +1 @@
+039962e291f9adde52379cac8f8278aa1b339d973fb33ae40ea7d8dc3e113fb6 \ No newline at end of file
diff --git a/db/schema_migrations/20210208200914 b/db/schema_migrations/20210208200914
new file mode 100644
index 00000000000..10a98a3d6e2
--- /dev/null
+++ b/db/schema_migrations/20210208200914
@@ -0,0 +1 @@
+e7a0121e8e21acd356daa882d8fe83242f4db180915dd0f3c25835c6c664ce0b \ No newline at end of file
diff --git a/db/schema_migrations/20210209110019 b/db/schema_migrations/20210209110019
new file mode 100644
index 00000000000..d11e6e5a167
--- /dev/null
+++ b/db/schema_migrations/20210209110019
@@ -0,0 +1 @@
+a24354264df3c12411af040903d26faf298f06a7334ef118f87b3e88b683b326 \ No newline at end of file
diff --git a/db/schema_migrations/20210209232508 b/db/schema_migrations/20210209232508
new file mode 100644
index 00000000000..d424fff0469
--- /dev/null
+++ b/db/schema_migrations/20210209232508
@@ -0,0 +1 @@
+484751de711e873e0f0f22d5951e36bf60d4826ebc95afa45e4f6cdaa0e3c024 \ No newline at end of file
diff --git a/db/schema_migrations/20210210221006 b/db/schema_migrations/20210210221006
new file mode 100644
index 00000000000..5292b5c0dce
--- /dev/null
+++ b/db/schema_migrations/20210210221006
@@ -0,0 +1 @@
+1ff1256d2deac0a1545ef7db30d8ba7969265d6c2df62f6bd20f9f1721a482cb \ No newline at end of file
diff --git a/db/schema_migrations/20210212153934 b/db/schema_migrations/20210212153934
new file mode 100644
index 00000000000..28ef55d012c
--- /dev/null
+++ b/db/schema_migrations/20210212153934
@@ -0,0 +1 @@
+233a976aab340f16ed1c896963580fb66f4c9b4dee6a34f9536a62a4f7688792 \ No newline at end of file
diff --git a/db/schema_migrations/20210212163231 b/db/schema_migrations/20210212163231
new file mode 100644
index 00000000000..e0ba3d83bf5
--- /dev/null
+++ b/db/schema_migrations/20210212163231
@@ -0,0 +1 @@
+4c6061f6ab1cb9e070a3ae87d44caf12d2c110a6033f0b33898b4b7ea7e37055 \ No newline at end of file
diff --git a/db/schema_migrations/20210214201118 b/db/schema_migrations/20210214201118
new file mode 100644
index 00000000000..9551d2ddf50
--- /dev/null
+++ b/db/schema_migrations/20210214201118
@@ -0,0 +1 @@
+8c1da1c7edba16993da93d9075ad2a3624b8c12ccf73a241e1a166014a99e254 \ No newline at end of file
diff --git a/db/schema_migrations/20210214205155 b/db/schema_migrations/20210214205155
new file mode 100644
index 00000000000..583d7ca1167
--- /dev/null
+++ b/db/schema_migrations/20210214205155
@@ -0,0 +1 @@
+7678d97de752e7a9a571d80febc74eb44c699c7b1967690d9a2391036caea5d2 \ No newline at end of file
diff --git a/db/schema_migrations/20210215095328 b/db/schema_migrations/20210215095328
new file mode 100644
index 00000000000..b360aaf4ad8
--- /dev/null
+++ b/db/schema_migrations/20210215095328
@@ -0,0 +1 @@
+25820a3d060826a082565f12a3ac96deafbbde750f5756d71e34d14801ec6148 \ No newline at end of file
diff --git a/db/schema_migrations/20210215144909 b/db/schema_migrations/20210215144909
new file mode 100644
index 00000000000..02939e3dba5
--- /dev/null
+++ b/db/schema_migrations/20210215144909
@@ -0,0 +1 @@
+2965d990ec9cf2edd610b063686f9a1d9de4c38bcba3c8439a18159812d529d4 \ No newline at end of file
diff --git a/db/schema_migrations/20210216122140 b/db/schema_migrations/20210216122140
new file mode 100644
index 00000000000..2d2faca6b19
--- /dev/null
+++ b/db/schema_migrations/20210216122140
@@ -0,0 +1 @@
+0aa6f7385cf13c2b0ee9b7d2a51b63dd208feccffecee8f08ea3d183ebb5ffb4 \ No newline at end of file
diff --git a/db/schema_migrations/20210216193620 b/db/schema_migrations/20210216193620
new file mode 100644
index 00000000000..6c8e8d4c1c4
--- /dev/null
+++ b/db/schema_migrations/20210216193620
@@ -0,0 +1 @@
+3587ba61d003385ea63ce900c1dd1c2bd1f2386abd921615b50421f1b798f553 \ No newline at end of file
diff --git a/db/schema_migrations/20210216223335 b/db/schema_migrations/20210216223335
new file mode 100644
index 00000000000..a086aaa8c91
--- /dev/null
+++ b/db/schema_migrations/20210216223335
@@ -0,0 +1 @@
+52bf190bdb219366c790a5b7c081bfb383543498780cc95a25eafcecea036426 \ No newline at end of file
diff --git a/db/schema_migrations/20210217100728 b/db/schema_migrations/20210217100728
new file mode 100644
index 00000000000..6027a27f8c2
--- /dev/null
+++ b/db/schema_migrations/20210217100728
@@ -0,0 +1 @@
+281ea05a95785b7f1d2d805bf8fe071c0fa59425eb01b46eeb69ad21f5650e29 \ No newline at end of file
diff --git a/db/schema_migrations/20210217101901 b/db/schema_migrations/20210217101901
new file mode 100644
index 00000000000..f4c38be26e0
--- /dev/null
+++ b/db/schema_migrations/20210217101901
@@ -0,0 +1 @@
+909aee5ed0ad447fec425f7252fc6dbec827a66ff720620bae1bf3a32536cb96 \ No newline at end of file
diff --git a/db/schema_migrations/20210218040814 b/db/schema_migrations/20210218040814
new file mode 100644
index 00000000000..3c55d951c14
--- /dev/null
+++ b/db/schema_migrations/20210218040814
@@ -0,0 +1 @@
+6fe34be82f9aee6cbdb729a67d1d4ac0702c8d9774a038bfd4fd9d9cb28b1a2b \ No newline at end of file
diff --git a/db/schema_migrations/20210218105431 b/db/schema_migrations/20210218105431
new file mode 100644
index 00000000000..35dda4ac6f6
--- /dev/null
+++ b/db/schema_migrations/20210218105431
@@ -0,0 +1 @@
+b5ff5aeb9cef243165d9c40db7211f61a632edb6a189c09112ef069d267bf64d \ No newline at end of file
diff --git a/db/schema_migrations/20210218110552 b/db/schema_migrations/20210218110552
new file mode 100644
index 00000000000..5fb325bdfb5
--- /dev/null
+++ b/db/schema_migrations/20210218110552
@@ -0,0 +1 @@
+7631c82f9762e643a4da9c03f3870ab1c97fae93da4975219d9ab7cd629720ec \ No newline at end of file
diff --git a/db/schema_migrations/20210218142626 b/db/schema_migrations/20210218142626
new file mode 100644
index 00000000000..e23a8139ffb
--- /dev/null
+++ b/db/schema_migrations/20210218142626
@@ -0,0 +1 @@
+063c97800eec5bfc7f6879dbe559fa39952295d5ba947cf44ad03ac23212e924 \ No newline at end of file
diff --git a/db/schema_migrations/20210218144056 b/db/schema_migrations/20210218144056
new file mode 100644
index 00000000000..566015ad8be
--- /dev/null
+++ b/db/schema_migrations/20210218144056
@@ -0,0 +1 @@
+545747e86481c74832a6df55764ab97ecfefc4446df9cc2366a8ce9d9c400ea4 \ No newline at end of file
diff --git a/db/schema_migrations/20210218144656 b/db/schema_migrations/20210218144656
new file mode 100644
index 00000000000..622877a279e
--- /dev/null
+++ b/db/schema_migrations/20210218144656
@@ -0,0 +1 @@
+91969bfc791cd7bc78b940aa6fed345b13a3186db0b89828428b798aa4f7949e \ No newline at end of file
diff --git a/db/schema_migrations/20210219100137 b/db/schema_migrations/20210219100137
new file mode 100644
index 00000000000..c573c4fde5f
--- /dev/null
+++ b/db/schema_migrations/20210219100137
@@ -0,0 +1 @@
+be2ddc15e16d7d59bd050a60faaa0b6941d94ba7c47a88be473bcf3a17bb2763 \ No newline at end of file
diff --git a/db/schema_migrations/20210219102900 b/db/schema_migrations/20210219102900
new file mode 100644
index 00000000000..b0a730c4361
--- /dev/null
+++ b/db/schema_migrations/20210219102900
@@ -0,0 +1 @@
+42e06332b279aaac7044243df0a8bd5525025db7d8c22bc474c0874e85f525f5 \ No newline at end of file
diff --git a/db/schema_migrations/20210219111040 b/db/schema_migrations/20210219111040
new file mode 100644
index 00000000000..a006ece2f6c
--- /dev/null
+++ b/db/schema_migrations/20210219111040
@@ -0,0 +1 @@
+546802f93f64e346b066438e78ace5d2dc54de8a5f6234c2d01296a239cfe74c \ No newline at end of file
diff --git a/db/schema_migrations/20210222030537 b/db/schema_migrations/20210222030537
new file mode 100644
index 00000000000..ad30eb19333
--- /dev/null
+++ b/db/schema_migrations/20210222030537
@@ -0,0 +1 @@
+44b0e2b3e32e45fb557a5c9c41f69de94a5d41bad43267f00090b9c527b2b1e1 \ No newline at end of file
diff --git a/db/schema_migrations/20210222042745 b/db/schema_migrations/20210222042745
new file mode 100644
index 00000000000..306b8401e65
--- /dev/null
+++ b/db/schema_migrations/20210222042745
@@ -0,0 +1 @@
+88bbd8cbc4398c3c05a834c4d8d36ee55aca9d698da3cf3c1df0afe916bc051f \ No newline at end of file
diff --git a/db/schema_migrations/20210222070356 b/db/schema_migrations/20210222070356
new file mode 100644
index 00000000000..256bb771dde
--- /dev/null
+++ b/db/schema_migrations/20210222070356
@@ -0,0 +1 @@
+2aa618cdbb6e55c3af1fa144ae3f3bd0d9d5400706db337301d2d165ba789ef0 \ No newline at end of file
diff --git a/db/schema_migrations/20210222070413 b/db/schema_migrations/20210222070413
new file mode 100644
index 00000000000..f1ba0c51922
--- /dev/null
+++ b/db/schema_migrations/20210222070413
@@ -0,0 +1 @@
+e13856c6f65d86dae9a3268f91189bb90af236c555d2f645c6ba4c600c996cba \ No newline at end of file
diff --git a/db/schema_migrations/20210222085529 b/db/schema_migrations/20210222085529
new file mode 100644
index 00000000000..63f47781b3b
--- /dev/null
+++ b/db/schema_migrations/20210222085529
@@ -0,0 +1 @@
+858cd59ea324e3653801055c7f3fae2152b04ac175945a59faa00d67ae7fa223 \ No newline at end of file
diff --git a/db/schema_migrations/20210222085551 b/db/schema_migrations/20210222085551
new file mode 100644
index 00000000000..f0ba3562c3a
--- /dev/null
+++ b/db/schema_migrations/20210222085551
@@ -0,0 +1 @@
+9e6f99ed0c3d4d76a8c290308805cabf84aa7e5fb6dc2b06d973d9d8726fc4d8 \ No newline at end of file
diff --git a/db/schema_migrations/20210222105120 b/db/schema_migrations/20210222105120
new file mode 100644
index 00000000000..768aea442f5
--- /dev/null
+++ b/db/schema_migrations/20210222105120
@@ -0,0 +1 @@
+4da0131929bf59dd4a72bf05a889063df7978f8b5782e5f3b27d466302dc44b6 \ No newline at end of file
diff --git a/db/schema_migrations/20210222185538 b/db/schema_migrations/20210222185538
new file mode 100644
index 00000000000..20229c9be20
--- /dev/null
+++ b/db/schema_migrations/20210222185538
@@ -0,0 +1 @@
+0bccf1ff356a4b9c08d472e8b63070b497f331c2dfaded1bdb2cf01860df8903 \ No newline at end of file
diff --git a/db/schema_migrations/20210222192144 b/db/schema_migrations/20210222192144
new file mode 100644
index 00000000000..b53b1668a1f
--- /dev/null
+++ b/db/schema_migrations/20210222192144
@@ -0,0 +1 @@
+b2508d46edbfbba24df65731f6e285886acbb6352a900dd1c6a985a686252ef0 \ No newline at end of file
diff --git a/db/schema_migrations/20210223053451 b/db/schema_migrations/20210223053451
new file mode 100644
index 00000000000..ad40bb0fa71
--- /dev/null
+++ b/db/schema_migrations/20210223053451
@@ -0,0 +1 @@
+1266bf92f23a42d96778bf546534882f03d2388f22640e4cfaa2a9a1aad19093 \ No newline at end of file
diff --git a/db/schema_migrations/20210223132934 b/db/schema_migrations/20210223132934
new file mode 100644
index 00000000000..6e2b0696bad
--- /dev/null
+++ b/db/schema_migrations/20210223132934
@@ -0,0 +1 @@
+99ee6773319af0fa7a1dfef92f67cc95141c892bf7adcf500d46adc1ebd4c70f \ No newline at end of file
diff --git a/db/schema_migrations/20210223133116 b/db/schema_migrations/20210223133116
new file mode 100644
index 00000000000..235053e8fe8
--- /dev/null
+++ b/db/schema_migrations/20210223133116
@@ -0,0 +1 @@
+991041c8d3092175165834a988eb32141e49d7785cda756c8a78170b4af6db64 \ No newline at end of file
diff --git a/db/schema_migrations/20210224132547 b/db/schema_migrations/20210224132547
new file mode 100644
index 00000000000..f38b394f082
--- /dev/null
+++ b/db/schema_migrations/20210224132547
@@ -0,0 +1 @@
+ac0f71b427be1fb583474e352ce9468a1270c6e67fa40f9071751a0485f21160 \ No newline at end of file
diff --git a/db/schema_migrations/20210224133337 b/db/schema_migrations/20210224133337
new file mode 100644
index 00000000000..d5dafb9fb56
--- /dev/null
+++ b/db/schema_migrations/20210224133337
@@ -0,0 +1 @@
+964e9f88018b2ab72fd370f6a8dccde218cfd4ffa3ccedf4f142ab341f5e858f \ No newline at end of file
diff --git a/db/schema_migrations/20210224150506 b/db/schema_migrations/20210224150506
new file mode 100644
index 00000000000..672b2f53a46
--- /dev/null
+++ b/db/schema_migrations/20210224150506
@@ -0,0 +1 @@
+cc9f56a872cf5e9084e863adc599545754594fb03f30f18433923e0429986e39 \ No newline at end of file
diff --git a/db/schema_migrations/20210225090801 b/db/schema_migrations/20210225090801
new file mode 100644
index 00000000000..364623d6634
--- /dev/null
+++ b/db/schema_migrations/20210225090801
@@ -0,0 +1 @@
+65f27401a76856d6cb284078204bb1b80797fa344e1a4ef3d9638c296f2d72d7 \ No newline at end of file
diff --git a/db/schema_migrations/20210225135533 b/db/schema_migrations/20210225135533
new file mode 100644
index 00000000000..e7c24096aac
--- /dev/null
+++ b/db/schema_migrations/20210225135533
@@ -0,0 +1 @@
+526174bd42327e0212b15ffbad99541887de1dec35cc4c592d4f02065026b3ca \ No newline at end of file
diff --git a/db/schema_migrations/20210225153522 b/db/schema_migrations/20210225153522
new file mode 100644
index 00000000000..6c985a2ed14
--- /dev/null
+++ b/db/schema_migrations/20210225153522
@@ -0,0 +1 @@
+ec071087de45291ae8fc0d6d6e778d16a7411a934e4a301f62890061abcaed4c \ No newline at end of file
diff --git a/db/schema_migrations/20210226120851 b/db/schema_migrations/20210226120851
new file mode 100644
index 00000000000..f03c7b332be
--- /dev/null
+++ b/db/schema_migrations/20210226120851
@@ -0,0 +1 @@
+ced4e314f2653ff56a946d334b4cb12085825b8d21ceea42cb686bef688b714c \ No newline at end of file
diff --git a/db/schema_migrations/20210301150451 b/db/schema_migrations/20210301150451
new file mode 100644
index 00000000000..1d644ccb62e
--- /dev/null
+++ b/db/schema_migrations/20210301150451
@@ -0,0 +1 @@
+6c52ab55814241b37014949976c4f3a0c63bea0a4f9a301735cc9f4c509f433d \ No newline at end of file
diff --git a/db/schema_migrations/20210301193412 b/db/schema_migrations/20210301193412
new file mode 100644
index 00000000000..7e5616b210f
--- /dev/null
+++ b/db/schema_migrations/20210301193412
@@ -0,0 +1 @@
+2929e4796e85fa6cf8b5950fb57295ae87c48c914d0a71123a29d579d797d636 \ No newline at end of file
diff --git a/db/schema_migrations/20210302074524 b/db/schema_migrations/20210302074524
new file mode 100644
index 00000000000..be35539d1f0
--- /dev/null
+++ b/db/schema_migrations/20210302074524
@@ -0,0 +1 @@
+251c0d811eee00f78e62f4d1e7f2893b2137fbf8121cefc4283c3217677b5447 \ No newline at end of file
diff --git a/db/schema_migrations/20210302103851 b/db/schema_migrations/20210302103851
new file mode 100644
index 00000000000..cd166f974a9
--- /dev/null
+++ b/db/schema_migrations/20210302103851
@@ -0,0 +1 @@
+b2dad27276941e17248f86764196525bd91b088eed78ad7aa6ae2e5a2c9e82bd \ No newline at end of file
diff --git a/db/schema_migrations/20210302155904 b/db/schema_migrations/20210302155904
new file mode 100644
index 00000000000..b9f1297934c
--- /dev/null
+++ b/db/schema_migrations/20210302155904
@@ -0,0 +1 @@
+104e767518d55a7caa5ff517efe978287beb629649c681a2871ada8a677a0e13 \ No newline at end of file
diff --git a/db/schema_migrations/20210302160544 b/db/schema_migrations/20210302160544
new file mode 100644
index 00000000000..fd1b67c16bf
--- /dev/null
+++ b/db/schema_migrations/20210302160544
@@ -0,0 +1 @@
+e5c589decb2bc8d3e37451bf9977a810308ee37f5f02ed96226e0be87f8b908d \ No newline at end of file
diff --git a/db/schema_migrations/20210302212623 b/db/schema_migrations/20210302212623
new file mode 100644
index 00000000000..f7e2ab33416
--- /dev/null
+++ b/db/schema_migrations/20210302212623
@@ -0,0 +1 @@
+283645d1791a8d72fa7e327799ede933d89bd69d8db2a87b7ff437a2f5d74da3 \ No newline at end of file
diff --git a/db/schema_migrations/20210303053341 b/db/schema_migrations/20210303053341
new file mode 100644
index 00000000000..115b5655f4f
--- /dev/null
+++ b/db/schema_migrations/20210303053341
@@ -0,0 +1 @@
+3bd7e839c4f93716a7e893bf9184306a1fcfd401e5b54f4393e5138e2776f5e0 \ No newline at end of file
diff --git a/db/schema_migrations/20210303064112 b/db/schema_migrations/20210303064112
new file mode 100644
index 00000000000..42164b222b7
--- /dev/null
+++ b/db/schema_migrations/20210303064112
@@ -0,0 +1 @@
+5b8f32bafe4bffd30b9235f9b6ba5774a26d5c4c9f1e987d3e840056f8abdd52 \ No newline at end of file
diff --git a/db/schema_migrations/20210303064142 b/db/schema_migrations/20210303064142
new file mode 100644
index 00000000000..9ac9716c8e7
--- /dev/null
+++ b/db/schema_migrations/20210303064142
@@ -0,0 +1 @@
+70c5b76788460bd098c3ae3f75c7b18194c7765e1462f5305feaf2400f7dd4ff \ No newline at end of file
diff --git a/db/schema_migrations/20210303091651 b/db/schema_migrations/20210303091651
new file mode 100644
index 00000000000..35d2ca084b8
--- /dev/null
+++ b/db/schema_migrations/20210303091651
@@ -0,0 +1 @@
+e1641d84828e3d87aea626dbce6b3b2d231d08fcf1475991fe8d11714cdb0af0 \ No newline at end of file
diff --git a/db/schema_migrations/20210303165201 b/db/schema_migrations/20210303165201
new file mode 100644
index 00000000000..55181591e3f
--- /dev/null
+++ b/db/schema_migrations/20210303165201
@@ -0,0 +1 @@
+0a5d306735047101692bbdb37aa829bf70a225af6db7213a8c2eb8168f9a30e9 \ No newline at end of file
diff --git a/db/schema_migrations/20210303165301 b/db/schema_migrations/20210303165301
new file mode 100644
index 00000000000..c040288a283
--- /dev/null
+++ b/db/schema_migrations/20210303165301
@@ -0,0 +1 @@
+fa82a0f6c57a527a143da56ae0d70245a7d711b5e5ff3eb959fd6b2cf5872dac \ No newline at end of file
diff --git a/db/schema_migrations/20210303165302 b/db/schema_migrations/20210303165302
new file mode 100644
index 00000000000..f140d636482
--- /dev/null
+++ b/db/schema_migrations/20210303165302
@@ -0,0 +1 @@
+1cb74abdc7134c3252425c3ceb8cd9dc4b157d64b1a2ff7928153e78b05d9121 \ No newline at end of file
diff --git a/db/schema_migrations/20210303193544 b/db/schema_migrations/20210303193544
new file mode 100644
index 00000000000..ee00730b633
--- /dev/null
+++ b/db/schema_migrations/20210303193544
@@ -0,0 +1 @@
+4d88c8ff507a985d90ed13dc16eba068e440efd12e5ec72782cef2a4bc3cf9e7 \ No newline at end of file
diff --git a/db/schema_migrations/20210303193605 b/db/schema_migrations/20210303193605
new file mode 100644
index 00000000000..f0460522a0e
--- /dev/null
+++ b/db/schema_migrations/20210303193605
@@ -0,0 +1 @@
+d79c7059c9d79b3e437ed649f19e587e713ba8dbd0af9f58ace4f4f522b4ac11 \ No newline at end of file
diff --git a/db/schema_migrations/20210304133508 b/db/schema_migrations/20210304133508
new file mode 100644
index 00000000000..c57b04c24fb
--- /dev/null
+++ b/db/schema_migrations/20210304133508
@@ -0,0 +1 @@
+a6bf41632fc3d81d2c015d2d848f4e74468ec8cfeb2a2afb644fd92189e95e21 \ No newline at end of file
diff --git a/db/schema_migrations/20210305002016 b/db/schema_migrations/20210305002016
new file mode 100644
index 00000000000..a4bc67d505a
--- /dev/null
+++ b/db/schema_migrations/20210305002016
@@ -0,0 +1 @@
+c91541048b119bcbbe9454760c6a90ddb6c4dc90e121f3ee7f4cdd6a1bde2c9e \ No newline at end of file
diff --git a/db/schema_migrations/20210305013509 b/db/schema_migrations/20210305013509
new file mode 100644
index 00000000000..6649e76508b
--- /dev/null
+++ b/db/schema_migrations/20210305013509
@@ -0,0 +1 @@
+743344bb057d0e368c69cc3c90f72d560359d0753acf069e7423928c778a140a \ No newline at end of file
diff --git a/db/schema_migrations/20210305145622 b/db/schema_migrations/20210305145622
new file mode 100644
index 00000000000..4a4c89a03c8
--- /dev/null
+++ b/db/schema_migrations/20210305145622
@@ -0,0 +1 @@
+be22d5a1c61cbb8b2396a351951ffcee54fbf37dc5ef5f899576a36a14200e75 \ No newline at end of file
diff --git a/db/schema_migrations/20210306121300 b/db/schema_migrations/20210306121300
new file mode 100644
index 00000000000..f46097b1126
--- /dev/null
+++ b/db/schema_migrations/20210306121300
@@ -0,0 +1 @@
+44d53ac15c5e54c2f1c825286155dec643b82573184026caaf08288512168aef \ No newline at end of file
diff --git a/db/schema_migrations/20210306121310 b/db/schema_migrations/20210306121310
new file mode 100644
index 00000000000..8713032f2d4
--- /dev/null
+++ b/db/schema_migrations/20210306121310
@@ -0,0 +1 @@
+90072e3dee4517061ff9e08decda7fecb9cc9b38a56345c09685e3cce48a8b66 \ No newline at end of file
diff --git a/db/schema_migrations/20210308125742 b/db/schema_migrations/20210308125742
new file mode 100644
index 00000000000..9090fa4dc5e
--- /dev/null
+++ b/db/schema_migrations/20210308125742
@@ -0,0 +1 @@
+a81f3555d0e1159569687d4967edcd2b5706cdafd5defb8dc725e295eb969861 \ No newline at end of file
diff --git a/db/schema_migrations/20210308190413 b/db/schema_migrations/20210308190413
new file mode 100644
index 00000000000..9ddde51b57e
--- /dev/null
+++ b/db/schema_migrations/20210308190413
@@ -0,0 +1 @@
+cc131cf37f2af8f0f58c7fa6e5055e88a3b2ed413862c155b0d18383aba06058 \ No newline at end of file
diff --git a/db/schema_migrations/20210309181019 b/db/schema_migrations/20210309181019
new file mode 100644
index 00000000000..3055268acc8
--- /dev/null
+++ b/db/schema_migrations/20210309181019
@@ -0,0 +1 @@
+a31b85b8ab0db2ad4daa5f2c15eacae97432e75e0e0a28f10d81f6a5aa94c8e0 \ No newline at end of file
diff --git a/db/schema_migrations/20210310000627 b/db/schema_migrations/20210310000627
new file mode 100644
index 00000000000..b52703908c9
--- /dev/null
+++ b/db/schema_migrations/20210310000627
@@ -0,0 +1 @@
+71cea758ecb70049468531f70c52aec021060cd48e58155de0ba118786562ac6 \ No newline at end of file
diff --git a/db/schema_migrations/20210310111009 b/db/schema_migrations/20210310111009
new file mode 100644
index 00000000000..9fa502b1226
--- /dev/null
+++ b/db/schema_migrations/20210310111009
@@ -0,0 +1 @@
+8b5a69947c44c9c1050f4989e3b373d3eb87832111d0202992c7dd992032c9d1 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index c6b3b7ea997..8936087bd2b 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -41,6 +41,62 @@ RETURN NULL;
END
$$;
+CREATE FUNCTION table_sync_function_29bc99d6db() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+IF (TG_OP = 'DELETE') THEN
+ DELETE FROM web_hook_logs_part_0c5294f417 where id = OLD.id;
+ELSIF (TG_OP = 'UPDATE') THEN
+ UPDATE web_hook_logs_part_0c5294f417
+ SET web_hook_id = NEW.web_hook_id,
+ trigger = NEW.trigger,
+ url = NEW.url,
+ request_headers = NEW.request_headers,
+ request_data = NEW.request_data,
+ response_headers = NEW.response_headers,
+ response_body = NEW.response_body,
+ response_status = NEW.response_status,
+ execution_duration = NEW.execution_duration,
+ internal_error_message = NEW.internal_error_message,
+ updated_at = NEW.updated_at,
+ created_at = NEW.created_at
+ WHERE web_hook_logs_part_0c5294f417.id = NEW.id;
+ELSIF (TG_OP = 'INSERT') THEN
+ INSERT INTO web_hook_logs_part_0c5294f417 (id,
+ web_hook_id,
+ trigger,
+ url,
+ request_headers,
+ request_data,
+ response_headers,
+ response_body,
+ response_status,
+ execution_duration,
+ internal_error_message,
+ updated_at,
+ created_at)
+ VALUES (NEW.id,
+ NEW.web_hook_id,
+ NEW.trigger,
+ NEW.url,
+ NEW.request_headers,
+ NEW.request_data,
+ NEW.response_headers,
+ NEW.response_body,
+ NEW.response_status,
+ NEW.execution_duration,
+ NEW.internal_error_message,
+ NEW.updated_at,
+ NEW.created_at);
+END IF;
+RETURN NULL;
+
+END
+$$;
+
+COMMENT ON FUNCTION table_sync_function_29bc99d6db() IS 'Partitioning migration: table sync for web_hook_logs table';
+
CREATE FUNCTION table_sync_function_2be879775d() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -114,6 +170,23 @@ CREATE TABLE audit_events (
)
PARTITION BY RANGE (created_at);
+CREATE TABLE web_hook_logs_part_0c5294f417 (
+ id bigint NOT NULL,
+ web_hook_id integer NOT NULL,
+ trigger character varying,
+ url character varying,
+ request_headers text,
+ request_data text,
+ response_headers text,
+ response_body text,
+ response_status character varying,
+ execution_duration double precision,
+ internal_error_message character varying,
+ updated_at timestamp without time zone NOT NULL,
+ created_at timestamp without time zone NOT NULL
+)
+PARTITION BY RANGE (created_at);
+
CREATE TABLE product_analytics_events_experimental (
id bigint NOT NULL,
project_id integer NOT NULL,
@@ -9398,6 +9471,7 @@ CREATE TABLE application_settings (
notes_create_limit integer DEFAULT 300 NOT NULL,
notes_create_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL,
+ in_product_marketing_emails_enabled boolean DEFAULT true NOT NULL,
asset_proxy_whitelist text,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
@@ -9746,23 +9820,6 @@ CREATE SEQUENCE background_migration_jobs_id_seq
ALTER SEQUENCE background_migration_jobs_id_seq OWNED BY background_migration_jobs.id;
-CREATE TABLE backup_labels (
- id integer NOT NULL,
- title character varying,
- color character varying,
- project_id integer,
- created_at timestamp without time zone,
- updated_at timestamp without time zone,
- template boolean DEFAULT false,
- description character varying,
- description_html text,
- type character varying,
- group_id integer,
- cached_markdown_version integer,
- restore_action integer,
- new_title character varying
-);
-
CREATE TABLE badges (
id integer NOT NULL,
link_url character varying NOT NULL,
@@ -9784,6 +9841,64 @@ CREATE SEQUENCE badges_id_seq
ALTER SEQUENCE badges_id_seq OWNED BY badges.id;
+CREATE TABLE batched_background_migration_jobs (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ started_at timestamp with time zone,
+ finished_at timestamp with time zone,
+ batched_background_migration_id bigint NOT NULL,
+ min_value bigint NOT NULL,
+ max_value bigint NOT NULL,
+ batch_size integer NOT NULL,
+ sub_batch_size integer NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
+ attempts smallint DEFAULT 0 NOT NULL
+);
+
+CREATE SEQUENCE batched_background_migration_jobs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE batched_background_migration_jobs_id_seq OWNED BY batched_background_migration_jobs.id;
+
+CREATE TABLE batched_background_migrations (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ min_value bigint DEFAULT 1 NOT NULL,
+ max_value bigint NOT NULL,
+ batch_size integer NOT NULL,
+ sub_batch_size integer NOT NULL,
+ "interval" smallint NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
+ job_class_name text NOT NULL,
+ batch_class_name text DEFAULT 'PrimaryKeyBatchingStrategy'::text NOT NULL,
+ table_name text NOT NULL,
+ column_name text NOT NULL,
+ job_arguments jsonb DEFAULT '"[]"'::jsonb NOT NULL,
+ CONSTRAINT check_5bb0382d6f CHECK ((char_length(column_name) <= 63)),
+ CONSTRAINT check_6b6a06254a CHECK ((char_length(table_name) <= 63)),
+ CONSTRAINT check_batch_size_in_range CHECK ((batch_size >= sub_batch_size)),
+ CONSTRAINT check_e6c75b1e29 CHECK ((char_length(job_class_name) <= 100)),
+ CONSTRAINT check_fe10674721 CHECK ((char_length(batch_class_name) <= 100)),
+ CONSTRAINT check_max_value_in_range CHECK ((max_value >= min_value)),
+ CONSTRAINT check_positive_min_value CHECK ((min_value > 0)),
+ CONSTRAINT check_positive_sub_batch_size CHECK ((sub_batch_size > 0))
+);
+
+CREATE SEQUENCE batched_background_migrations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE batched_background_migrations_id_seq OWNED BY batched_background_migrations.id;
+
CREATE TABLE board_assignees (
id integer NOT NULL,
board_id integer NOT NULL,
@@ -9935,6 +10050,24 @@ CREATE SEQUENCE boards_epic_boards_id_seq
ALTER SEQUENCE boards_epic_boards_id_seq OWNED BY boards_epic_boards.id;
+CREATE TABLE boards_epic_list_user_preferences (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ epic_list_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ collapsed boolean DEFAULT false NOT NULL
+);
+
+CREATE SEQUENCE boards_epic_list_user_preferences_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE boards_epic_list_user_preferences_id_seq OWNED BY boards_epic_list_user_preferences.id;
+
CREATE TABLE boards_epic_lists (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -10086,8 +10219,12 @@ CREATE TABLE bulk_import_trackers (
relation text NOT NULL,
next_page text,
has_next_page boolean DEFAULT false NOT NULL,
+ jid text,
+ stage smallint DEFAULT 0 NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_2d45cae629 CHECK ((char_length(relation) <= 255)),
CONSTRAINT check_40aeaa600b CHECK ((char_length(next_page) <= 255)),
+ CONSTRAINT check_603f91cb06 CHECK ((char_length(jid) <= 255)),
CONSTRAINT check_next_page_requirement CHECK (((has_next_page IS FALSE) OR (next_page IS NOT NULL)))
);
@@ -10162,7 +10299,8 @@ CREATE TABLE ci_build_needs (
id integer NOT NULL,
build_id integer NOT NULL,
name text NOT NULL,
- artifacts boolean DEFAULT true NOT NULL
+ artifacts boolean DEFAULT true NOT NULL,
+ optional boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE ci_build_needs_id_seq
@@ -10264,7 +10402,6 @@ CREATE TABLE ci_builds (
runner_id integer,
coverage double precision,
commit_id integer,
- commands text,
name character varying,
options text,
allow_failure boolean DEFAULT false NOT NULL,
@@ -10277,14 +10414,11 @@ CREATE TABLE ci_builds (
type character varying,
target_url character varying,
description character varying,
- artifacts_file text,
project_id integer,
- artifacts_metadata text,
erased_by_id integer,
erased_at timestamp without time zone,
artifacts_expire_at timestamp without time zone,
environment character varying,
- artifacts_size bigint,
"when" character varying,
yaml_variables text,
queued_at timestamp without time zone,
@@ -10294,8 +10428,6 @@ CREATE TABLE ci_builds (
auto_canceled_by_id integer,
retried boolean,
stage_id integer,
- artifacts_file_store integer,
- artifacts_metadata_store integer,
protected boolean,
failure_reason integer,
scheduled_at timestamp with time zone,
@@ -10428,7 +10560,9 @@ CREATE TABLE ci_group_variables (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
masked boolean DEFAULT false NOT NULL,
- variable_type smallint DEFAULT 1 NOT NULL
+ variable_type smallint DEFAULT 1 NOT NULL,
+ environment_scope text DEFAULT '*'::text NOT NULL,
+ CONSTRAINT check_dfe009485a CHECK ((char_length(environment_scope) <= 255))
);
CREATE SEQUENCE ci_group_variables_id_seq
@@ -10830,7 +10964,6 @@ CREATE TABLE ci_runners (
description character varying,
contacted_at timestamp without time zone,
active boolean DEFAULT true NOT NULL,
- is_shared boolean DEFAULT false,
name character varying,
version character varying,
revision character varying,
@@ -11026,6 +11159,11 @@ CREATE TABLE cluster_agent_tokens (
agent_id bigint NOT NULL,
token_encrypted text NOT NULL,
created_by_user_id bigint,
+ description text,
+ name text,
+ last_used_at timestamp with time zone,
+ CONSTRAINT check_2b79dbb315 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_4e4ec5070a CHECK ((char_length(description) <= 1024)),
CONSTRAINT check_c60daed227 CHECK ((char_length(token_encrypted) <= 255))
);
@@ -11607,6 +11745,7 @@ CREATE TABLE custom_emoji (
name text NOT NULL,
file text NOT NULL,
external boolean DEFAULT true NOT NULL,
+ creator_id bigint NOT NULL,
CONSTRAINT check_8c586dd507 CHECK ((char_length(name) <= 36)),
CONSTRAINT check_dd5d60f1fb CHECK ((char_length(file) <= 255))
);
@@ -11629,7 +11768,9 @@ CREATE TABLE dast_profiles (
updated_at timestamp with time zone NOT NULL,
name text NOT NULL,
description text NOT NULL,
+ branch_name text,
CONSTRAINT check_5fcf73bf61 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_6c9d775949 CHECK ((char_length(branch_name) <= 255)),
CONSTRAINT check_c34e505c24 CHECK ((char_length(description) <= 255))
);
@@ -12016,6 +12157,25 @@ CREATE SEQUENCE diff_note_positions_id_seq
ALTER SEQUENCE diff_note_positions_id_seq OWNED BY diff_note_positions.id;
+CREATE TABLE dora_daily_metrics (
+ id bigint NOT NULL,
+ environment_id bigint NOT NULL,
+ date date NOT NULL,
+ deployment_frequency integer,
+ lead_time_for_changes_in_seconds integer,
+ CONSTRAINT dora_daily_metrics_deployment_frequency_positive CHECK ((deployment_frequency >= 0)),
+ CONSTRAINT dora_daily_metrics_lead_time_for_changes_in_seconds_positive CHECK ((lead_time_for_changes_in_seconds >= 0))
+);
+
+CREATE SEQUENCE dora_daily_metrics_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE dora_daily_metrics_id_seq OWNED BY dora_daily_metrics.id;
+
CREATE TABLE draft_notes (
id bigint NOT NULL,
merge_request_id integer NOT NULL,
@@ -12135,7 +12295,8 @@ CREATE TABLE environments (
state character varying DEFAULT 'available'::character varying NOT NULL,
slug character varying NOT NULL,
auto_stop_at timestamp with time zone,
- auto_delete_at timestamp with time zone
+ auto_delete_at timestamp with time zone,
+ tier smallint
);
CREATE SEQUENCE environments_id_seq
@@ -12342,6 +12503,41 @@ CREATE SEQUENCE experiments_id_seq
ALTER SEQUENCE experiments_id_seq OWNED BY experiments.id;
+CREATE TABLE external_approval_rules (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ external_url text NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_1c64b53ea5 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_b634ca168d CHECK ((char_length(external_url) <= 255))
+);
+
+CREATE SEQUENCE external_approval_rules_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE external_approval_rules_id_seq OWNED BY external_approval_rules.id;
+
+CREATE TABLE external_approval_rules_protected_branches (
+ id bigint NOT NULL,
+ external_approval_rule_id bigint NOT NULL,
+ protected_branch_id bigint NOT NULL
+);
+
+CREATE SEQUENCE external_approval_rules_protected_branches_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE external_approval_rules_protected_branches_id_seq OWNED BY external_approval_rules_protected_branches.id;
+
CREATE TABLE external_pull_requests (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -13075,7 +13271,11 @@ CREATE TABLE group_merge_request_approval_settings (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
group_id bigint NOT NULL,
- allow_author_approval boolean DEFAULT false NOT NULL
+ allow_author_approval boolean DEFAULT false NOT NULL,
+ allow_committer_approval boolean DEFAULT false NOT NULL,
+ allow_overrides_to_approver_list_per_merge_request boolean DEFAULT false NOT NULL,
+ retain_approvals_on_push boolean DEFAULT false NOT NULL,
+ require_password_to_approve boolean DEFAULT false NOT NULL
);
CREATE TABLE group_repository_storage_moves (
@@ -13191,7 +13391,8 @@ CREATE TABLE incident_management_oncall_participants (
oncall_rotation_id bigint NOT NULL,
user_id bigint NOT NULL,
color_palette smallint NOT NULL,
- color_weight smallint NOT NULL
+ color_weight smallint NOT NULL,
+ is_removed boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE incident_management_oncall_participants_id_seq
@@ -13212,6 +13413,9 @@ CREATE TABLE incident_management_oncall_rotations (
length_unit smallint NOT NULL,
starts_at timestamp with time zone NOT NULL,
name text NOT NULL,
+ ends_at timestamp with time zone,
+ active_period_start time without time zone,
+ active_period_end time without time zone,
CONSTRAINT check_5209fb5d02 CHECK ((char_length(name) <= 200))
);
@@ -13544,6 +13748,30 @@ CREATE TABLE issues_self_managed_prometheus_alert_events (
updated_at timestamp with time zone NOT NULL
);
+CREATE TABLE iterations_cadences (
+ id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ start_date date NOT NULL,
+ last_run_date date,
+ duration_in_weeks integer,
+ iterations_in_advance integer,
+ active boolean DEFAULT true NOT NULL,
+ automatic boolean DEFAULT true NOT NULL,
+ title text NOT NULL,
+ CONSTRAINT check_fedff82d3b CHECK ((char_length(title) <= 255))
+);
+
+CREATE SEQUENCE iterations_cadences_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE iterations_cadences_id_seq OWNED BY iterations_cadences.id;
+
CREATE TABLE jira_connect_installations (
id bigint NOT NULL,
client_key character varying,
@@ -14339,6 +14567,7 @@ CREATE TABLE namespace_settings (
allow_mfa_for_subgroups boolean DEFAULT true NOT NULL,
default_branch_name text,
repository_read_only boolean DEFAULT false NOT NULL,
+ delayed_project_removal boolean DEFAULT false NOT NULL,
CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255))
);
@@ -14346,7 +14575,9 @@ CREATE TABLE namespace_statistics (
id integer NOT NULL,
namespace_id integer NOT NULL,
shared_runners_seconds integer DEFAULT 0 NOT NULL,
- shared_runners_seconds_last_reset timestamp without time zone
+ shared_runners_seconds_last_reset timestamp without time zone,
+ storage_size bigint DEFAULT 0 NOT NULL,
+ wiki_size bigint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE namespace_statistics_id_seq
@@ -14467,7 +14698,8 @@ CREATE TABLE notes (
change_position text,
resolved_by_push boolean,
review_id bigint,
- confidential boolean
+ confidential boolean,
+ last_edited_at timestamp with time zone
);
CREATE SEQUENCE notes_id_seq
@@ -14506,7 +14738,8 @@ CREATE TABLE notification_settings (
fixed_pipeline boolean,
new_release boolean,
moved_project boolean DEFAULT true NOT NULL,
- change_reviewer_merge_request boolean
+ change_reviewer_merge_request boolean,
+ merge_when_pipeline_succeeds boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE notification_settings_id_seq
@@ -14621,7 +14854,8 @@ CREATE TABLE onboarding_progresses (
security_scan_enabled_at timestamp with time zone,
issue_auto_closed_at timestamp with time zone,
repository_imported_at timestamp with time zone,
- repository_mirrored_at timestamp with time zone
+ repository_mirrored_at timestamp with time zone,
+ issue_created_at timestamp with time zone
);
CREATE SEQUENCE onboarding_progresses_id_seq
@@ -15529,7 +15763,8 @@ CREATE TABLE plan_limits (
ci_pipeline_deployments integer DEFAULT 500 NOT NULL,
pull_mirror_interval_seconds integer DEFAULT 300 NOT NULL,
daily_invites integer DEFAULT 0 NOT NULL,
- rubygems_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL
+ rubygems_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
+ terraform_module_max_file_size bigint DEFAULT 1073741824 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
@@ -15977,7 +16212,8 @@ CREATE TABLE project_features (
requirements_access_level integer DEFAULT 20 NOT NULL,
operations_access_level integer DEFAULT 20 NOT NULL,
analytics_access_level integer DEFAULT 20 NOT NULL,
- security_and_compliance_access_level integer DEFAULT 10 NOT NULL
+ security_and_compliance_access_level integer DEFAULT 10 NOT NULL,
+ container_registry_access_level integer DEFAULT 0 NOT NULL
);
CREATE SEQUENCE project_features_id_seq
@@ -16179,6 +16415,7 @@ CREATE TABLE project_settings (
has_vulnerabilities boolean DEFAULT false NOT NULL,
allow_editing_commit_messages boolean DEFAULT false NOT NULL,
prevent_merge_without_jira_issue boolean DEFAULT false NOT NULL,
+ cve_id_request_enabled boolean DEFAULT true NOT NULL,
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL))
);
@@ -16449,7 +16686,8 @@ CREATE TABLE protected_branches (
name character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
- code_owner_approval_required boolean DEFAULT false NOT NULL
+ code_owner_approval_required boolean DEFAULT false NOT NULL,
+ allow_force_push boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE protected_branches_id_seq
@@ -17017,7 +17255,8 @@ CREATE TABLE security_scans (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
build_id bigint NOT NULL,
- scan_type smallint NOT NULL
+ scan_type smallint NOT NULL,
+ info jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE SEQUENCE security_scans_id_seq
@@ -17357,6 +17596,7 @@ CREATE TABLE sprints (
description text,
description_html text,
state_enum smallint DEFAULT 1 NOT NULL,
+ iterations_cadence_id integer,
CONSTRAINT sprints_must_belong_to_project_or_group CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL)))),
CONSTRAINT sprints_title CHECK ((char_length(title) <= 255))
);
@@ -17562,7 +17802,7 @@ CREATE TABLE terraform_states (
locked_at timestamp with time zone,
locked_by_user_id bigint,
uuid character varying(32) NOT NULL,
- name character varying(255),
+ name character varying(255) NOT NULL,
versioning_enabled boolean DEFAULT true NOT NULL
);
@@ -17851,7 +18091,8 @@ CREATE TABLE user_preferences (
tab_width smallint,
experience_level smallint,
view_diffs_file_by_file boolean DEFAULT false NOT NULL,
- gitpod_enabled boolean DEFAULT false NOT NULL
+ gitpod_enabled boolean DEFAULT false NOT NULL,
+ markdown_surround_selection boolean DEFAULT true NOT NULL
);
CREATE SEQUENCE user_preferences_id_seq
@@ -18180,7 +18421,7 @@ CREATE TABLE vulnerability_finding_fingerprints (
finding_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
- algorithm_type integer NOT NULL,
+ algorithm_type smallint NOT NULL,
fingerprint_sha256 bytea NOT NULL
);
@@ -18718,6 +18959,10 @@ ALTER TABLE ONLY background_migration_jobs ALTER COLUMN id SET DEFAULT nextval('
ALTER TABLE ONLY badges ALTER COLUMN id SET DEFAULT nextval('badges_id_seq'::regclass);
+ALTER TABLE ONLY batched_background_migration_jobs ALTER COLUMN id SET DEFAULT nextval('batched_background_migration_jobs_id_seq'::regclass);
+
+ALTER TABLE ONLY batched_background_migrations ALTER COLUMN id SET DEFAULT nextval('batched_background_migrations_id_seq'::regclass);
+
ALTER TABLE ONLY board_assignees ALTER COLUMN id SET DEFAULT nextval('board_assignees_id_seq'::regclass);
ALTER TABLE ONLY board_group_recent_visits ALTER COLUMN id SET DEFAULT nextval('board_group_recent_visits_id_seq'::regclass);
@@ -18736,6 +18981,8 @@ ALTER TABLE ONLY boards_epic_board_positions ALTER COLUMN id SET DEFAULT nextval
ALTER TABLE ONLY boards_epic_boards ALTER COLUMN id SET DEFAULT nextval('boards_epic_boards_id_seq'::regclass);
+ALTER TABLE ONLY boards_epic_list_user_preferences ALTER COLUMN id SET DEFAULT nextval('boards_epic_list_user_preferences_id_seq'::regclass);
+
ALTER TABLE ONLY boards_epic_lists ALTER COLUMN id SET DEFAULT nextval('boards_epic_lists_id_seq'::regclass);
ALTER TABLE ONLY boards_epic_user_preferences ALTER COLUMN id SET DEFAULT nextval('boards_epic_user_preferences_id_seq'::regclass);
@@ -18926,6 +19173,8 @@ ALTER TABLE ONLY design_user_mentions ALTER COLUMN id SET DEFAULT nextval('desig
ALTER TABLE ONLY diff_note_positions ALTER COLUMN id SET DEFAULT nextval('diff_note_positions_id_seq'::regclass);
+ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_daily_metrics_id_seq'::regclass);
+
ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass);
ALTER TABLE ONLY elastic_reindexing_subtasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_subtasks_id_seq'::regclass);
@@ -18954,6 +19203,10 @@ ALTER TABLE ONLY experiment_users ALTER COLUMN id SET DEFAULT nextval('experimen
ALTER TABLE ONLY experiments ALTER COLUMN id SET DEFAULT nextval('experiments_id_seq'::regclass);
+ALTER TABLE ONLY external_approval_rules ALTER COLUMN id SET DEFAULT nextval('external_approval_rules_id_seq'::regclass);
+
+ALTER TABLE ONLY external_approval_rules_protected_branches ALTER COLUMN id SET DEFAULT nextval('external_approval_rules_protected_branches_id_seq'::regclass);
+
ALTER TABLE ONLY external_pull_requests ALTER COLUMN id SET DEFAULT nextval('external_pull_requests_id_seq'::regclass);
ALTER TABLE ONLY feature_gates ALTER COLUMN id SET DEFAULT nextval('feature_gates_id_seq'::regclass);
@@ -19068,6 +19321,8 @@ ALTER TABLE ONLY issue_user_mentions ALTER COLUMN id SET DEFAULT nextval('issue_
ALTER TABLE ONLY issues ALTER COLUMN id SET DEFAULT nextval('issues_id_seq'::regclass);
+ALTER TABLE ONLY iterations_cadences ALTER COLUMN id SET DEFAULT nextval('iterations_cadences_id_seq'::regclass);
+
ALTER TABLE ONLY jira_connect_installations ALTER COLUMN id SET DEFAULT nextval('jira_connect_installations_id_seq'::regclass);
ALTER TABLE ONLY jira_connect_subscriptions ALTER COLUMN id SET DEFAULT nextval('jira_connect_subscriptions_id_seq'::regclass);
@@ -19786,12 +20041,15 @@ ALTER TABLE ONLY aws_roles
ALTER TABLE ONLY background_migration_jobs
ADD CONSTRAINT background_migration_jobs_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY backup_labels
- ADD CONSTRAINT backup_labels_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY badges
ADD CONSTRAINT badges_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY batched_background_migration_jobs
+ ADD CONSTRAINT batched_background_migration_jobs_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY batched_background_migrations
+ ADD CONSTRAINT batched_background_migrations_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY board_assignees
ADD CONSTRAINT board_assignees_pkey PRIMARY KEY (id);
@@ -19816,6 +20074,9 @@ ALTER TABLE ONLY boards_epic_board_positions
ALTER TABLE ONLY boards_epic_boards
ADD CONSTRAINT boards_epic_boards_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY boards_epic_list_user_preferences
+ ADD CONSTRAINT boards_epic_list_user_preferences_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY boards_epic_lists
ADD CONSTRAINT boards_epic_lists_pkey PRIMARY KEY (id);
@@ -19849,12 +20110,24 @@ ALTER TABLE ONLY chat_names
ALTER TABLE ONLY chat_teams
ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);
+ALTER TABLE cluster_agent_tokens
+ ADD CONSTRAINT check_0fb634d04d CHECK ((name IS NOT NULL)) NOT VALID;
+
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
+ALTER TABLE gitlab_subscriptions
+ ADD CONSTRAINT check_77fea3f0e7 CHECK ((namespace_id IS NOT NULL)) NOT VALID;
+
+ALTER TABLE sprints
+ ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID;
+
ALTER TABLE group_import_states
ADD CONSTRAINT check_cda75c7c3f CHECK ((user_id IS NOT NULL)) NOT VALID;
+ALTER TABLE sprints
+ ADD CONSTRAINT check_df3816aed7 CHECK ((due_date IS NOT NULL)) NOT VALID;
+
ALTER TABLE ONLY ci_build_needs
ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id);
@@ -20122,6 +20395,9 @@ ALTER TABLE ONLY design_user_mentions
ALTER TABLE ONLY diff_note_positions
ADD CONSTRAINT diff_note_positions_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dora_daily_metrics
+ ADD CONSTRAINT dora_daily_metrics_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY draft_notes
ADD CONSTRAINT draft_notes_pkey PRIMARY KEY (id);
@@ -20170,6 +20446,12 @@ ALTER TABLE ONLY experiment_users
ALTER TABLE ONLY experiments
ADD CONSTRAINT experiments_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY external_approval_rules
+ ADD CONSTRAINT external_approval_rules_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY external_approval_rules_protected_branches
+ ADD CONSTRAINT external_approval_rules_protected_branches_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY external_pull_requests
ADD CONSTRAINT external_pull_requests_pkey PRIMARY KEY (id);
@@ -20363,11 +20645,14 @@ ALTER TABLE ONLY issues_self_managed_prometheus_alert_events
ADD CONSTRAINT issues_self_managed_prometheus_alert_events_pkey PRIMARY KEY (issue_id, self_managed_prometheus_alert_event_id);
ALTER TABLE ONLY sprints
- ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint EXCLUDE USING gist (group_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL));
+ ADD CONSTRAINT iteration_start_and_due_date_iterations_cadence_id_constraint EXCLUDE USING gist (iterations_cadence_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL));
ALTER TABLE ONLY sprints
ADD CONSTRAINT iteration_start_and_due_daterange_project_id_constraint EXCLUDE USING gist (project_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((project_id IS NOT NULL));
+ALTER TABLE ONLY iterations_cadences
+ ADD CONSTRAINT iterations_cadences_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY jira_connect_installations
ADD CONSTRAINT jira_connect_installations_pkey PRIMARY KEY (id);
@@ -21058,6 +21343,9 @@ ALTER TABLE ONLY vulnerability_statistics
ALTER TABLE ONLY vulnerability_user_mentions
ADD CONSTRAINT vulnerability_user_mentions_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY web_hook_logs_part_0c5294f417
+ ADD CONSTRAINT web_hook_logs_part_0c5294f417_pkey PRIMARY KEY (id, created_at);
+
ALTER TABLE ONLY web_hook_logs
ADD CONSTRAINT web_hook_logs_pkey PRIMARY KEY (id);
@@ -21231,18 +21519,6 @@ CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_proj
CREATE INDEX approval_mr_rule_index_merge_request_id ON approval_merge_request_rules USING btree (merge_request_id);
-CREATE UNIQUE INDEX backup_labels_group_id_project_id_title_idx ON backup_labels USING btree (group_id, project_id, title);
-
-CREATE INDEX backup_labels_group_id_title_idx ON backup_labels USING btree (group_id, title) WHERE (project_id = NULL::integer);
-
-CREATE INDEX backup_labels_project_id_idx ON backup_labels USING btree (project_id);
-
-CREATE INDEX backup_labels_template_idx ON backup_labels USING btree (template) WHERE template;
-
-CREATE INDEX backup_labels_title_idx ON backup_labels USING btree (title);
-
-CREATE INDEX backup_labels_type_project_id_idx ON backup_labels USING btree (type, project_id);
-
CREATE UNIQUE INDEX bulk_import_trackers_uniq_relation_by_entity ON bulk_import_trackers USING btree (bulk_import_entity_id, relation);
CREATE INDEX ci_builds_gitlab_monitor_metrics ON ci_builds USING btree (status, created_at, project_id) WHERE ((type)::text = 'Ci::Build'::text);
@@ -21277,6 +21553,8 @@ CREATE INDEX idx_container_repositories_on_exp_cleanup_status_and_start_date ON
CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace);
+CREATE INDEX idx_eaprpb_external_approval_rule_id ON external_approval_rules_protected_branches USING btree (external_approval_rule_id);
+
CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_merge_requests USING btree (environment_id, merge_request_id);
CREATE INDEX idx_geo_con_rep_updated_events_on_container_repository_id ON geo_container_repository_updated_events USING btree (container_repository_id);
@@ -21317,7 +21595,9 @@ CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_c
CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name);
-CREATE INDEX idx_on_issues_where_service_desk_reply_to_is_not_null ON issues USING btree (id) WHERE (service_desk_reply_to IS NOT NULL);
+CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_external_url ON external_approval_rules USING btree (project_id, external_url);
+
+CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_name ON external_approval_rules USING btree (project_id, name);
CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id);
@@ -21347,6 +21627,8 @@ CREATE INDEX idx_projects_id_created_at_disable_overriding_approvers_true ON pro
CREATE INDEX idx_projects_on_repository_storage_last_repository_updated_at ON projects USING btree (id, repository_storage, last_repository_updated_at);
+CREATE UNIQUE INDEX idx_protected_branch_id_external_approval_rule_id ON external_approval_rules_protected_branches USING btree (protected_branch_id, external_approval_rule_id);
+
CREATE INDEX idx_repository_states_on_last_repository_verification_ran_at ON project_repository_states USING btree (project_id, last_repository_verification_ran_at) WHERE ((repository_verification_checksum IS NOT NULL) AND (last_repository_verification_failure IS NULL));
CREATE INDEX idx_repository_states_on_last_wiki_verification_ran_at ON project_repository_states USING btree (project_id, last_wiki_verification_ran_at) WHERE ((wiki_verification_checksum IS NOT NULL) AND (last_wiki_verification_failure IS NULL));
@@ -21363,9 +21645,9 @@ CREATE INDEX idx_security_scans_on_scan_type ON security_scans USING btree (scan
CREATE UNIQUE INDEX idx_serverless_domain_cluster_on_clusters_applications_knative ON serverless_domain_cluster USING btree (clusters_applications_knative_id);
-CREATE UNIQUE INDEX idx_vuln_fingerprints_on_occurrences_id_and_fingerprint ON vulnerability_finding_fingerprints USING btree (finding_id, fingerprint_sha256);
+CREATE UNIQUE INDEX idx_vuln_fingerprints_on_occurrences_id_and_fingerprint_sha256 ON vulnerability_finding_fingerprints USING btree (finding_id, fingerprint_sha256);
-CREATE UNIQUE INDEX idx_vuln_fingerprints_uniqueness ON vulnerability_finding_fingerprints USING btree (finding_id, algorithm_type, fingerprint_sha256);
+CREATE UNIQUE INDEX idx_vuln_fingerprints_uniqueness_fingerprint_sha256 ON vulnerability_finding_fingerprints USING btree (finding_id, algorithm_type, fingerprint_sha256);
CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue ON vulnerability_external_issue_links USING btree (vulnerability_id, external_type, external_project_key, external_issue_key);
@@ -21519,6 +21801,10 @@ CREATE INDEX index_badges_on_group_id ON badges USING btree (group_id);
CREATE INDEX index_badges_on_project_id ON badges USING btree (project_id);
+CREATE INDEX index_batched_jobs_by_batched_migration_id_and_id ON batched_background_migration_jobs USING btree (batched_background_migration_id, id);
+
+CREATE INDEX index_batched_migrations_on_job_table_and_column_name ON batched_background_migrations USING btree (job_class_name, table_name, column_name);
+
CREATE INDEX index_board_assignees_on_assignee_id ON board_assignees USING btree (assignee_id);
CREATE UNIQUE INDEX index_board_assignees_on_board_id_and_assignee_id ON board_assignees USING btree (board_id, assignee_id);
@@ -21561,6 +21847,8 @@ CREATE INDEX index_boards_epic_board_positions_on_scoped_relative_position ON bo
CREATE INDEX index_boards_epic_boards_on_group_id ON boards_epic_boards USING btree (group_id);
+CREATE INDEX index_boards_epic_list_user_preferences_on_epic_list_id ON boards_epic_list_user_preferences USING btree (epic_list_id);
+
CREATE INDEX index_boards_epic_lists_on_epic_board_id ON boards_epic_lists USING btree (epic_board_id);
CREATE UNIQUE INDEX index_boards_epic_lists_on_epic_board_id_and_label_id ON boards_epic_lists USING btree (epic_board_id, label_id) WHERE (list_type = 1);
@@ -21629,8 +21917,6 @@ CREATE INDEX index_ci_builds_metadata_on_build_id_and_id_and_interruptible ON ci
CREATE INDEX index_ci_builds_metadata_on_project_id ON ci_builds_metadata USING btree (project_id);
-CREATE INDEX index_ci_builds_on_artifacts_expire_at ON ci_builds USING btree (artifacts_expire_at) WHERE (artifacts_file <> ''::text);
-
CREATE INDEX index_ci_builds_on_auto_canceled_by_id ON ci_builds USING btree (auto_canceled_by_id);
CREATE INDEX index_ci_builds_on_commit_id_and_stage_idx_and_created_at ON ci_builds USING btree (commit_id, stage_idx, created_at);
@@ -21685,7 +21971,7 @@ CREATE INDEX index_ci_deleted_objects_on_pick_up_at ON ci_deleted_objects USING
CREATE INDEX index_ci_freeze_periods_on_project_id ON ci_freeze_periods USING btree (project_id);
-CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key ON ci_group_variables USING btree (group_id, key);
+CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key_and_environment ON ci_group_variables USING btree (group_id, key, environment_scope);
CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON ci_instance_variables USING btree (key);
@@ -21793,8 +22079,6 @@ CREATE INDEX index_ci_runner_projects_on_runner_id ON ci_runner_projects USING b
CREATE INDEX index_ci_runners_on_contacted_at ON ci_runners USING btree (contacted_at);
-CREATE INDEX index_ci_runners_on_is_shared ON ci_runners USING btree (is_shared);
-
CREATE INDEX index_ci_runners_on_locked ON ci_runners USING btree (locked);
CREATE INDEX index_ci_runners_on_runner_type ON ci_runners USING btree (runner_type);
@@ -21937,6 +22221,8 @@ CREATE INDEX index_csv_issue_imports_on_project_id ON csv_issue_imports USING bt
CREATE INDEX index_csv_issue_imports_on_user_id ON csv_issue_imports USING btree (user_id);
+CREATE INDEX index_custom_emoji_on_creator_id ON custom_emoji USING btree (creator_id);
+
CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji USING btree (namespace_id, name);
CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name);
@@ -21995,6 +22281,8 @@ CREATE INDEX index_deployments_on_environment_id_and_id ON deployments USING btr
CREATE INDEX index_deployments_on_environment_id_and_iid_and_project_id ON deployments USING btree (environment_id, iid, project_id);
+CREATE INDEX index_deployments_on_environment_id_status_and_finished_at ON deployments USING btree (environment_id, status, finished_at);
+
CREATE INDEX index_deployments_on_environment_status_sha ON deployments USING btree (environment_id, status, sha);
CREATE INDEX index_deployments_on_id_and_status_and_created_at ON deployments USING btree (id, status, created_at);
@@ -22049,6 +22337,8 @@ CREATE UNIQUE INDEX index_design_user_mentions_on_note_id ON design_user_mention
CREATE UNIQUE INDEX index_diff_note_positions_on_note_id_and_diff_type ON diff_note_positions USING btree (note_id, diff_type);
+CREATE UNIQUE INDEX index_dora_daily_metrics_on_environment_id_and_date ON dora_daily_metrics USING btree (environment_id, date);
+
CREATE INDEX index_draft_notes_on_author_id ON draft_notes USING btree (author_id);
CREATE INDEX index_draft_notes_on_discussion_id ON draft_notes USING btree (discussion_id);
@@ -22079,12 +22369,18 @@ CREATE UNIQUE INDEX index_environments_on_project_id_and_name ON environments US
CREATE UNIQUE INDEX index_environments_on_project_id_and_slug ON environments USING btree (project_id, slug);
+CREATE INDEX index_environments_on_project_id_and_tier ON environments USING btree (project_id, tier) WHERE (tier IS NOT NULL);
+
CREATE INDEX index_environments_on_project_id_state_environment_type ON environments USING btree (project_id, state, environment_type);
CREATE INDEX index_environments_on_state_and_auto_stop_at ON environments USING btree (state, auto_stop_at) WHERE ((auto_stop_at IS NOT NULL) AND ((state)::text = 'available'::text));
+CREATE UNIQUE INDEX index_epic_board_list_preferences_on_user_and_list ON boards_epic_list_user_preferences USING btree (user_id, epic_list_id);
+
CREATE INDEX index_epic_issues_on_epic_id ON epic_issues USING btree (epic_id);
+CREATE INDEX index_epic_issues_on_epic_id_and_issue_id ON epic_issues USING btree (epic_id, issue_id);
+
CREATE UNIQUE INDEX index_epic_issues_on_issue_id ON epic_issues USING btree (issue_id);
CREATE INDEX index_epic_metrics ON epic_metrics USING btree (epic_id);
@@ -22347,12 +22643,12 @@ CREATE INDEX index_import_failures_on_project_id_not_null ON import_failures USI
CREATE INDEX index_imported_projects_on_import_type_creator_id_created_at ON projects USING btree (import_type, creator_id, created_at) WHERE (import_type IS NOT NULL);
-CREATE INDEX index_inc_mgmnt_oncall_participants_on_oncall_rotation_id ON incident_management_oncall_participants USING btree (oncall_rotation_id);
-
CREATE INDEX index_inc_mgmnt_oncall_participants_on_oncall_user_id ON incident_management_oncall_participants USING btree (user_id);
CREATE UNIQUE INDEX index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id ON incident_management_oncall_participants USING btree (user_id, oncall_rotation_id);
+CREATE INDEX index_inc_mgmnt_oncall_pcpnt_on_oncall_rotation_id_is_removed ON incident_management_oncall_participants USING btree (oncall_rotation_id, is_removed);
+
CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_id ON incident_management_oncall_rotations USING btree (oncall_schedule_id, id);
CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_name ON incident_management_oncall_rotations USING btree (oncall_schedule_id, name);
@@ -22385,7 +22681,7 @@ CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree
CREATE INDEX index_issue_assignees_on_user_id ON issue_assignees USING btree (user_id);
-CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_email ON issue_email_participants USING btree (issue_id, email);
+CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_lower_email ON issue_email_participants USING btree (issue_id, lower(email));
CREATE INDEX index_issue_links_on_source_id ON issue_links USING btree (source_id);
@@ -22441,6 +22737,8 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);
CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);
+CREATE INDEX index_iterations_cadences_on_group_id ON iterations_cadences USING btree (group_id);
+
CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key);
CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id);
@@ -22775,6 +23073,8 @@ CREATE INDEX index_on_namespaces_lower_name ON namespaces USING btree (lower((na
CREATE INDEX index_on_namespaces_lower_path ON namespaces USING btree (lower((path)::text));
+CREATE INDEX index_on_pages_metadata_not_migrated ON project_pages_metadata USING btree (project_id) WHERE ((deployed = true) AND (pages_deployment_id IS NULL));
+
CREATE INDEX index_on_projects_lower_path ON projects USING btree (lower((path)::text));
CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text));
@@ -23429,7 +23729,9 @@ CREATE UNIQUE INDEX index_software_licenses_on_unique_name ON software_licenses
CREATE UNIQUE INDEX index_sop_configs_on_project_id ON security_orchestration_policy_configurations USING btree (project_id);
-CREATE UNIQUE INDEX index_sop_configs_on_security_policy_management_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id);
+CREATE INDEX index_sop_configurations_project_id_policy_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id, project_id);
+
+CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id);
CREATE INDEX index_sprints_on_description_trigram ON sprints USING gin (description gin_trgm_ops);
@@ -23703,6 +24005,8 @@ CREATE UNIQUE INDEX index_vulnerability_occurrence_identifiers_on_unique_keys ON
CREATE INDEX index_vulnerability_occurrence_pipelines_on_pipeline_id ON vulnerability_occurrence_pipelines USING btree (pipeline_id);
+CREATE INDEX index_vulnerability_occurrences_deduplication ON vulnerability_occurrences USING btree (project_id, report_type, project_fingerprint);
+
CREATE INDEX index_vulnerability_occurrences_for_issue_links_migration ON vulnerability_occurrences USING btree (project_id, report_type, encode(project_fingerprint, 'hex'::text));
CREATE INDEX index_vulnerability_occurrences_on_primary_identifier_id ON vulnerability_occurrences USING btree (primary_identifier_id);
@@ -23823,6 +24127,8 @@ CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree
CREATE INDEX tmp_idx_deduplicate_vulnerability_occurrences ON vulnerability_occurrences USING btree (project_id, report_type, location_fingerprint, primary_identifier_id, id);
+CREATE INDEX tmp_idx_on_namespaces_delayed_project_removal ON namespaces USING btree (id) WHERE (delayed_project_removal = true);
+
CREATE INDEX tmp_index_on_security_findings_scan_id ON security_findings USING btree (scan_id) WHERE (uuid IS NULL);
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);
@@ -24107,6 +24413,8 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63_pkey;
+CREATE TRIGGER table_sync_trigger_b99eb6998c AFTER INSERT OR DELETE OR UPDATE ON web_hook_logs FOR EACH ROW EXECUTE PROCEDURE table_sync_function_29bc99d6db();
+
CREATE TRIGGER table_sync_trigger_ee39a25f9d AFTER INSERT OR DELETE OR UPDATE ON audit_events FOR EACH ROW EXECUTE PROCEDURE table_sync_function_2be879775d();
CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker();
@@ -24268,6 +24576,9 @@ ALTER TABLE ONLY namespaces
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_3654b61b03 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY sprints
+ ADD CONSTRAINT fk_365d1db505 FOREIGN KEY (iterations_cadence_id) REFERENCES iterations_cadences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY push_event_payloads
ADD CONSTRAINT fk_36c74129da FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE;
@@ -24316,6 +24627,9 @@ ALTER TABLE ONLY path_locks
ALTER TABLE ONLY clusters_applications_prometheus
ADD CONSTRAINT fk_557e773639 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
+ALTER TABLE ONLY terraform_states
+ ADD CONSTRAINT fk_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY merge_request_metrics
ADD CONSTRAINT fk_56067dcb44 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24412,9 +24726,6 @@ ALTER TABLE ONLY vulnerabilities
ALTER TABLE ONLY labels
ADD CONSTRAINT fk_7de4989a69 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY backup_labels
- ADD CONSTRAINT fk_7de4989a69 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_7e85395a64 FOREIGN KEY (sprint_id) REFERENCES sprints(id) ON DELETE CASCADE;
@@ -24487,6 +24798,9 @@ ALTER TABLE ONLY milestones
ALTER TABLE ONLY vulnerabilities
ADD CONSTRAINT fk_959d40ad0a FOREIGN KEY (confirmed_by_id) REFERENCES users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY boards_epic_list_user_preferences
+ ADD CONSTRAINT fk_95eac55851 FOREIGN KEY (epic_list_id) REFERENCES boards_epic_lists(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY application_settings
ADD CONSTRAINT fk_964370041d FOREIGN KEY (usage_stats_set_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -24640,6 +24954,12 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY issue_links
ADD CONSTRAINT fk_c900194ff2 FOREIGN KEY (source_id) REFERENCES issues(id) ON DELETE CASCADE;
+ALTER TABLE ONLY external_approval_rules_protected_branches
+ ADD CONSTRAINT fk_c9a037a926 FOREIGN KEY (external_approval_rule_id) REFERENCES external_approval_rules(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY external_approval_rules_protected_branches
+ ADD CONSTRAINT fk_ca2ffb55e6 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY experiment_subjects
ADD CONSTRAINT fk_ccc28f8ceb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24649,6 +24969,9 @@ ALTER TABLE ONLY todos
ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_cff7185ad2 FOREIGN KEY (reset_checksum_event_id) REFERENCES geo_reset_checksum_events(id) ON DELETE CASCADE;
+ALTER TABLE ONLY custom_emoji
+ ADD CONSTRAINT fk_custom_emoji_creator_id FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY bulk_import_entities
ADD CONSTRAINT fk_d06d023c30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24784,6 +25107,9 @@ ALTER TABLE ONLY design_management_designs_versions
ALTER TABLE ONLY analytics_devops_adoption_segments
ADD CONSTRAINT fk_f5aa768998 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY boards_epic_list_user_preferences
+ ADD CONSTRAINT fk_f5f2fe5c1f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY cluster_agents
ADD CONSTRAINT fk_f7d43dee13 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -25012,6 +25338,9 @@ ALTER TABLE ONLY boards_epic_board_positions
ALTER TABLE ONLY geo_repository_created_events
ADD CONSTRAINT fk_rails_1f49e46a61 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dora_daily_metrics
+ ADD CONSTRAINT fk_rails_1fd07aff6f FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY boards_epic_lists
ADD CONSTRAINT fk_rails_1fe6b54909 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
@@ -25222,6 +25551,9 @@ ALTER TABLE ONLY ci_resources
ALTER TABLE ONLY clusters_applications_fluentd
ADD CONSTRAINT fk_rails_4319b1dcd2 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
+ALTER TABLE ONLY batched_background_migration_jobs
+ ADD CONSTRAINT fk_rails_432153b86d FOREIGN KEY (batched_background_migration_id) REFERENCES batched_background_migrations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY operations_strategies_user_lists
ADD CONSTRAINT fk_rails_43241e8d29 FOREIGN KEY (strategy_id) REFERENCES operations_strategies(id) ON DELETE CASCADE;
@@ -25327,9 +25659,6 @@ ALTER TABLE ONLY geo_node_namespace_links
ALTER TABLE ONLY clusters_applications_knative
ADD CONSTRAINT fk_rails_54fc91e0a0 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
-ALTER TABLE ONLY terraform_states
- ADD CONSTRAINT fk_rails_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES users(id);
-
ALTER TABLE ONLY issuable_metric_images
ADD CONSTRAINT fk_rails_56417a5a7f FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -25927,9 +26256,6 @@ ALTER TABLE ONLY serverless_domain_cluster
ALTER TABLE ONLY labels
ADD CONSTRAINT fk_rails_c1ac5161d8 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-ALTER TABLE ONLY backup_labels
- ADD CONSTRAINT fk_rails_c1ac5161d8 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY project_feature_usages
ADD CONSTRAINT fk_rails_c22a50024b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26143,6 +26469,9 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY snippet_statistics
ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;
+ALTER TABLE ONLY iterations_cadences
+ ADD CONSTRAINT fk_rails_ece400c55a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY dast_profiles
ADD CONSTRAINT fk_rails_ed1e66fbbf FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;
@@ -26248,6 +26577,9 @@ ALTER TABLE ONLY ci_job_variables
ALTER TABLE ONLY packages_nuget_metadata
ADD CONSTRAINT fk_rails_fc0c19f5b4 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;
+ALTER TABLE ONLY external_approval_rules
+ ADD CONSTRAINT fk_rails_fd4f9ac573 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY experiment_users
ADD CONSTRAINT fk_rails_fd805f771a FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;