diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /db | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'db')
249 files changed, 3028 insertions, 108 deletions
diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb index 8cda3eb51be..19bec2cef72 100644 --- a/db/fixtures/development/10_merge_requests.rb +++ b/db/fixtures/development/10_merge_requests.rb @@ -36,7 +36,7 @@ Gitlab::Seeder.quiet do break unless developer Sidekiq::Worker.skipping_transaction_check do - MergeRequests::CreateService.new(project, developer, params).execute + MergeRequests::CreateService.new(project: project, current_user: developer, params: params).execute rescue Repository::AmbiguousRefError # Ignore pipelines creation errors for now, we can doing that after # https://gitlab.com/gitlab-org/gitlab-foss/issues/55966. will be resolved. @@ -55,7 +55,7 @@ Gitlab::Seeder.quiet do title: 'Can be automatically merged' } Sidekiq::Worker.skipping_transaction_check do - MergeRequests::CreateService.new(project, User.admins.first, params).execute + MergeRequests::CreateService.new(project: project, current_user: User.admins.first, params: params).execute end print '.' @@ -65,7 +65,7 @@ Gitlab::Seeder.quiet do title: 'Cannot be automatically merged' } Sidekiq::Worker.skipping_transaction_check do - MergeRequests::CreateService.new(project, User.admins.first, params).execute + MergeRequests::CreateService.new(project: project, current_user: User.admins.first, params: params).execute end print '.' end diff --git a/db/fixtures/development/26_container_images.rb b/db/fixtures/development/26_container_images.rb index 5b5879673b9..fdee57c73e3 100644 --- a/db/fixtures/development/26_container_images.rb +++ b/db/fixtures/development/26_container_images.rb @@ -57,7 +57,7 @@ Gitlab::Seeder.quiet do seeder.seed! rescue => e puts "\nSeeding container images failed with #{e.message}." - puts "Make sure that the registry is running (https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/registry.md) and that Docker CLI (https://www.docker.com/products/docker-desktop) is installed." + puts "Make sure that the registry is running (https://gitlab.com/gitlab-org/gitlab-development-kit/blob/main/doc/howto/registry.md) and that Docker CLI (https://www.docker.com/products/docker-desktop) is installed." end else puts "Skipped. Use the `#{flag}` environment variable to seed container images to the registry." diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb index c4fbb4b2ab9..ba5f700a877 100644 --- a/db/migrate/20190402150158_backport_enterprise_schema.rb +++ b/db/migrate/20190402150158_backport_enterprise_schema.rb @@ -914,7 +914,7 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] MSG end - raise StandardError.new(message) + raise StandardError, message end def create_missing_tables diff --git a/db/migrate/20190801060809_delete_kubernetes_services.rb b/db/migrate/20190801060809_delete_kubernetes_services.rb index 018976584d4..88717293817 100644 --- a/db/migrate/20190801060809_delete_kubernetes_services.rb +++ b/db/migrate/20190801060809_delete_kubernetes_services.rb @@ -3,6 +3,11 @@ class DeleteKubernetesServices < ActiveRecord::Migration[5.2] DOWNTIME = false + class Service < ActiveRecord::Base + self.table_name = 'services' + self.inheritance_column = :_type_disabled + end + def up Service.where(type: "KubernetesService").delete_all end diff --git a/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb b/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb index e6b9a40ad4f..3ae5e3265e8 100644 --- a/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb +++ b/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb @@ -17,21 +17,21 @@ class EncryptPlaintextAttributesOnApplicationSettings < ActiveRecord::Migration[ class ApplicationSetting < ActiveRecord::Base self.table_name = 'application_settings' - def self.encryption_options_base_truncated_aes_256_gcm + def self.encryption_options_base_32_aes_256_gcm { mode: :per_attribute_iv, - key: Gitlab::Application.secrets.db_key_base[0..31], + key: Gitlab::Utils.ensure_utf8_size(Rails.application.secrets.db_key_base, bytes: 32.bytes), algorithm: 'aes-256-gcm', encode: true } end - attr_encrypted :akismet_api_key, encryption_options_base_truncated_aes_256_gcm - attr_encrypted :elasticsearch_aws_secret_access_key, encryption_options_base_truncated_aes_256_gcm - attr_encrypted :recaptcha_private_key, encryption_options_base_truncated_aes_256_gcm - attr_encrypted :recaptcha_site_key, encryption_options_base_truncated_aes_256_gcm - attr_encrypted :slack_app_secret, encryption_options_base_truncated_aes_256_gcm - attr_encrypted :slack_app_verification_token, encryption_options_base_truncated_aes_256_gcm + attr_encrypted :akismet_api_key, encryption_options_base_32_aes_256_gcm + attr_encrypted :elasticsearch_aws_secret_access_key, encryption_options_base_32_aes_256_gcm + attr_encrypted :recaptcha_private_key, encryption_options_base_32_aes_256_gcm + attr_encrypted :recaptcha_site_key, encryption_options_base_32_aes_256_gcm + attr_encrypted :slack_app_secret, encryption_options_base_32_aes_256_gcm + attr_encrypted :slack_app_verification_token, encryption_options_base_32_aes_256_gcm def akismet_api_key decrypt(:akismet_api_key, self[:encrypted_akismet_api_key]) || self[:akismet_api_key] diff --git a/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb b/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb index 7983a56f439..5d7b6349fe6 100644 --- a/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb +++ b/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb @@ -8,7 +8,7 @@ class GenerateCiJwtSigningKey < ActiveRecord::Migration[6.0] attr_encrypted :ci_jwt_signing_key, { mode: :per_attribute_iv, - key: Rails.application.secrets.db_key_base[0..31], + key: Gitlab::Utils.ensure_utf8_size(Rails.application.secrets.db_key_base, bytes: 32.bytes), algorithm: 'aes-256-gcm', encode: true } diff --git a/db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb b/db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb new file mode 100644 index 00000000000..1e6619731a2 --- /dev/null +++ b/db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RemoveArtifactExpiryTempIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'expired_artifacts_temp_index' + INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date" + + def up + remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME + end + + def down + add_concurrent_index(:ci_job_artifacts, %i(id created_at), where: INDEX_CONDITION, name: INDEX_NAME) + end +end diff --git a/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb b/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb index 72536d24fe1..f5ff0816047 100644 --- a/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb +++ b/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb @@ -14,7 +14,7 @@ class InitializeConversionOfEventsIdToBigint < ActiveRecord::Migration[6.0] def down trigger_name = rename_trigger_name(:events, :id, :id_convert_to_bigint) - remove_rename_triggers_for_postgresql :events, trigger_name + remove_rename_triggers :events, trigger_name remove_column :events, :id_convert_to_bigint end diff --git a/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb b/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb index 9ce3b59e2dd..651c9ed993d 100644 --- a/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb +++ b/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb @@ -14,7 +14,7 @@ class InitializeConversionOfPushEventPayloadsEventIdToBigint < ActiveRecord::Mig def down trigger_name = rename_trigger_name(:push_event_payloads, :event_id, :event_id_convert_to_bigint) - remove_rename_triggers_for_postgresql :push_event_payloads, trigger_name + remove_rename_triggers :push_event_payloads, trigger_name remove_column :push_event_payloads, :event_id_convert_to_bigint end diff --git a/db/migrate/20210316171009_create_packages_helm_file_metadata.rb b/db/migrate/20210316171009_create_packages_helm_file_metadata.rb new file mode 100644 index 00000000000..f5a9c5f1146 --- /dev/null +++ b/db/migrate/20210316171009_create_packages_helm_file_metadata.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreatePackagesHelmFileMetadata < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table_with_constraints :packages_helm_file_metadata, id: false do |t| + t.timestamps_with_timezone + t.references :package_file, primary_key: true, index: false, default: nil, null: false, foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, type: :bigint + t.text :channel, null: false + t.jsonb :metadata + + t.text_limit :channel, 63 + + t.index :channel + end + end +end diff --git a/db/migrate/20210317123054_add_throttle_package_registry_columns.rb b/db/migrate/20210317123054_add_throttle_package_registry_columns.rb new file mode 100644 index 00000000000..0bb731306c0 --- /dev/null +++ b/db/migrate/20210317123054_add_throttle_package_registry_columns.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddThrottlePackageRegistryColumns < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :throttle_unauthenticated_packages_api_requests_per_period, :integer, default: 800, null: false + add_column :application_settings, :throttle_unauthenticated_packages_api_period_in_seconds, :integer, default: 15, null: false + add_column :application_settings, :throttle_authenticated_packages_api_requests_per_period, :integer, default: 1000, null: false + add_column :application_settings, :throttle_authenticated_packages_api_period_in_seconds, :integer, default: 15, null: false + add_column :application_settings, :throttle_unauthenticated_packages_api_enabled, :boolean, default: false, null: false + add_column :application_settings, :throttle_authenticated_packages_api_enabled, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb b/db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb new file mode 100644 index 00000000000..9a4789b5c1a --- /dev/null +++ b/db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddHelmMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :plan_limits, :helm_max_file_size, :bigint, default: 5.megabyte, null: false + end +end diff --git a/db/migrate/20210323125809_create_status_check_responses_table.rb b/db/migrate/20210323125809_create_status_check_responses_table.rb new file mode 100644 index 00000000000..3fa7ff7165c --- /dev/null +++ b/db/migrate/20210323125809_create_status_check_responses_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreateStatusCheckResponsesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + create_table :status_check_responses do |t| + t.bigint :merge_request_id, null: false + t.bigint :external_approval_rule_id, null: false + end + + add_index :status_check_responses, :merge_request_id + add_index :status_check_responses, :external_approval_rule_id + end + + def down + drop_table :status_check_responses + end +end diff --git a/db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb b/db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb new file mode 100644 index 00000000000..cee0b9a231e --- /dev/null +++ b/db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddMergeRequestForeignKeyToStatusCheckResponses < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :status_check_responses, :merge_requests, column: :merge_request_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :status_check_responses, column: :merge_request_id + end + end +end diff --git a/db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb b/db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb new file mode 100644 index 00000000000..ab28c20dbb1 --- /dev/null +++ b/db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddExternalApprovalRuleForeignKeyToStatusCheckResponses < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :status_check_responses, :external_approval_rules, column: :external_approval_rule_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :status_check_responses, column: :external_approval_rule_id + end + end +end diff --git a/db/migrate/20210407111027_add_whats_new_application_setting.rb b/db/migrate/20210407111027_add_whats_new_application_setting.rb new file mode 100644 index 00000000000..450c26e2199 --- /dev/null +++ b/db/migrate/20210407111027_add_whats_new_application_setting.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddWhatsNewApplicationSetting < ActiveRecord::Migration[6.0] + def change + add_column :application_settings, :whats_new_variant, :integer, limit: 2, default: 0 + end +end diff --git a/db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb b/db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb new file mode 100644 index 00000000000..987be4ab1f0 --- /dev/null +++ b/db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddVerificationStateAndStartedAtToTerraformStateVersionTable < ActiveRecord::Migration[6.0] + def change + change_table(:terraform_state_versions) do |t| + t.column :verification_started_at, :datetime_with_timezone + t.integer :verification_state, default: 0, limit: 2, null: false + end + end +end diff --git a/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb b/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb new file mode 100644 index 00000000000..c7035400cba --- /dev/null +++ b/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class CreateSecurityOrchestrationPolicyRuleSchedule < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_PREFIX = 'index_sop_schedules_' + + disable_ddl_transaction! + + def up + table_comment = { owner: 'group::container security', description: 'Schedules used to store relationship between project and security policy repository' } + + create_table_with_constraints :security_orchestration_policy_rule_schedules, comment: table_comment.to_json do |t| + t.timestamps_with_timezone + t.datetime_with_timezone :next_run_at, null: true + + t.references :security_orchestration_policy_configuration, null: false, foreign_key: { to_table: :security_orchestration_policy_configurations, on_delete: :cascade }, index: { name: INDEX_PREFIX + 'on_sop_configuration_id' } + t.references :user, null: false, foreign_key: { on_delete: :cascade }, index: { name: INDEX_PREFIX + 'on_user_id' } + + t.integer :policy_index, null: false + t.text :cron, null: false + + t.text_limit :cron, 255 + end + end + + def down + with_lock_retries do + drop_table :security_orchestration_policy_rule_schedules + end + end +end diff --git a/db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb b/db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb new file mode 100644 index 00000000000..8e21e0f5182 --- /dev/null +++ b/db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddConfiguredAtToSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :security_orchestration_policy_configurations, :configured_at, :datetime_with_timezone, null: true + end +end diff --git a/db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb b/db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb new file mode 100644 index 00000000000..ca73c85963e --- /dev/null +++ b/db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddPauseSecondsToBatchedBackgroundMigrations < ActiveRecord::Migration[6.0] + def change + add_column :batched_background_migrations, :pause_ms, :integer, null: false, default: 100 + end +end diff --git a/db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb b/db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb new file mode 100644 index 00000000000..d232f9c0305 --- /dev/null +++ b/db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddPauseSecondsToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0] + def change + add_column :batched_background_migration_jobs, :pause_ms, :integer, null: false, default: 100 + end +end diff --git a/db/migrate/20210414100914_add_bulk_import_exports_table.rb b/db/migrate/20210414100914_add_bulk_import_exports_table.rb new file mode 100644 index 00000000000..14a7421c1e4 --- /dev/null +++ b/db/migrate/20210414100914_add_bulk_import_exports_table.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddBulkImportExportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + create_table_with_constraints :bulk_import_exports do |t| + t.bigint :group_id + t.bigint :project_id + t.timestamps_with_timezone null: false + t.integer :status, limit: 2, null: false, default: 0 + t.text :relation, null: false + t.text :jid, unique: true + t.text :error + + t.text_limit :relation, 255 + t.text_limit :jid, 255 + t.text_limit :error, 255 + end + end + + def down + drop_table :bulk_import_exports + end +end diff --git a/db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb b/db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb new file mode 100644 index 00000000000..2f7d3713302 --- /dev/null +++ b/db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddForeignKeyToBulkImportExportsOnProject < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :bulk_import_exports, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :bulk_import_exports, column: :project_id + end + end +end diff --git a/db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb b/db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb new file mode 100644 index 00000000000..b7172c6987e --- /dev/null +++ b/db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddForeignKeyToBulkImportExportsOnGroup < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :bulk_import_exports, :namespaces, column: :group_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :bulk_import_exports, column: :group_id + end + end +end diff --git a/db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb b/db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb new file mode 100644 index 00000000000..1cbd1cadf5e --- /dev/null +++ b/db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddBulkImportExportsTableIndexes < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + GROUP_INDEX_NAME = 'partial_index_bulk_import_exports_on_group_id_and_relation' + PROJECT_INDEX_NAME = 'partial_index_bulk_import_exports_on_project_id_and_relation' + + def up + add_concurrent_index :bulk_import_exports, + [:group_id, :relation], + unique: true, + where: 'group_id IS NOT NULL', + name: GROUP_INDEX_NAME + + add_concurrent_index :bulk_import_exports, + [:project_id, :relation], + unique: true, + where: 'project_id IS NOT NULL', + name: PROJECT_INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:bulk_import_exports, GROUP_INDEX_NAME) + remove_concurrent_index_by_name(:bulk_import_exports, PROJECT_INDEX_NAME) + end +end diff --git a/db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb b/db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb new file mode 100644 index 00000000000..d20e57848e9 --- /dev/null +++ b/db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddBulkImportExportUploadsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + create_table_with_constraints :bulk_import_export_uploads do |t| + t.references :export, index: true, null: false, foreign_key: { to_table: :bulk_import_exports, on_delete: :cascade } + t.datetime_with_timezone :updated_at, null: false + t.text :export_file + + t.text_limit :export_file, 255 + end + end + + def down + drop_table :bulk_import_export_uploads + end +end diff --git a/db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb b/db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb new file mode 100644 index 00000000000..068dceda272 --- /dev/null +++ b/db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiBuildNeedsToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + initialize_conversion_of_integer_to_bigint :ci_build_needs, :build_id + end + + def down + trigger_name = rename_trigger_name(:ci_build_needs, :build_id, :build_id_convert_to_bigint) + + remove_rename_triggers :ci_build_needs, trigger_name + + remove_column :ci_build_needs, :build_id_convert_to_bigint + end +end diff --git a/db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb b/db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb new file mode 100644 index 00000000000..2fe33ff23ba --- /dev/null +++ b/db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class CreateVulnerabilityFindingEvidenceRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table_with_constraints :vulnerability_finding_evidence_requests do |t| + t.timestamps_with_timezone null: false + + t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_requests_on_finding_evidence_id' }, null: false, foreign_key: { on_delete: :cascade } + t.text :method + t.text :url + + t.text_limit :method, 32 + t.text_limit :url, 2048 + end + end + + def down + with_lock_retries do + drop_table :vulnerability_finding_evidence_requests + end + end +end diff --git a/db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb b/db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb new file mode 100644 index 00000000000..c9740a48117 --- /dev/null +++ b/db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class CreateVulnerabilityFindingEvidenceResponses < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table_with_constraints :vulnerability_finding_evidence_responses do |t| + t.timestamps_with_timezone null: false + + t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_responses_on_finding_evidences_id' }, null: false, foreign_key: { on_delete: :cascade } + t.integer :status_code + t.text :reason_phrase + + t.text_limit :reason_phrase, 2048 + end + end + + def down + with_lock_retries do + drop_table :vulnerability_finding_evidence_responses + end + end +end diff --git a/db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb b/db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb new file mode 100644 index 00000000000..1df56742480 --- /dev/null +++ b/db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveDebianGroupArchitecturesDistributionIdIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'idx_pkgs_deb_grp_architectures_on_distribution_id' + + disable_ddl_transaction! + + def up + remove_concurrent_index :packages_debian_group_architectures, :distribution_id, name: INDEX_NAME + end + + def down + add_concurrent_index :packages_debian_group_architectures, :distribution_id, name: INDEX_NAME + end +end diff --git a/db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb b/db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb new file mode 100644 index 00000000000..1f918bd4dec --- /dev/null +++ b/db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveDebianProjectArchitecturesDistributionIdIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'idx_pkgs_deb_proj_architectures_on_distribution_id' + + disable_ddl_transaction! + + def up + remove_concurrent_index :packages_debian_project_architectures, :distribution_id, name: INDEX_NAME + end + + def down + add_concurrent_index :packages_debian_project_architectures, :distribution_id, name: INDEX_NAME + end +end diff --git a/db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb b/db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb new file mode 100644 index 00000000000..00c5329406e --- /dev/null +++ b/db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddRemoteImportUrlToImportExportUpload < ActiveRecord::Migration[6.0] + # limit is added in 20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb + def change + add_column :import_export_uploads, :remote_import_url, :text # rubocop:disable Migration/AddLimitToTextColumns + end +end diff --git a/db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb b/db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb new file mode 100644 index 00000000000..81b4e76b8d9 --- /dev/null +++ b/db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddRemoteTextLimitToImportUrlInImportExportUpload < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_text_limit :import_export_uploads, :remote_import_url, 512 + end + + def down + remove_text_limit :import_export_uploads, :remote_import_url + end +end diff --git a/db/migrate/20210419224834_update_issues_iteration_foreign_key.rb b/db/migrate/20210419224834_update_issues_iteration_foreign_key.rb new file mode 100644 index 00000000000..d071ac8d1d4 --- /dev/null +++ b/db/migrate/20210419224834_update_issues_iteration_foreign_key.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class UpdateIssuesIterationForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_foreign_key_if_exists(:issues, column: :sprint_id) + end + + add_concurrent_foreign_key(:issues, :sprints, column: :sprint_id, on_delete: :nullify) + end + + def down + with_lock_retries do + remove_foreign_key_if_exists(:issues, column: :sprint_id) + end + + add_concurrent_foreign_key(:issues, :sprints, column: :sprint_id, on_delete: :cascade) + end +end diff --git a/db/migrate/20210420012444_change_web_hook_events_default.rb b/db/migrate/20210420012444_change_web_hook_events_default.rb new file mode 100644 index 00000000000..b5a63a5a2a8 --- /dev/null +++ b/db/migrate/20210420012444_change_web_hook_events_default.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ChangeWebHookEventsDefault < ActiveRecord::Migration[6.0] + def up + change_column_default :web_hooks, :push_events, true + change_column_default :web_hooks, :issues_events, false + change_column_default :web_hooks, :merge_requests_events, false + change_column_default :web_hooks, :tag_push_events, false + end + + # This is a NOP because this migration is supposed to restore the + # intended schema, not revert it. + def down + end +end diff --git a/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb b/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb new file mode 100644 index 00000000000..c1715d8ac29 --- /dev/null +++ b/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class IndexClusterAgentTokensOnLastUsedAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + OLD_INDEX = 'index_cluster_agent_tokens_on_agent_id' + NEW_INDEX = 'index_cluster_agent_tokens_on_agent_id_and_last_used_at' + + disable_ddl_transaction! + + def up + add_concurrent_index :cluster_agent_tokens, 'agent_id, last_used_at DESC NULLS LAST', name: NEW_INDEX + remove_concurrent_index_by_name :cluster_agent_tokens, OLD_INDEX + end + + def down + add_concurrent_index :cluster_agent_tokens, :agent_id, name: OLD_INDEX + remove_concurrent_index_by_name :cluster_agent_tokens, NEW_INDEX + end +end diff --git a/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb b/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb new file mode 100644 index 00000000000..cc8f0686841 --- /dev/null +++ b/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiJobArtifactsToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_job_artifacts + COLUMNS = %i(id job_id) + TARGET_COLUMNS = COLUMNS.map { |col| "#{col}_convert_to_bigint" } + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + trigger_name = rename_trigger_name(TABLE, COLUMNS, TARGET_COLUMNS) + remove_rename_triggers TABLE, trigger_name + + TARGET_COLUMNS.each do |column| + remove_column TABLE, column + end + end +end diff --git a/db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb b/db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb new file mode 100644 index 00000000000..2c0d0bee39d --- /dev/null +++ b/db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class AddVerificationIndexesToTerraformStateVersions < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + VERIFICATION_STATE_INDEX_NAME = "index_terraform_state_versions_on_verification_state" + PENDING_VERIFICATION_INDEX_NAME = "index_terraform_state_versions_pending_verification" + FAILED_VERIFICATION_INDEX_NAME = "index_terraform_state_versions_failed_verification" + NEEDS_VERIFICATION_INDEX_NAME = "index_terraform_state_versions_needs_verification" + + disable_ddl_transaction! + + def up + add_concurrent_index :terraform_state_versions, :verification_state, name: VERIFICATION_STATE_INDEX_NAME + add_concurrent_index :terraform_state_versions, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME + add_concurrent_index :terraform_state_versions, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME + add_concurrent_index :terraform_state_versions, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME + end + + def down + remove_concurrent_index_by_name :terraform_state_versions, VERIFICATION_STATE_INDEX_NAME + remove_concurrent_index_by_name :terraform_state_versions, PENDING_VERIFICATION_INDEX_NAME + remove_concurrent_index_by_name :terraform_state_versions, FAILED_VERIFICATION_INDEX_NAME + remove_concurrent_index_by_name :terraform_state_versions, NEEDS_VERIFICATION_INDEX_NAME + end +end diff --git a/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb b/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb new file mode 100644 index 00000000000..2674d9e50c8 --- /dev/null +++ b/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This migration recreates the index that introduced in 20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb. +class RecreateIndexForProjectDeploymentsWithEnvironmentIdAndDateAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + OLD_INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at' + NEW_INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at_id' + + def up + add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at, :id], name: NEW_INDEX_NAME + remove_concurrent_index_by_name :deployments, OLD_INDEX_NAME + end + + def down + add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: OLD_INDEX_NAME + remove_concurrent_index_by_name :deployments, NEW_INDEX_NAME + end +end diff --git a/db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb b/db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb new file mode 100644 index 00000000000..64786f0b20c --- /dev/null +++ b/db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class UpdateMergeRequestsIterationForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_foreign_key_if_exists(:merge_requests, column: :sprint_id) + end + + add_concurrent_foreign_key(:merge_requests, :sprints, column: :sprint_id, on_delete: :nullify) + end + + def down + with_lock_retries do + remove_foreign_key_if_exists(:merge_requests, column: :sprint_id) + end + + add_concurrent_foreign_key(:merge_requests, :sprints, column: :sprint_id, on_delete: :cascade) + end +end diff --git a/db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb b/db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb new file mode 100644 index 00000000000..74d197cd3b8 --- /dev/null +++ b/db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddDeactivateDormantUsersToApplicationSettings < ActiveRecord::Migration[6.0] + def change + add_column :application_settings, :deactivate_dormant_users, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20210421022010_add_index_for_dormant_users.rb b/db/migrate/20210421022010_add_index_for_dormant_users.rb new file mode 100644 index 00000000000..48eff184ca0 --- /dev/null +++ b/db/migrate/20210421022010_add_index_for_dormant_users.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexForDormantUsers < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_users_on_id_and_last_activity_on_for_non_internal_active' + + disable_ddl_transaction! + + def up + index_condition = "state = 'active' AND (users.user_type IS NULL OR users.user_type IN (NULL, 6, 4))" + + add_concurrent_index :users, [:id, :last_activity_on], where: index_condition, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :users, INDEX_NAME + end +end diff --git a/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb b/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb new file mode 100644 index 00000000000..3d65abc5608 --- /dev/null +++ b/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddCodeownersDevopsAdoptionSnapshot < ActiveRecord::Migration[6.0] + def change + add_column :analytics_devops_adoption_snapshots, :total_projects_count, :integer + add_column :analytics_devops_adoption_snapshots, :code_owners_used_count, :integer + end +end diff --git a/db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb b/db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb new file mode 100644 index 00000000000..301e75aa093 --- /dev/null +++ b/db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveElasticTaskNullConstraintFromElasticReindexingSubtasks < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + ELASTIC_TASK = 'elastic_task' + + disable_ddl_transaction! + + def up + remove_not_null_constraint :elastic_reindexing_subtasks, :elastic_task + change_column_null(:elastic_reindexing_subtasks, :elastic_task, true) + end + + def down + # there may be elastic_task values which are null so we fill them with a dummy value + change_column_null(:elastic_reindexing_subtasks, :elastic_task, false, ELASTIC_TASK) + add_not_null_constraint :elastic_reindexing_subtasks, :elastic_task, validate: false + end +end diff --git a/db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb b/db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb new file mode 100644 index 00000000000..ea716afe84b --- /dev/null +++ b/db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiSourcesPipelinesSourceJobIdToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + # Foreign key that references ci_builds.id + initialize_conversion_of_integer_to_bigint :ci_sources_pipelines, :source_job_id + end + + def down + trigger_name = rename_trigger_name(:ci_sources_pipelines, :source_job_id, :source_job_id_convert_to_bigint) + + remove_rename_triggers :ci_sources_pipelines, trigger_name + + remove_column :ci_sources_pipelines, :source_job_id_convert_to_bigint + end +end diff --git a/db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb b/db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb new file mode 100644 index 00000000000..bd38b5660b4 --- /dev/null +++ b/db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddProjectIdNextRunAtIndexToContainerExpirationPolicies < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'idx_container_exp_policies_on_project_id_next_run_at' + + def up + add_concurrent_index :container_expiration_policies, [:project_id, :next_run_at], name: INDEX_NAME, where: 'enabled = true' + end + + def down + remove_concurrent_index :container_expiration_policies, [:project_id, :next_run_at], name: INDEX_NAME + end +end diff --git a/db/migrate/20210422181809_add_project_to_timelogs.rb b/db/migrate/20210422181809_add_project_to_timelogs.rb new file mode 100644 index 00000000000..1f98e440d15 --- /dev/null +++ b/db/migrate/20210422181809_add_project_to_timelogs.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectToTimelogs < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :timelogs, :project_id, :integer + end + end + + def down + with_lock_retries do + remove_column :timelogs, :project_id + end + end +end diff --git a/db/migrate/20210422195929_create_elastic_reindexing_slices.rb b/db/migrate/20210422195929_create_elastic_reindexing_slices.rb new file mode 100644 index 00000000000..a535402186c --- /dev/null +++ b/db/migrate/20210422195929_create_elastic_reindexing_slices.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class CreateElasticReindexingSlices < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + class ReindexingSubtask < ActiveRecord::Base + self.table_name = 'elastic_reindexing_subtasks' + end + + class ReindexingSlice < ActiveRecord::Base + self.table_name = 'elastic_reindexing_slices' + end + + def up + unless table_exists?(:elastic_reindexing_slices) + create_table_with_constraints :elastic_reindexing_slices do |t| + t.timestamps_with_timezone null: false + t.references :elastic_reindexing_subtask, foreign_key: { on_delete: :cascade }, null: false, index: { name: 'idx_elastic_reindexing_slices_on_elastic_reindexing_subtask_id' } + t.integer :elastic_slice, null: false, limit: 2, default: 0 + t.integer :elastic_max_slice, null: false, limit: 2, default: 0 + t.integer :retry_attempt, null: false, limit: 2, default: 0 + t.text :elastic_task + + t.text_limit :elastic_task, 255 + end + end + + ReindexingSubtask.find_each do |subtask| + next if ReindexingSlice.where(elastic_reindexing_subtask_id: subtask.id).exists? + + ReindexingSlice.create( + elastic_reindexing_subtask_id: subtask.id, + elastic_task: subtask.elastic_task, + retry_attempt: 0 + ) + end + end + + def down + drop_table :elastic_reindexing_slices + end +end diff --git a/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb b/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb new file mode 100644 index 00000000000..bbdb4f02ab4 --- /dev/null +++ b/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateDastSiteProfilesPipelines < ActiveRecord::Migration[6.0] + def up + table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Site Profiles and CI Pipelines' } + + create_table :dast_site_profiles_pipelines, primary_key: [:dast_site_profile_id, :ci_pipeline_id], comment: table_comment.to_json do |t| + t.bigint :dast_site_profile_id, null: false + t.bigint :ci_pipeline_id, null: false + + t.index :ci_pipeline_id, unique: true, name: :index_dast_site_profiles_pipelines_on_ci_pipeline_id + end + end + + def down + drop_table :dast_site_profiles_pipelines + end +end diff --git a/db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb b/db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb new file mode 100644 index 00000000000..eb3a5168609 --- /dev/null +++ b/db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDastSiteProfileIdFkToDastSiteProfilesPipelines < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :dast_site_profiles_pipelines, :dast_site_profiles, column: :dast_site_profile_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :dast_site_profiles_pipelines, column: :dast_site_profile_id + end + end +end diff --git a/db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb b/db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb new file mode 100644 index 00000000000..ed2a7ff859c --- /dev/null +++ b/db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddCiPipelineIdFkToDastSiteProfilesPipelines < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :dast_site_profiles_pipelines, :ci_pipelines, column: :ci_pipeline_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :dast_site_profiles_pipelines, column: :ci_pipeline_id + end + end +end diff --git a/db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb b/db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb new file mode 100644 index 00000000000..5382e596d8c --- /dev/null +++ b/db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddRunnerRegistrationToPlanLimits < ActiveRecord::Migration[6.0] + def change + add_column(:plan_limits, :ci_registered_group_runners, :integer, default: 1000, null: false) + add_column(:plan_limits, :ci_registered_project_runners, :integer, default: 1000, null: false) + end +end diff --git a/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb b/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb new file mode 100644 index 00000000000..36d13dfa120 --- /dev/null +++ b/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class InsertRunnerRegistrationPlanLimits < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + create_or_update_plan_limit('ci_registered_group_runners', 'free', 50) + create_or_update_plan_limit('ci_registered_group_runners', 'bronze', 1000) + create_or_update_plan_limit('ci_registered_group_runners', 'silver', 1000) + create_or_update_plan_limit('ci_registered_group_runners', 'gold', 1000) + + create_or_update_plan_limit('ci_registered_project_runners', 'free', 50) + create_or_update_plan_limit('ci_registered_project_runners', 'bronze', 1000) + create_or_update_plan_limit('ci_registered_project_runners', 'silver', 1000) + create_or_update_plan_limit('ci_registered_project_runners', 'gold', 1000) + end + + def down + %w[group project].each do |scope| + create_or_update_plan_limit("ci_registered_#{scope}_runners", 'free', 1000) + create_or_update_plan_limit("ci_registered_#{scope}_runners", 'bronze', 1000) + create_or_update_plan_limit("ci_registered_#{scope}_runners", 'silver', 1000) + create_or_update_plan_limit("ci_registered_#{scope}_runners", 'gold', 1000) + end + end +end diff --git a/db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb b/db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb new file mode 100644 index 00000000000..ee9e444c792 --- /dev/null +++ b/db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class ReOrderFkSourceProjectIdInMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + OLD_SOURCE_PROJECT_FK = 'fk_3308fe130c' + NEW_SOURCE_PROJECT_FK = 'fk_source_project' + + def up + add_concurrent_foreign_key :merge_requests, :projects, column: :source_project_id, on_delete: :nullify, name: NEW_SOURCE_PROJECT_FK + + remove_foreign_key_if_exists :merge_requests, column: :source_project_id, name: OLD_SOURCE_PROJECT_FK + end + + def down + add_concurrent_foreign_key :merge_requests, :projects, column: :source_project_id, on_delete: :nullify + + remove_foreign_key_if_exists :merge_requests, column: :source_project_id, name: NEW_SOURCE_PROJECT_FK + end +end diff --git a/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb b/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb new file mode 100644 index 00000000000..47b2f81cfae --- /dev/null +++ b/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class SwapPartitionedWebHookLogs < ActiveRecord::Migration[6.0] + include Gitlab::Database::PartitioningMigrationHelpers + + DOWNTIME = false + + def up + replace_with_partitioned_table :web_hook_logs + end + + def down + rollback_replace_with_partitioned_table :web_hook_logs + end +end diff --git a/db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb b/db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb new file mode 100644 index 00000000000..69542e7627d --- /dev/null +++ b/db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddProjectIdFkToTimelogs < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_timelogs_on_project_id_and_spent_at' + + disable_ddl_transaction! + + def up + add_concurrent_index :timelogs, [:project_id, :spent_at], name: INDEX_NAME + add_concurrent_foreign_key :timelogs, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :timelogs, column: :project_id + end + remove_concurrent_index_by_name :timelogs, INDEX_NAME + end +end diff --git a/db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb b/db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb new file mode 100644 index 00000000000..e2f82557387 --- /dev/null +++ b/db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiBuildsToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_builds + COLUMNS = %i(id stage_id) + TARGET_COLUMNS = COLUMNS.map { |col| "#{col}_convert_to_bigint" } + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb b/db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb new file mode 100644 index 00000000000..ec3bb0b7e45 --- /dev/null +++ b/db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiBuildTraceChunksToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_build_trace_chunks + COLUMNS = %i(build_id) + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb b/db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb new file mode 100644 index 00000000000..c429094762e --- /dev/null +++ b/db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToBatchedMigrationJobsStatus < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_batched_jobs_on_batched_migration_id_and_status' + + def up + add_concurrent_index :batched_background_migration_jobs, [:batched_background_migration_id, :status], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :batched_background_migration_jobs, INDEX_NAME + end +end diff --git a/db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb b/db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb new file mode 100644 index 00000000000..ffa653604df --- /dev/null +++ b/db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class InitializeConversionOfCiBuildsRunnerSessionToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_builds_runner_session + COLUMNS = %i(build_id) + + def up + initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end +end diff --git a/db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb b/db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb new file mode 100644 index 00000000000..3622dddd27f --- /dev/null +++ b/db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddExecutionOrderIndexToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_migration_jobs_on_migration_id_and_finished_at' + + def up + add_concurrent_index :batched_background_migration_jobs, %i(batched_background_migration_id finished_at), name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :batched_background_migration_jobs, INDEX_NAME + end +end diff --git a/db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb b/db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb new file mode 100644 index 00000000000..9f411a61e5c --- /dev/null +++ b/db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddSpamcheckApiKeyToApplicationSetting < ActiveRecord::Migration[6.0] + def up + add_column :application_settings, :encrypted_spam_check_api_key, :binary + add_column :application_settings, :encrypted_spam_check_api_key_iv, :binary + end + + def down + remove_column :application_settings, :encrypted_spam_check_api_key + remove_column :application_settings, :encrypted_spam_check_api_key_iv + end +end diff --git a/db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb b/db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb new file mode 100644 index 00000000000..fbae2a14d2d --- /dev/null +++ b/db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddDescriptionRollOverToIterationsCadences < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + with_lock_retries do + add_column :iterations_cadences, :roll_over, :boolean, null: false, default: false + add_column :iterations_cadences, :description, :text # rubocop:disable Migration/AddLimitToTextColumns + end + end + + def down + with_lock_retries do + remove_column :iterations_cadences, :roll_over + remove_column :iterations_cadences, :description + end + end +end diff --git a/db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb b/db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb new file mode 100644 index 00000000000..a146f295de3 --- /dev/null +++ b/db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddTextLimitToIterationsCadencesDescription < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_text_limit :iterations_cadences, :description, 5000 + end + + def down + remove_text_limit :iterations_cadences, :description + end +end diff --git a/db/migrate/20210428151144_update_invalid_web_hooks.rb b/db/migrate/20210428151144_update_invalid_web_hooks.rb new file mode 100644 index 00000000000..4f45e7aaa9b --- /dev/null +++ b/db/migrate/20210428151144_update_invalid_web_hooks.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class UpdateInvalidWebHooks < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + class WebHook < ActiveRecord::Base + include EachBatch + + self.table_name = 'web_hooks' + end + + def up + WebHook.each_batch(of: 10_000, column: :id) do |relation| + relation.where(type: 'ProjectHook') + .where.not(project_id: nil) + .where.not(group_id: nil) + .update_all(group_id: nil) + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb b/db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb new file mode 100644 index 00000000000..e7020665b25 --- /dev/null +++ b/db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ValidateForeignKeyOnGroupHooks < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + CONSTRAINT_NAME = 'fk_rails_d35697648e' + + def up + validate_foreign_key :web_hooks, :group_id, name: CONSTRAINT_NAME + end + + def down + # no-op + end +end diff --git a/db/migrate/20210429024843_add_escalation_policies.rb b/db/migrate/20210429024843_add_escalation_policies.rb new file mode 100644 index 00000000000..63bd558acfb --- /dev/null +++ b/db/migrate/20210429024843_add_escalation_policies.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddEscalationPolicies < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + UNIQUE_INDEX_NAME = 'index_on_project_id_escalation_policy_name_unique' + + def up + create_table_with_constraints :incident_management_escalation_policies do |t| + t.references :project, index: false, null: false, foreign_key: { on_delete: :cascade } + t.text :name, null: false + t.text :description, null: true + + t.text_limit :name, 72 + t.text_limit :description, 160 + t.index [:project_id, :name], unique: true, name: UNIQUE_INDEX_NAME + end + end + + def down + drop_table :incident_management_escalation_policies + end +end diff --git a/db/migrate/20210429032320_add_escalation_rules.rb b/db/migrate/20210429032320_add_escalation_rules.rb new file mode 100644 index 00000000000..2297f7511a6 --- /dev/null +++ b/db/migrate/20210429032320_add_escalation_rules.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddEscalationRules < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + RULE_SCHEDULE_INDEX_NAME = 'index_on_oncall_schedule_escalation_rule' + UNIQUENESS_INDEX_NAME = 'index_on_policy_schedule_status_elapsed_time_escalation_rules' + + def change + create_table :incident_management_escalation_rules do |t| + t.belongs_to :policy, index: false, null: false, foreign_key: { on_delete: :cascade, to_table: :incident_management_escalation_policies } + t.belongs_to :oncall_schedule, index: { name: RULE_SCHEDULE_INDEX_NAME }, null: false, foreign_key: { on_delete: :cascade, to_table: :incident_management_oncall_schedules } + t.integer :status, null: false, limit: 2 + t.integer :elapsed_time_seconds, null: false, limit: 4 + + t.index [:policy_id, :oncall_schedule_id, :status, :elapsed_time_seconds], unique: true, name: UNIQUENESS_INDEX_NAME + end + end +end diff --git a/db/migrate/20210429131525_create_user_credit_card_validations.rb b/db/migrate/20210429131525_create_user_credit_card_validations.rb new file mode 100644 index 00000000000..8548274b29a --- /dev/null +++ b/db/migrate/20210429131525_create_user_credit_card_validations.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class CreateUserCreditCardValidations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :user_credit_card_validations, id: false do |t| + t.references :user, foreign_key: { on_delete: :cascade }, index: false, primary_key: true, default: nil + t.datetime_with_timezone :credit_card_validated_at, null: false + end + end + end + + def down + with_lock_retries do + drop_table :user_credit_card_validations + end + end +end diff --git a/db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb b/db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb new file mode 100644 index 00000000000..4a34c2dd307 --- /dev/null +++ b/db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddFailureTrackingToWebHooks < ActiveRecord::Migration[6.0] + def change + change_table(:web_hooks, bulk: true) do |t| + t.integer :recent_failures, null: false, limit: 2, default: 0 + t.integer :backoff_count, null: false, limit: 2, default: 0 + t.column :disabled_until, :timestamptz + end + end +end diff --git a/db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb b/db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb new file mode 100644 index 00000000000..8c328eb52fc --- /dev/null +++ b/db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddGenericPackageDuplicateSettingsToNamespacePackageSettings < ActiveRecord::Migration[6.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex + def change + add_column :namespace_package_settings, :generic_duplicates_allowed, :boolean, null: false, default: true + add_column :namespace_package_settings, :generic_duplicate_exception_regex, :text, null: false, default: '' + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb b/db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb new file mode 100644 index 00000000000..5d02ad3e2f5 --- /dev/null +++ b/db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddTextLimitToNamespacePackageSettingsGenericDuplicateExceptionRegex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_text_limit :namespace_package_settings, :generic_duplicate_exception_regex, 255 + end + + def down + remove_text_limit :namespace_package_settings, :generic_duplicate_exception_regex + end +end diff --git a/db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb b/db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb new file mode 100644 index 00000000000..48ab860a63b --- /dev/null +++ b/db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddAlertManagerTokenToClustersIntegrationPrometheus < ActiveRecord::Migration[6.0] + def change + change_table :clusters_integration_prometheus do |t| + t.text :encrypted_alert_manager_token + t.text :encrypted_alert_manager_token_iv + end + end +end diff --git a/db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb b/db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb new file mode 100644 index 00000000000..446ac93c75b --- /dev/null +++ b/db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddElasticsearchUsernamePasswordToApplicationSettings < ActiveRecord::Migration[6.0] + def change + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20210505124816_add_text_limit_to_elasticsearch_username + add_column :application_settings, :elasticsearch_username, :text + # rubocop:enable Migration/AddLimitToTextColumns + + add_column :application_settings, :encrypted_elasticsearch_password, :binary + add_column :application_settings, :encrypted_elasticsearch_password_iv, :binary + end +end diff --git a/db/migrate/20210430122951_add_snapshot_namespace_id.rb b/db/migrate/20210430122951_add_snapshot_namespace_id.rb new file mode 100644 index 00000000000..9017bcdde53 --- /dev/null +++ b/db/migrate/20210430122951_add_snapshot_namespace_id.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddSnapshotNamespaceId < ActiveRecord::Migration[6.0] + def change + add_column :analytics_devops_adoption_snapshots, :namespace_id, :integer + end +end diff --git a/db/migrate/20210430124212_add_display_namespace_id_to_segments.rb b/db/migrate/20210430124212_add_display_namespace_id_to_segments.rb new file mode 100644 index 00000000000..43be5c719fb --- /dev/null +++ b/db/migrate/20210430124212_add_display_namespace_id_to_segments.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddDisplayNamespaceIdToSegments < ActiveRecord::Migration[6.0] + def change + add_column :analytics_devops_adoption_segments, :display_namespace_id, :integer + end +end diff --git a/db/migrate/20210430124630_add_devops_adoption_indexes.rb b/db/migrate/20210430124630_add_devops_adoption_indexes.rb new file mode 100644 index 00000000000..4531e6b5e4c --- /dev/null +++ b/db/migrate/20210430124630_add_devops_adoption_indexes.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class AddDevopsAdoptionIndexes < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + SEGMENTS_INDEX_NAME = 'idx_devops_adoption_segments_namespaces_pair' + SNAPSHOT_END_TIME_INDEX_NAME = 'idx_devops_adoption_segments_namespace_end_time' + SNAPSHOT_RECORDED_AT_INDEX_NAME = 'idx_devops_adoption_segments_namespace_recorded_at' + + def up + add_concurrent_index :analytics_devops_adoption_snapshots, [:namespace_id, :end_time], + name: SNAPSHOT_END_TIME_INDEX_NAME + add_concurrent_index :analytics_devops_adoption_snapshots, [:namespace_id, :recorded_at], + name: SNAPSHOT_RECORDED_AT_INDEX_NAME + add_concurrent_index :analytics_devops_adoption_segments, [:display_namespace_id, :namespace_id], + unique: true, name: SEGMENTS_INDEX_NAME + + add_concurrent_foreign_key :analytics_devops_adoption_snapshots, :namespaces, column: :namespace_id + add_concurrent_foreign_key :analytics_devops_adoption_segments, :namespaces, column: :display_namespace_id + end + + def down + remove_foreign_key :analytics_devops_adoption_segments, :namespaces, column: :display_namespace_id + remove_foreign_key :analytics_devops_adoption_snapshots, :namespaces, column: :namespace_id + + remove_concurrent_index_by_name :analytics_devops_adoption_segments, SEGMENTS_INDEX_NAME + remove_concurrent_index_by_name :analytics_devops_adoption_snapshots, SNAPSHOT_RECORDED_AT_INDEX_NAME + remove_concurrent_index_by_name :analytics_devops_adoption_snapshots, SNAPSHOT_END_TIME_INDEX_NAME + end +end diff --git a/db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb b/db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb new file mode 100644 index 00000000000..be022c1b973 --- /dev/null +++ b/db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true +class AddSliceMultiplierAndMaxSlicesToElasticReindexingTask < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DEFAULT_MAX_TOTAL_SLICES_RUNNING = 60 + DEFAULT_SLICE_MULTIPLIER = 2 + + def change + add_column :elastic_reindexing_tasks, :max_slices_running, :integer, + limit: 2, + default: DEFAULT_MAX_TOTAL_SLICES_RUNNING, + null: false + add_column :elastic_reindexing_tasks, :slice_multiplier, :integer, + limit: 2, + default: DEFAULT_SLICE_MULTIPLIER, + null: false + end +end diff --git a/db/migrate/20210503105022_create_project_value_streams.rb b/db/migrate/20210503105022_create_project_value_streams.rb new file mode 100644 index 00000000000..775ab03ad4b --- /dev/null +++ b/db/migrate/20210503105022_create_project_value_streams.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class CreateProjectValueStreams < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_analytics_ca_project_value_streams_on_project_id_and_name' + + def up + create_table_with_constraints :analytics_cycle_analytics_project_value_streams do |t| + t.timestamps_with_timezone + t.references(:project, + null: false, + index: false, + foreign_key: { to_table: :projects, on_delete: :cascade } + ) + t.text :name, null: false + t.index [:project_id, :name], unique: true, name: INDEX_NAME + t.text_limit :name, 100 + end + end + + def down + with_lock_retries do + drop_table :analytics_cycle_analytics_project_value_streams + end + end +end diff --git a/db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb b/db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb new file mode 100644 index 00000000000..d888ab4943c --- /dev/null +++ b/db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class AddProjectValueStreamIdToProjectStages < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_analytics_ca_project_stages_on_value_stream_id' + + class ProjectValueStream < ActiveRecord::Base + self.table_name = 'analytics_cycle_analytics_project_stages' + + include EachBatch + end + + def up + ProjectValueStream.reset_column_information + # The table was never used, there is no user-facing code that modifies the table, it should be empty. + # Since there is no functionality present that depends on this data, it's safe to delete the rows. + ProjectValueStream.each_batch(of: 100) do |relation| + relation.delete_all + end + + transaction do + add_reference :analytics_cycle_analytics_project_stages, :project_value_stream, null: false, index: { name: INDEX_NAME }, foreign_key: { on_delete: :cascade, to_table: :analytics_cycle_analytics_project_value_streams }, type: :bigint # rubocop: disable Migration/AddReference, Rails/NotNullColumn + end + end + + def down + remove_reference :analytics_cycle_analytics_project_stages, :project_value_stream + end +end diff --git a/db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb b/db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb new file mode 100644 index 00000000000..cb23c9391ea --- /dev/null +++ b/db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddWebHookCallsToPlanLimits < ActiveRecord::Migration[6.0] + def change + add_column :plan_limits, :web_hook_calls, :integer, null: false, default: 0 + end +end diff --git a/db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb b/db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb new file mode 100644 index 00000000000..898a0ccd1c5 --- /dev/null +++ b/db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnWebHookProjectIdRecentFailures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_web_hooks_on_project_id_recent_failures' + + disable_ddl_transaction! + + def up + add_concurrent_index(:web_hooks, [:project_id, :recent_failures], name: INDEX_NAME) + end + + def down + remove_concurrent_index_by_name(:web_hooks, INDEX_NAME) + end +end diff --git a/db/migrate/20210504135823_add_floc_application_settings.rb b/db/migrate/20210504135823_add_floc_application_settings.rb new file mode 100644 index 00000000000..a5e3aad6b8c --- /dev/null +++ b/db/migrate/20210504135823_add_floc_application_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddFlocApplicationSettings < ActiveRecord::Migration[6.0] + def change + add_column :application_settings, :floc_enabled, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20210504153354_create_clusters_integration_elasticstack.rb b/db/migrate/20210504153354_create_clusters_integration_elasticstack.rb new file mode 100644 index 00000000000..5868325e701 --- /dev/null +++ b/db/migrate/20210504153354_create_clusters_integration_elasticstack.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateClustersIntegrationElasticstack < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def change + create_table_with_constraints :clusters_integration_elasticstack, id: false do |t| + t.timestamps_with_timezone null: false + t.references :cluster, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade } + t.boolean :enabled, null: false, default: false + t.text :chart_version + t.text_limit :chart_version, 10 + end + end +end diff --git a/db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb b/db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb new file mode 100644 index 00000000000..af403faa278 --- /dev/null +++ b/db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreatePartialIndexesForPendingAndRunningBuilds < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_PENDING = 'index_ci_builds_runner_id_pending' + INDEX_RUNNING = 'index_ci_builds_runner_id_running' + + def up + add_concurrent_index :ci_builds, :runner_id, where: "status = 'pending' AND type = 'Ci::Build'", name: INDEX_PENDING + add_concurrent_index :ci_builds, :runner_id, where: "status = 'running' AND type = 'Ci::Build'", name: INDEX_RUNNING + end + + def down + remove_concurrent_index_by_name :ci_builds, INDEX_PENDING + remove_concurrent_index_by_name :ci_builds, INDEX_RUNNING + end +end diff --git a/db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb b/db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb new file mode 100644 index 00000000000..324b9193efb --- /dev/null +++ b/db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddTextLimitToElasticsearchUsername < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :elasticsearch_username, 255 + end + + def down + remove_text_limit :application_settings, :elasticsearch_username + end +end diff --git a/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb b/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb new file mode 100644 index 00000000000..107388fe533 --- /dev/null +++ b/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddRemoveOnIssueCloseToLabels < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + with_lock_retries do + add_column :labels, :remove_on_close, :boolean, null: false, default: false + end + end + + def down + with_lock_retries do + remove_column :labels, :remove_on_close, :boolean + end + end +end diff --git a/db/migrate/20210510191551_add_body_to_findings_evidences_request.rb b/db/migrate/20210510191551_add_body_to_findings_evidences_request.rb new file mode 100644 index 00000000000..9b0054dbd22 --- /dev/null +++ b/db/migrate/20210510191551_add_body_to_findings_evidences_request.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddBodyToFindingsEvidencesRequest < ActiveRecord::Migration[6.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20210510191552_add_limit_to_findings_evidences_request_body.rb + def change + add_column :vulnerability_finding_evidence_requests, :body, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb b/db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb new file mode 100644 index 00000000000..84c8acdb10d --- /dev/null +++ b/db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddLimitToFindingsEvidencesRequestBody < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :vulnerability_finding_evidence_requests, :body, 2048 + end + + def down + remove_text_limit :vulnerability_finding_evidence_requests, :body + end +end diff --git a/db/migrate/20210511104929_add_epic_board_recent_visits_table.rb b/db/migrate/20210511104929_add_epic_board_recent_visits_table.rb new file mode 100644 index 00000000000..9822276f9c4 --- /dev/null +++ b/db/migrate/20210511104929_add_epic_board_recent_visits_table.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddEpicBoardRecentVisitsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + with_lock_retries do + unless table_exists?(:boards_epic_board_recent_visits) + create_table :boards_epic_board_recent_visits do |t| + t.references :user, index: true, null: false, foreign_key: { on_delete: :cascade } + t.references :epic_board, index: true, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false + t.references :group, index: true, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false + t.timestamps_with_timezone null: false + end + end + end + end + + def down + with_lock_retries do + drop_table :boards_epic_board_recent_visits + end + end +end diff --git a/db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb b/db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb new file mode 100644 index 00000000000..1341886c50c --- /dev/null +++ b/db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddIndexToEpicBoardRecentVisits < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'index_epic_board_recent_visits_on_user_group_and_board' + + disable_ddl_transaction! + + def up + add_concurrent_index :boards_epic_board_recent_visits, + [:user_id, :group_id, :epic_board_id], + name: INDEX_NAME, + unique: true + end + + def down + remove_concurrent_index_by_name :boards_epic_board_recent_visits, INDEX_NAME + end +end diff --git a/db/migrate/20210512183309_add_body_to_findings_evidences_response.rb b/db/migrate/20210512183309_add_body_to_findings_evidences_response.rb new file mode 100644 index 00000000000..6884d339b9c --- /dev/null +++ b/db/migrate/20210512183309_add_body_to_findings_evidences_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddBodyToFindingsEvidencesResponse < ActiveRecord::Migration[6.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20210512183310_add_limit_to_findings_evidences_response_body.rb + def change + add_column :vulnerability_finding_evidence_responses, :body, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb b/db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb new file mode 100644 index 00000000000..bdd15163809 --- /dev/null +++ b/db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddLimitToFindingsEvidencesResponseBody < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :vulnerability_finding_evidence_responses, :body, 2048 + end + + def down + remove_text_limit :vulnerability_finding_evidence_responses, :body + end +end diff --git a/db/migrate/20210513093418_add_draft_column_to_merge_requests.rb b/db/migrate/20210513093418_add_draft_column_to_merge_requests.rb new file mode 100644 index 00000000000..67e2cc0eea0 --- /dev/null +++ b/db/migrate/20210513093418_add_draft_column_to_merge_requests.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddDraftColumnToMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + with_lock_retries do + add_column :merge_requests, :draft, :boolean, default: false, null: false + end + end + + def down + with_lock_retries do + remove_column :merge_requests, :draft + end + end +end diff --git a/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb b/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb index 5fcec83bfc3..3ec6c59f166 100644 --- a/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb +++ b/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb @@ -29,7 +29,7 @@ class BackfillVersionAuthorAndCreatedAt < ActiveRecord::Migration[5.2] issues = Issue.arel_table projects = Project.arel_table - Version.select(versions[:issue_id]).where( + select(versions[:issue_id]).where( versions[:author_id].eq(nil).or( versions[:created_at].eq(nil) ).and( diff --git a/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb b/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb index 4bb43da43bb..f7df9f28187 100644 --- a/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb +++ b/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb @@ -9,6 +9,8 @@ class RemoveDuplicateLabelsFromProject < ActiveRecord::Migration[6.0] disable_ddl_transaction! class BackupLabel < Label + self.inheritance_column = :_type_disabled + self.table_name = 'backup_labels' end diff --git a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb index 9e606b2264b..8e6ee0f35ca 100644 --- a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb +++ b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb @@ -82,12 +82,12 @@ class CleanupProjectsWithMissingNamespace < ActiveRecord::Migration[6.0] # There should only be one Group for User Ghost starting with LOST_AND_FOUND_GROUP Group .joins('INNER JOIN members ON namespaces.id = members.source_id') - .where('namespaces.type = ?', 'Group') - .where('members.type = ?', 'GroupMember') - .where('members.source_type = ?', 'Namespace') - .where('members.user_id = ?', self.id) - .where('members.requested_at IS NULL') - .where('members.access_level = ?', ACCESS_LEVEL_OWNER) + .where(namespaces: { type: 'Group' }) + .where(members: { type: 'GroupMember' }) + .where(members: { source_type: 'Namespace' }) + .where(members: { user_id: self.id }) + .where(members: { requested_at: nil }) + .where(members: { access_level: ACCESS_LEVEL_OWNER }) .find_by(Group.arel_table[:name].matches("#{LOST_AND_FOUND_GROUP}%")) end diff --git a/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb b/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb index faa3c4161a0..2b036a8da80 100644 --- a/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb +++ b/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb @@ -25,11 +25,11 @@ class UpdateRoutesForLostAndFoundGroupAndOrphanedProjects < ActiveRecord::Migrat # There should only be one Group owned by the Ghost user starting with 'lost-and-found' Group .joins('INNER JOIN members ON namespaces.id = members.source_id') - .where('namespaces.type = ?', 'Group') - .where('members.type = ?', 'GroupMember') - .where('members.source_type = ?', 'Namespace') - .where('members.user_id = ?', self.id) - .where('members.access_level = ?', ACCESS_LEVEL_OWNER) + .where(namespaces: { type: 'Group' }) + .where(members: { type: 'GroupMember' }) + .where(members: { source_type: 'Namespace' }) + .where(members: { user_id: self.id }) + .where(members: { access_level: ACCESS_LEVEL_OWNER }) .find_by(Group.arel_table[:name].matches("#{LOST_AND_FOUND_GROUP}%")) end diff --git a/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb b/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb index 85d62cbb6dd..1d3f57d3fe6 100644 --- a/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb +++ b/db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb @@ -36,7 +36,7 @@ class GenerateMissingRoutesForBots < ActiveRecord::Migration[6.0] belongs_to :owner, class_name: 'GenerateMissingRoutesForBots::User' - scope :for_user, -> { where('type IS NULL') } + scope :for_user, -> { where(type: nil) } scope :for_bots, -> { for_user.joins(:owner).merge(GenerateMissingRoutesForBots::User.bots) } scope :without_routes, -> do diff --git a/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb index 861d9e40e77..f956da81528 100644 --- a/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb +++ b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb @@ -71,7 +71,7 @@ class CleanupGroupImportStatesWithNullUserId < ActiveRecord::Migration[6.0] end end - GroupImportState.where('user_id IS NULL').delete_all + GroupImportState.where(user_id: nil).delete_all end def down diff --git a/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb b/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb index 121b9fee623..bb1ac3dee4c 100644 --- a/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb +++ b/db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb @@ -21,11 +21,11 @@ class EnsureU2fRegistrationsMigrated < ActiveRecord::Migration[6.0] # Do a manual update in case we lost BG jobs. The expected record count should be 0 or very low. U2fRegistration .joins("LEFT JOIN webauthn_registrations ON webauthn_registrations.u2f_registration_id = u2f_registrations.id") - .where("webauthn_registrations.u2f_registration_id IS NULL") + .where(webauthn_registrations: { u2f_registration_id: nil }) .each_batch(of: BATCH_SIZE) do |batch, index| batch.each do |record| Gitlab::BackgroundMigration::MigrateU2fWebauthn.new.perform(record.id, record.id) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, u2f_registration_id: record.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 index 1fcfb3d43c0..2250d4c0c8a 100644 --- 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 @@ -15,7 +15,7 @@ class CleanupGitlabSubscriptionsWithNullNamespaceId < ActiveRecord::Migration[6. # 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 + GitlabSubscription.where(namespace_id: nil).delete_all end def down diff --git a/db/post_migrate/20210303121224_update_gitlab_subscriptions_start_at_post_eoa.rb b/db/post_migrate/20210303121224_update_gitlab_subscriptions_start_at_post_eoa.rb new file mode 100644 index 00000000000..69d99704469 --- /dev/null +++ b/db/post_migrate/20210303121224_update_gitlab_subscriptions_start_at_post_eoa.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +class UpdateGitlabSubscriptionsStartAtPostEoa < ActiveRecord::Migration[6.0] + UPDATE_BATCH_SIZE = 100 + + disable_ddl_transaction! + + class Plan < ActiveRecord::Base + self.table_name = 'plans' + self.inheritance_column = :_type_disabled + end + + class GitlabSubscription < ActiveRecord::Base + include EachBatch + + self.table_name = 'gitlab_subscriptions' + self.inheritance_column = :_type_disabled + + EOA_ROLLOUT_DATE = '2021-01-26' + + scope :with_plan, -> (from_plan) do + where("start_date >= ? AND hosted_plan_id = ?", EOA_ROLLOUT_DATE, from_plan.id) + end + end + + def up + return unless Gitlab.com? + + silver_plan = Plan.find_by(name: 'silver') + gold_plan = Plan.find_by(name: 'gold') + premium_plan = Plan.find_by(name: 'premium') + ultimate_plan = Plan.find_by(name: 'ultimate') + + # Silver to Premium + update_hosted_plan_for_subscription(from_plan: silver_plan, to_plan: premium_plan) + + # Gold to Ultimate + update_hosted_plan_for_subscription(from_plan: gold_plan, to_plan: ultimate_plan) + end + + def down + # no-op + end + + private + + def update_hosted_plan_for_subscription(from_plan:, to_plan:) + return unless from_plan && to_plan + + GitlabSubscription.with_plan(from_plan).each_batch(of: UPDATE_BATCH_SIZE) do |batch| + batch.update_all(hosted_plan_id: to_plan.id) + end + 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 index 80ea1748eed..6553036792c 100644 --- a/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb +++ b/db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb @@ -15,7 +15,7 @@ class CleanupClusterTokensWithNullName < ActiveRecord::Migration[6.0] def up AgentToken.each_batch(of: BATCH_SIZE) do |relation| - relation.where('name IS NULL').update_all("name = 'agent-token-' || id") + relation.where(name: nil).update_all("name = 'agent-token-' || id") end end diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb index 01e81c65eee..37546a793f7 100644 --- a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb @@ -17,7 +17,7 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0] Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'events', column_name: 'id') - .where('job_arguments = ?', %w[id id_convert_to_bigint].to_json) + .where(job_arguments: %w[id id_convert_to_bigint].to_json) .delete_all end diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb index 6b8595b3ad3..87250c82244 100644 --- a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb +++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb @@ -18,7 +18,7 @@ class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migrati Gitlab::Database::BackgroundMigration::BatchedMigration .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') .where(table_name: 'push_event_payloads', column_name: 'event_id') - .where('job_arguments = ?', %w[event_id event_id_convert_to_bigint].to_json) + .where(job_arguments: %w[event_id event_id_convert_to_bigint].to_json) .delete_all end diff --git a/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb b/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb index 6e3f7ae34d1..ee118371fb8 100644 --- a/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb +++ b/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb @@ -16,9 +16,11 @@ class MoveContainerRegistryEnabledToProjectFeatures2 < ActiveRecord::Migration[6 end def up - delete_queued_jobs('MoveContainerRegistryEnabledToProjectFeature') + # Superceded by db/post_migrate/20210415155043_move_container_registry_enabled_to_project_features3.rb. - queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE, track_jobs: true) + # delete_queued_jobs('MoveContainerRegistryEnabledToProjectFeature') + + # queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE, track_jobs: true) end def down diff --git a/db/post_migrate/20210403022952_remove_notes_delete_cascade_timelogs.rb b/db/post_migrate/20210403022952_remove_notes_delete_cascade_timelogs.rb new file mode 100644 index 00000000000..832ba584931 --- /dev/null +++ b/db/post_migrate/20210403022952_remove_notes_delete_cascade_timelogs.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class RemoveNotesDeleteCascadeTimelogs < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + CONSTRAINT_NAME = 'fk_timelogs_note_id' + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :timelogs, :notes, column: :note_id, on_delete: :nullify, name: CONSTRAINT_NAME + + with_lock_retries do + remove_foreign_key_if_exists :timelogs, :notes, column: :note_id, on_delete: :cascade + end + end + + def down + add_concurrent_foreign_key :timelogs, :notes, column: :note_id, on_delete: :cascade + + with_lock_retries do + remove_foreign_key_if_exists :timelogs, :notes, column: :note_id, on_delete: :nullify, name: CONSTRAINT_NAME + end + end +end diff --git a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb new file mode 100644 index 00000000000..3e4f1450632 --- /dev/null +++ b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class BackfillCiBuildNeedsForBigintConversion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint :ci_build_needs, :build_id, + batch_size: 15000, sub_batch_size: 100 + end + + def down + return unless should_run? + + Gitlab::Database::BackgroundMigration::BatchedMigration + .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') + .where(table_name: 'ci_build_needs', column_name: 'build_id') + .where(job_arguments: %w[build_id build_id_convert_to_bigint].to_json) + .delete_all + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20210415155043_move_container_registry_enabled_to_project_features3.rb b/db/post_migrate/20210415155043_move_container_registry_enabled_to_project_features3.rb new file mode 100644 index 00000000000..6fd8d280c97 --- /dev/null +++ b/db/post_migrate/20210415155043_move_container_registry_enabled_to_project_features3.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class MoveContainerRegistryEnabledToProjectFeatures3 < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + include Gitlab::Database::DynamicModelHelpers + + BATCH_SIZE = 21_000 + MIGRATION = 'MoveContainerRegistryEnabledToProjectFeature' + + disable_ddl_transaction! + + def up + # Delete any existing jobs from the queue + delete_queued_jobs(MIGRATION) + + # Delete existing rows in background_migration_jobs table + bg_migration_job_class = define_model('background_migration_jobs') + bg_migration_job_class.where(class_name: MIGRATION).delete_all + + batchable_project_class = define_batchable_model('projects') + queue_background_migration_jobs_by_range_at_intervals(batchable_project_class, MIGRATION, 2.minutes, batch_size: BATCH_SIZE, track_jobs: true) + end + + def down + # no-op + end + + private + + def define_model(table_name) + Class.new(ActiveRecord::Base) do + self.table_name = table_name + self.inheritance_column = :_type_disabled + end + end +end diff --git a/db/post_migrate/20210420103955_remove_hipchat_service_records.rb b/db/post_migrate/20210420103955_remove_hipchat_service_records.rb new file mode 100644 index 00000000000..5ad34cfad22 --- /dev/null +++ b/db/post_migrate/20210420103955_remove_hipchat_service_records.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveHipchatServiceRecords < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + class Service < ActiveRecord::Base + include EachBatch + + self.table_name = 'services' + end + + def up + Service.each_batch(of: 100_000, column: :id) do |relation| + relation.delete_by(type: 'HipchatService') + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb new file mode 100644 index 00000000000..b6b37acab3b --- /dev/null +++ b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class BackfillConversionOfCiJobArtifacts < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint :ci_job_artifacts, %i(id job_id), batch_size: 15000, sub_batch_size: 100 + end + + def down + return unless should_run? + + Gitlab::Database::BackgroundMigration::BatchedMigration + .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') + .where(table_name: 'ci_job_artifacts', column_name: 'id') + .where(job_arguments: [%w[id job_id], %w[id_convert_to_bigint job_id_convert_to_bigint]].to_json) + .delete_all + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb new file mode 100644 index 00000000000..0aea924c982 --- /dev/null +++ b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class BackfillCiSourcesPipelinesSourceJobIdForBigintConversion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint :ci_sources_pipelines, :source_job_id, + batch_size: 15000, sub_batch_size: 100 + end + + def down + return unless should_run? + + Gitlab::Database::BackgroundMigration::BatchedMigration + .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob') + .where(table_name: 'ci_sources_pipelines', column_name: 'id') + .where(job_arguments: [%w[source_job_id], %w[source_job_id_convert_to_bigint]].to_json) + .delete_all + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20210423124223_remove_proxy_settings_to_jira_tracker_data.rb b/db/post_migrate/20210423124223_remove_proxy_settings_to_jira_tracker_data.rb new file mode 100644 index 00000000000..43ab965d79c --- /dev/null +++ b/db/post_migrate/20210423124223_remove_proxy_settings_to_jira_tracker_data.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class RemoveProxySettingsToJiraTrackerData < ActiveRecord::Migration[6.0] + def change + remove_column :jira_tracker_data, :encrypted_proxy_address, :text + remove_column :jira_tracker_data, :encrypted_proxy_address_iv, :text + remove_column :jira_tracker_data, :encrypted_proxy_port, :text + remove_column :jira_tracker_data, :encrypted_proxy_port_iv, :text + remove_column :jira_tracker_data, :encrypted_proxy_username, :text + remove_column :jira_tracker_data, :encrypted_proxy_username_iv, :text + remove_column :jira_tracker_data, :encrypted_proxy_password, :text + remove_column :jira_tracker_data, :encrypted_proxy_password_iv, :text + end +end diff --git a/db/post_migrate/20210423160427_schedule_drop_invalid_vulnerabilities.rb b/db/post_migrate/20210423160427_schedule_drop_invalid_vulnerabilities.rb new file mode 100644 index 00000000000..8199da937d3 --- /dev/null +++ b/db/post_migrate/20210423160427_schedule_drop_invalid_vulnerabilities.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class ScheduleDropInvalidVulnerabilities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'DropInvalidVulnerabilities' + DELAY_INTERVAL = 2.minutes.to_i + BATCH_SIZE = 10_000 + + disable_ddl_transaction! + + def up + say "Scheduling #{MIGRATION} jobs" + queue_background_migration_jobs_by_range_at_intervals( + define_batchable_model('vulnerabilities'), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb new file mode 100644 index 00000000000..972df41f678 --- /dev/null +++ b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class BackfillCiBuildsForBigintConversion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + TABLE = :ci_builds + COLUMNS = %i(id stage_id).freeze + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint TABLE, COLUMNS, batch_size: 15000, sub_batch_size: 100 + end + + def down + return unless should_run? + + revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb b/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb new file mode 100644 index 00000000000..4c656f56a32 --- /dev/null +++ b/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class BackfillCiBuildTraceChunksForBigintConversion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_build_trace_chunks + COLUMNS = %i(build_id) + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + return unless should_run? + + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb b/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb new file mode 100644 index 00000000000..b548309cdb7 --- /dev/null +++ b/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class BackfillCiBuildsRunnerSessionForBigintConversion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + TABLE = :ci_builds_runner_session + COLUMNS = %i(build_id) + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + def down + return unless should_run? + + revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS) + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end diff --git a/db/post_migrate/20210427212034_schedule_update_timelogs_project_id.rb b/db/post_migrate/20210427212034_schedule_update_timelogs_project_id.rb new file mode 100644 index 00000000000..13b802f7cb4 --- /dev/null +++ b/db/post_migrate/20210427212034_schedule_update_timelogs_project_id.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class ScheduleUpdateTimelogsProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 50_000 + DELAY_INTERVAL = 2.minutes + MIGRATION = 'UpdateTimelogsProjectId' + + disable_ddl_transaction! + + class Timelog < ActiveRecord::Base + include EachBatch + + self.table_name = 'timelogs' + self.inheritance_column = :_type_disabled + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + Timelog.all, + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210429143649_add_new_issues_index_for_relative_position.rb b/db/post_migrate/20210429143649_add_new_issues_index_for_relative_position.rb new file mode 100644 index 00000000000..50785fa94f8 --- /dev/null +++ b/db/post_migrate/20210429143649_add_new_issues_index_for_relative_position.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNewIssuesIndexForRelativePosition < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'idx_issues_on_project_id_and_rel_asc_and_id' + + def up + add_concurrent_index :issues, [:project_id, :relative_position, :id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name(:issues, INDEX_NAME) + end +end diff --git a/db/post_migrate/20210430130259_remove_obsolete_segments_field.rb b/db/post_migrate/20210430130259_remove_obsolete_segments_field.rb new file mode 100644 index 00000000000..ffdd84582cb --- /dev/null +++ b/db/post_migrate/20210430130259_remove_obsolete_segments_field.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RemoveObsoleteSegmentsField < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + with_lock_retries do + remove_column :analytics_devops_adoption_segments, :name + end + end + + def down + add_column :analytics_devops_adoption_segments, :name, :text + add_text_limit :analytics_devops_adoption_segments, :name, 255 + end +end diff --git a/db/post_migrate/20210430134202_copy_adoption_snapshot_namespace.rb b/db/post_migrate/20210430134202_copy_adoption_snapshot_namespace.rb new file mode 100644 index 00000000000..d0a72ff2c43 --- /dev/null +++ b/db/post_migrate/20210430134202_copy_adoption_snapshot_namespace.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class CopyAdoptionSnapshotNamespace < ActiveRecord::Migration[6.0] + def up + execute <<-SQL + UPDATE analytics_devops_adoption_snapshots snapshots + SET namespace_id = segments.namespace_id + FROM analytics_devops_adoption_segments segments + WHERE snapshots.namespace_id IS NULL AND segments.id = snapshots.segment_id + SQL + end + + def down + execute 'UPDATE analytics_devops_adoption_snapshots SET namespace_id = NULL' + end +end diff --git a/db/post_migrate/20210430135954_copy_adoption_segments_namespace.rb b/db/post_migrate/20210430135954_copy_adoption_segments_namespace.rb new file mode 100644 index 00000000000..04f454bea37 --- /dev/null +++ b/db/post_migrate/20210430135954_copy_adoption_segments_namespace.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CopyAdoptionSegmentsNamespace < ActiveRecord::Migration[6.0] + def up + execute <<-SQL + UPDATE analytics_devops_adoption_segments SET display_namespace_id = namespace_id + WHERE display_namespace_id IS NULL + SQL + end + + def down + execute 'UPDATE analytics_devops_adoption_segments SET display_namespace_id = NULL' + end +end diff --git a/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb b/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb new file mode 100644 index 00000000000..81fe65c1945 --- /dev/null +++ b/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreatePartialCoveringIndexForPendingBuilds < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + EXISTING_INDEX = 'index_ci_builds_runner_id_pending' + NEW_INDEX = 'index_ci_builds_runner_id_pending_covering' + + def up + disable_statement_timeout do + execute "CREATE INDEX CONCURRENTLY #{NEW_INDEX} ON ci_builds (runner_id, id) INCLUDE (project_id) WHERE status = 'pending' AND type = 'Ci::Build'" unless index_exists_by_name?(:ci_builds, NEW_INDEX) + end + + remove_concurrent_index_by_name :ci_builds, EXISTING_INDEX + end + + def down + add_concurrent_index :ci_builds, :runner_id, where: "status = 'pending' AND type = 'Ci::Build'", name: EXISTING_INDEX + + remove_concurrent_index_by_name :ci_builds, NEW_INDEX + end +end diff --git a/db/post_migrate/20210506064413_create_namespaces_id_parent_id_inverse_partial_index.rb b/db/post_migrate/20210506064413_create_namespaces_id_parent_id_inverse_partial_index.rb new file mode 100644 index 00000000000..151b0f64e80 --- /dev/null +++ b/db/post_migrate/20210506064413_create_namespaces_id_parent_id_inverse_partial_index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateNamespacesIdParentIdInversePartialIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + NAME = 'index_namespaces_id_parent_id_is_not_null' + + disable_ddl_transaction! + + def up + add_concurrent_index :namespaces, :id, where: 'parent_id IS NOT NULL', name: NAME + end + + def down + remove_concurrent_index :namespaces, :id, name: NAME + end +end diff --git a/db/post_migrate/20210506065000_schedule_backfill_traversal_ids.rb b/db/post_migrate/20210506065000_schedule_backfill_traversal_ids.rb new file mode 100644 index 00000000000..5ae80c1da80 --- /dev/null +++ b/db/post_migrate/20210506065000_schedule_backfill_traversal_ids.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class ScheduleBackfillTraversalIds < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + ROOTS_MIGRATION = 'BackfillNamespaceTraversalIdsRoots' + CHILDREN_MIGRATION = 'BackfillNamespaceTraversalIdsChildren' + DOWNTIME = false + BATCH_SIZE = 1_000 + SUB_BATCH_SIZE = 100 + DELAY_INTERVAL = 2.minutes + + disable_ddl_transaction! + + def up + # Personal namespaces and top-level groups + final_delay = queue_background_migration_jobs_by_range_at_intervals( + ::Gitlab::BackgroundMigration::BackfillNamespaceTraversalIdsRoots::Namespace.base_query, + ROOTS_MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + other_job_arguments: [SUB_BATCH_SIZE], + track_jobs: true + ) + final_delay += DELAY_INTERVAL + + # Subgroups + queue_background_migration_jobs_by_range_at_intervals( + ::Gitlab::BackgroundMigration::BackfillNamespaceTraversalIdsChildren::Namespace.base_query, + CHILDREN_MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + initial_delay: final_delay, + other_job_arguments: [SUB_BATCH_SIZE], + track_jobs: true + ) + end +end diff --git a/db/post_migrate/20210511095657_add_temporary_index_for_project_topics_to_taggings.rb b/db/post_migrate/20210511095657_add_temporary_index_for_project_topics_to_taggings.rb new file mode 100644 index 00000000000..0d807df614c --- /dev/null +++ b/db/post_migrate/20210511095657_add_temporary_index_for_project_topics_to_taggings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTemporaryIndexForProjectTopicsToTaggings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'tmp_index_taggings_on_id_where_taggable_type_project_and_tags' + INDEX_CONDITION = "taggable_type = 'Project' AND context = 'tags'" + + disable_ddl_transaction! + + def up + # this index is used in 20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics + add_concurrent_index :taggings, :id, where: INDEX_CONDITION, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :taggings, INDEX_NAME + end +end diff --git a/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb b/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb new file mode 100644 index 00000000000..25d23b771d5 --- /dev/null +++ b/db/post_migrate/20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ScheduleMigrateProjectTaggingsContextFromTagsToTopics < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 30_000 + DELAY_INTERVAL = 2.minutes + MIGRATION = 'MigrateProjectTaggingsContextFromTagsToTopics' + + disable_ddl_transaction! + + class Tagging < ActiveRecord::Base + include ::EachBatch + + self.table_name = 'taggings' + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + Tagging.where(taggable_type: 'Project', context: 'tags'), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + end +end diff --git a/db/post_migrate/20210511142748_schedule_drop_invalid_vulnerabilities2.rb b/db/post_migrate/20210511142748_schedule_drop_invalid_vulnerabilities2.rb new file mode 100644 index 00000000000..09886b85571 --- /dev/null +++ b/db/post_migrate/20210511142748_schedule_drop_invalid_vulnerabilities2.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class ScheduleDropInvalidVulnerabilities2 < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + MIGRATION = 'DropInvalidVulnerabilities' + DELAY_INTERVAL = 2.minutes.to_i + BATCH_SIZE = 10_000 + + disable_ddl_transaction! + + def up + queue_background_migration_jobs_by_range_at_intervals( + define_batchable_model('vulnerabilities'), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + track_jobs: true + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210513155447_add_temporary_package_index_for_nuget_data_migration.rb b/db/post_migrate/20210513155447_add_temporary_package_index_for_nuget_data_migration.rb new file mode 100644 index 00000000000..b43abab2a96 --- /dev/null +++ b/db/post_migrate/20210513155447_add_temporary_package_index_for_nuget_data_migration.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTemporaryPackageIndexForNugetDataMigration < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'tmp_index_packages_on_id_where_nuget_default_temp_package' + INDEX_CONDITION = "package_type = 4 AND name = 'NuGet.Temporary.Package' AND status = 0" + + disable_ddl_transaction! + + def up + # this index is used in 20210513155546_backfill_nuget_temporary_packages_to_processing_status + add_concurrent_index :packages_packages, :id, where: INDEX_CONDITION, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :packages_packages, INDEX_NAME + end +end diff --git a/db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb b/db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb new file mode 100644 index 00000000000..8124f94b519 --- /dev/null +++ b/db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class BackfillNugetTemporaryPackagesToProcessingStatus < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + class Package < ActiveRecord::Base + include EachBatch + + self.table_name = 'packages_packages' + + scope :nuget_temporary_packages, -> do + # 4 is nuget package type, 0 is default status + where(package_type: 4, name: 'NuGet.Temporary.Package', status: 0) + end + end + + def up + Package.nuget_temporary_packages.each_batch(of: 100) do |batch| + # 2 is processing status + batch.update_all(status: 2) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20210513155635_remove_temporary_package_index_for_nuget_data_migration.rb b/db/post_migrate/20210513155635_remove_temporary_package_index_for_nuget_data_migration.rb new file mode 100644 index 00000000000..eb0abba5112 --- /dev/null +++ b/db/post_migrate/20210513155635_remove_temporary_package_index_for_nuget_data_migration.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveTemporaryPackageIndexForNugetDataMigration < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'tmp_index_packages_on_id_where_nuget_default_temp_package' + INDEX_CONDITION = "package_type = 4 AND name = 'NuGet.Temporary.Package' AND status = 0" + + disable_ddl_transaction! + + def up + # this index was used in 20210513155546_backfill_nuget_temporary_packages_to_processing_status + remove_concurrent_index_by_name :packages_packages, INDEX_NAME + end + + def down + add_concurrent_index :packages_packages, :id, where: INDEX_CONDITION, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20210517075444_remove_temporary_index_for_project_topics_to_taggings.rb b/db/post_migrate/20210517075444_remove_temporary_index_for_project_topics_to_taggings.rb new file mode 100644 index 00000000000..bfd09653695 --- /dev/null +++ b/db/post_migrate/20210517075444_remove_temporary_index_for_project_topics_to_taggings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RemoveTemporaryIndexForProjectTopicsToTaggings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INDEX_NAME = 'tmp_index_taggings_on_id_where_taggable_type_project_and_tags' + INDEX_CONDITION = "taggable_type = 'Project' AND context = 'tags'" + + disable_ddl_transaction! + + def up + # this index was used in 20210511095658_schedule_migrate_project_taggings_context_from_tags_to_topics + remove_concurrent_index_by_name :taggings, INDEX_NAME + end + + def down + add_concurrent_index :taggings, :id, where: INDEX_CONDITION, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20210518001450_backfill_clusters_integration_elastic_stack_enabled.rb b/db/post_migrate/20210518001450_backfill_clusters_integration_elastic_stack_enabled.rb new file mode 100644 index 00000000000..6d21945af00 --- /dev/null +++ b/db/post_migrate/20210518001450_backfill_clusters_integration_elastic_stack_enabled.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class BackfillClustersIntegrationElasticStackEnabled < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + ApplicationRecord.connection.execute(<<~SQL.squish) + INSERT INTO clusters_integration_elasticstack( + cluster_id, + enabled, + chart_version, + created_at, + updated_at + ) + SELECT + cluster_id, + true, + version, + TIMEZONE('UTC', NOW()), + TIMEZONE('UTC', NOW()) + FROM clusters_applications_elastic_stacks + WHERE status IN (3, 11) + ON CONFLICT(cluster_id) DO UPDATE SET + enabled = true, + updated_at = TIMEZONE('UTC', NOW()) + SQL + end + + def down + # Irreversible + end +end diff --git a/db/schema_migrations/20210215172449 b/db/schema_migrations/20210215172449 new file mode 100644 index 00000000000..5b310d80d6a --- /dev/null +++ b/db/schema_migrations/20210215172449 @@ -0,0 +1 @@ +f72f0a31bca545d2528030019695b03e0858d7ae9a0fb32d407c25580731fa6b
\ No newline at end of file diff --git a/db/schema_migrations/20210303121224 b/db/schema_migrations/20210303121224 new file mode 100644 index 00000000000..0c0ba7c882c --- /dev/null +++ b/db/schema_migrations/20210303121224 @@ -0,0 +1 @@ +cef2421a6885cb8b28d34388af6c79c4be1564dfd5fae2efcb35622d511eb8c0
\ No newline at end of file diff --git a/db/schema_migrations/20210316171009 b/db/schema_migrations/20210316171009 new file mode 100644 index 00000000000..baf2152bb17 --- /dev/null +++ b/db/schema_migrations/20210316171009 @@ -0,0 +1 @@ +b17c853b2bc82cfa83cd82b8023eca39d875d898b99e78c81d767a73391a0b75
\ No newline at end of file diff --git a/db/schema_migrations/20210317123054 b/db/schema_migrations/20210317123054 new file mode 100644 index 00000000000..1a18d409ac7 --- /dev/null +++ b/db/schema_migrations/20210317123054 @@ -0,0 +1 @@ +28b1e8add8ac7249be55ccd25e60c8a181d2ff036a7d69ac861bcdb5bf5e84e1
\ No newline at end of file diff --git a/db/schema_migrations/20210319071214 b/db/schema_migrations/20210319071214 new file mode 100644 index 00000000000..ee3a7613d63 --- /dev/null +++ b/db/schema_migrations/20210319071214 @@ -0,0 +1 @@ +3f9e229fc13075c2a2d42931b163c8069089458d66bc565609b393e07460f25d
\ No newline at end of file diff --git a/db/schema_migrations/20210323125809 b/db/schema_migrations/20210323125809 new file mode 100644 index 00000000000..353bf743ebf --- /dev/null +++ b/db/schema_migrations/20210323125809 @@ -0,0 +1 @@ +f8c4a3da0931ee04654050e3b172814e7ea1238bac501794e39d0d68592da8fa
\ No newline at end of file diff --git a/db/schema_migrations/20210323130831 b/db/schema_migrations/20210323130831 new file mode 100644 index 00000000000..b296b8a5bd1 --- /dev/null +++ b/db/schema_migrations/20210323130831 @@ -0,0 +1 @@ +ca53c3d2bf58aeb803f942ce122a84d7ce587fcceb06c5800c44fd5aac1fd6ac
\ No newline at end of file diff --git a/db/schema_migrations/20210323131543 b/db/schema_migrations/20210323131543 new file mode 100644 index 00000000000..1edba1a0f3d --- /dev/null +++ b/db/schema_migrations/20210323131543 @@ -0,0 +1 @@ +a4cac229cdd249feef18a39e845158952bef2f67fa2784713db47ab9a06495bd
\ No newline at end of file diff --git a/db/schema_migrations/20210403022952 b/db/schema_migrations/20210403022952 new file mode 100644 index 00000000000..581bc5f89c2 --- /dev/null +++ b/db/schema_migrations/20210403022952 @@ -0,0 +1 @@ +c62c2e13bdad42cc1f112f9854fe8d25e1e2aa082cb28341a661c93b8587f1f8
\ No newline at end of file diff --git a/db/schema_migrations/20210407111027 b/db/schema_migrations/20210407111027 new file mode 100644 index 00000000000..573100cba8a --- /dev/null +++ b/db/schema_migrations/20210407111027 @@ -0,0 +1 @@ +0ae4e5224aeb0c0a78f3730b7c83505946d3aa40680b64fa2f89370ccefdfd45
\ No newline at end of file diff --git a/db/schema_migrations/20210407140539 b/db/schema_migrations/20210407140539 new file mode 100644 index 00000000000..3d861cfee82 --- /dev/null +++ b/db/schema_migrations/20210407140539 @@ -0,0 +1 @@ +9f19b44a4ef3131e6ddd9cfea0d8b1eb4499754f2200bea90b5ed41eb688f622
\ No newline at end of file diff --git a/db/schema_migrations/20210412111213 b/db/schema_migrations/20210412111213 new file mode 100644 index 00000000000..0d271af38c2 --- /dev/null +++ b/db/schema_migrations/20210412111213 @@ -0,0 +1 @@ +c75ab8ef4d6a4ff20109e1c5d054521bd8cd79680f96f4d9e55331d69bac73d6
\ No newline at end of file diff --git a/db/schema_migrations/20210412172030 b/db/schema_migrations/20210412172030 new file mode 100644 index 00000000000..50b9d2be5d5 --- /dev/null +++ b/db/schema_migrations/20210412172030 @@ -0,0 +1 @@ +063cfa0d8a4b9d3947aaf55f0587f6a2a9521866b6e10fc307c5cc82ca3a0623
\ No newline at end of file diff --git a/db/schema_migrations/20210413155324 b/db/schema_migrations/20210413155324 new file mode 100644 index 00000000000..ab7e4256fdb --- /dev/null +++ b/db/schema_migrations/20210413155324 @@ -0,0 +1 @@ +7bb8be1616a61b12392bc5ff4d716123bc605d9753744c04a23f9258bab25af6
\ No newline at end of file diff --git a/db/schema_migrations/20210414045322 b/db/schema_migrations/20210414045322 new file mode 100644 index 00000000000..f95da121569 --- /dev/null +++ b/db/schema_migrations/20210414045322 @@ -0,0 +1 @@ +197930adaf08e3d22d54309d1cc0605bc4d6843409a38f8e0cc9ce9842ec1816
\ No newline at end of file diff --git a/db/schema_migrations/20210414100914 b/db/schema_migrations/20210414100914 new file mode 100644 index 00000000000..dcbc93d9987 --- /dev/null +++ b/db/schema_migrations/20210414100914 @@ -0,0 +1 @@ +4950567ba7071183bc008936e4bbe1391dd0100c5caa2a6821be85dc3d2423fc
\ No newline at end of file diff --git a/db/schema_migrations/20210414130017 b/db/schema_migrations/20210414130017 new file mode 100644 index 00000000000..0eaffe4ddd1 --- /dev/null +++ b/db/schema_migrations/20210414130017 @@ -0,0 +1 @@ +202409998a03fd29c52e3ee9546ab8ec7aa3c56173ee755e9342f1cc6a5f1f6b
\ No newline at end of file diff --git a/db/schema_migrations/20210414130526 b/db/schema_migrations/20210414130526 new file mode 100644 index 00000000000..ebba5c47f22 --- /dev/null +++ b/db/schema_migrations/20210414130526 @@ -0,0 +1 @@ +2343decc3abb79b38bcde6aba5a8fd208842096d7fb7a4c51872f66f1a125296
\ No newline at end of file diff --git a/db/schema_migrations/20210414131807 b/db/schema_migrations/20210414131807 new file mode 100644 index 00000000000..9a7800b86f8 --- /dev/null +++ b/db/schema_migrations/20210414131807 @@ -0,0 +1 @@ +4db08c0fecd210b329492596cf029518484d256bdb06efff233b3a38677fd6a6
\ No newline at end of file diff --git a/db/schema_migrations/20210414133310 b/db/schema_migrations/20210414133310 new file mode 100644 index 00000000000..9a0a224e09b --- /dev/null +++ b/db/schema_migrations/20210414133310 @@ -0,0 +1 @@ +f306cf9553e4bd237cfdff31d5432d4ff44302a923e475c477f76d32ccb4d257
\ No newline at end of file diff --git a/db/schema_migrations/20210415100159 b/db/schema_migrations/20210415100159 new file mode 100644 index 00000000000..3ee36c7de17 --- /dev/null +++ b/db/schema_migrations/20210415100159 @@ -0,0 +1 @@ +dd6474593b6f4dd82f7f4776f558a82fa34307c45e20f13f77807f7dc96db368
\ No newline at end of file diff --git a/db/schema_migrations/20210415101228 b/db/schema_migrations/20210415101228 new file mode 100644 index 00000000000..8edbeee69dc --- /dev/null +++ b/db/schema_migrations/20210415101228 @@ -0,0 +1 @@ +2ba1f8832a6ba4300796ff9f74dfa2d0ff7a648a9231db369274ad002d0e4ec8
\ No newline at end of file diff --git a/db/schema_migrations/20210415155043 b/db/schema_migrations/20210415155043 new file mode 100644 index 00000000000..490e4ba5557 --- /dev/null +++ b/db/schema_migrations/20210415155043 @@ -0,0 +1 @@ +af66cb13eca39cc6b9970e6764d08b5b353f212d844267afb5583e888c7d2c94
\ No newline at end of file diff --git a/db/schema_migrations/20210415172516 b/db/schema_migrations/20210415172516 new file mode 100644 index 00000000000..ad129261acf --- /dev/null +++ b/db/schema_migrations/20210415172516 @@ -0,0 +1 @@ +06d33e4eb99e46cb6caf71916e5c93c4b7eb9fe73152841c7c41d5e157ec339e
\ No newline at end of file diff --git a/db/schema_migrations/20210416172516 b/db/schema_migrations/20210416172516 new file mode 100644 index 00000000000..2ab991bb99c --- /dev/null +++ b/db/schema_migrations/20210416172516 @@ -0,0 +1 @@ +26f3978600808eae8396e0d5292bae95feca52ff3e44a019c04bd9708f27cc84
\ No newline at end of file diff --git a/db/schema_migrations/20210419090412 b/db/schema_migrations/20210419090412 new file mode 100644 index 00000000000..de75d4e5cfc --- /dev/null +++ b/db/schema_migrations/20210419090412 @@ -0,0 +1 @@ +da9c3d764a5750a40e0f6edd2e713efd77620ba3e684e48d47c7f855e47b2984
\ No newline at end of file diff --git a/db/schema_migrations/20210419090542 b/db/schema_migrations/20210419090542 new file mode 100644 index 00000000000..a6b265e4d17 --- /dev/null +++ b/db/schema_migrations/20210419090542 @@ -0,0 +1 @@ +7a7b0eaa67851aa9300e4750fd05c6d2d0b49ca7077099a0208a89c74ac03a2c
\ No newline at end of file diff --git a/db/schema_migrations/20210419203017 b/db/schema_migrations/20210419203017 new file mode 100644 index 00000000000..8421fd7c6d9 --- /dev/null +++ b/db/schema_migrations/20210419203017 @@ -0,0 +1 @@ +1ca5f960c233be5d5a30632b8aaad9598c259154eee817f4d76e8f1bb3e95edb
\ No newline at end of file diff --git a/db/schema_migrations/20210419203018 b/db/schema_migrations/20210419203018 new file mode 100644 index 00000000000..f28ebe78fc6 --- /dev/null +++ b/db/schema_migrations/20210419203018 @@ -0,0 +1 @@ +94404ed645a9c8a0ee462baff98cf2d0e50aecdb71bb1515fd3a82bf1a39dfda
\ No newline at end of file diff --git a/db/schema_migrations/20210419224834 b/db/schema_migrations/20210419224834 new file mode 100644 index 00000000000..61926cfb1df --- /dev/null +++ b/db/schema_migrations/20210419224834 @@ -0,0 +1 @@ +145782c0cb0d24617e0e43c43f49a0f1d4033df3f303e4d4085e586c48e2408e
\ No newline at end of file diff --git a/db/schema_migrations/20210420012444 b/db/schema_migrations/20210420012444 new file mode 100644 index 00000000000..5c098f44bc8 --- /dev/null +++ b/db/schema_migrations/20210420012444 @@ -0,0 +1 @@ +f0bf8c79c1981ecd95c933f37ec5b0187ee6321792d96db26d863b192843c5ab
\ No newline at end of file diff --git a/db/schema_migrations/20210420012909 b/db/schema_migrations/20210420012909 new file mode 100644 index 00000000000..e4e00349df7 --- /dev/null +++ b/db/schema_migrations/20210420012909 @@ -0,0 +1 @@ +c9e8c49bf272ef49d906431bdc11a24abe967a9d7e95976d70c48b21b48a062b
\ No newline at end of file diff --git a/db/schema_migrations/20210420103955 b/db/schema_migrations/20210420103955 new file mode 100644 index 00000000000..001c89e1d10 --- /dev/null +++ b/db/schema_migrations/20210420103955 @@ -0,0 +1 @@ +1ee3df66a0e7d1802196740cc1c0a899724c1f5b3dd8be4316915b354446f238
\ No newline at end of file diff --git a/db/schema_migrations/20210420120734 b/db/schema_migrations/20210420120734 new file mode 100644 index 00000000000..124fb5b28fe --- /dev/null +++ b/db/schema_migrations/20210420120734 @@ -0,0 +1 @@ +5404ecd22f943671c076b0e870a487ec822cb3d594c223ad4db5b1584394ceb6
\ No newline at end of file diff --git a/db/schema_migrations/20210420121149 b/db/schema_migrations/20210420121149 new file mode 100644 index 00000000000..1326ed9a6f6 --- /dev/null +++ b/db/schema_migrations/20210420121149 @@ -0,0 +1 @@ +58cd21a02a395564acf9abcc39c3daafc5db90aa0b3f29133644f21bb669cdf6
\ No newline at end of file diff --git a/db/schema_migrations/20210420173030 b/db/schema_migrations/20210420173030 new file mode 100644 index 00000000000..e7e3caf8365 --- /dev/null +++ b/db/schema_migrations/20210420173030 @@ -0,0 +1 @@ +3a223c462b10edb9eb68fc0adf42f046a45f554f35b4b4ee64a834cd7372f827
\ No newline at end of file diff --git a/db/schema_migrations/20210420210642 b/db/schema_migrations/20210420210642 new file mode 100644 index 00000000000..dd5d165df5e --- /dev/null +++ b/db/schema_migrations/20210420210642 @@ -0,0 +1 @@ +b7f75e3b443bfcb1aea812ad1682a31a99021f41ef4d47bdf600437db6f4f2f3
\ No newline at end of file diff --git a/db/schema_migrations/20210420221106 b/db/schema_migrations/20210420221106 new file mode 100644 index 00000000000..cfe3e6e5406 --- /dev/null +++ b/db/schema_migrations/20210420221106 @@ -0,0 +1 @@ +62842b9e9753b7880e980b0a16335e7d00bdce8b7b42d94b1ba26828724c01dd
\ No newline at end of file diff --git a/db/schema_migrations/20210421021510 b/db/schema_migrations/20210421021510 new file mode 100644 index 00000000000..775f083ac63 --- /dev/null +++ b/db/schema_migrations/20210421021510 @@ -0,0 +1 @@ +6a278c90b8c97fc2255528605ee6bf4547e37ac8c4c17979483ed9db562fa021
\ No newline at end of file diff --git a/db/schema_migrations/20210421022010 b/db/schema_migrations/20210421022010 new file mode 100644 index 00000000000..75abced628d --- /dev/null +++ b/db/schema_migrations/20210421022010 @@ -0,0 +1 @@ +454992d01fa140896ff2a9cea66fb855c9e659a5a7969ac9a3cb5a608de36161
\ No newline at end of file diff --git a/db/schema_migrations/20210421081724 b/db/schema_migrations/20210421081724 new file mode 100644 index 00000000000..a246cfdd428 --- /dev/null +++ b/db/schema_migrations/20210421081724 @@ -0,0 +1 @@ +9049dc22e97261115ba935a059beb5b4f2eb810f1fdcc0881f96d4b6a501ab09
\ No newline at end of file diff --git a/db/schema_migrations/20210421190157 b/db/schema_migrations/20210421190157 new file mode 100644 index 00000000000..a33c8336763 --- /dev/null +++ b/db/schema_migrations/20210421190157 @@ -0,0 +1 @@ +943e415d3cc1090286aece96c013e54e4c07a7c16d8a7be82b560b1a3e36d513
\ No newline at end of file diff --git a/db/schema_migrations/20210422022825 b/db/schema_migrations/20210422022825 new file mode 100644 index 00000000000..4f1313658ac --- /dev/null +++ b/db/schema_migrations/20210422022825 @@ -0,0 +1 @@ +d0119a45e6ab08afa6ed73a248b81cae4a4de63d46fda25968444256355d208f
\ No newline at end of file diff --git a/db/schema_migrations/20210422023046 b/db/schema_migrations/20210422023046 new file mode 100644 index 00000000000..520db7527d3 --- /dev/null +++ b/db/schema_migrations/20210422023046 @@ -0,0 +1 @@ +e588b2e6c612e4a25615d9c5179100af20d3507e0eec8feba52bc6b45d9befea
\ No newline at end of file diff --git a/db/schema_migrations/20210422142647 b/db/schema_migrations/20210422142647 new file mode 100644 index 00000000000..f5a8b6cc29f --- /dev/null +++ b/db/schema_migrations/20210422142647 @@ -0,0 +1 @@ +eaefc2a0f08ce312b1ae3fb100e4a818eb3013b95c38d940371a25b605b09ca1
\ No newline at end of file diff --git a/db/schema_migrations/20210422181809 b/db/schema_migrations/20210422181809 new file mode 100644 index 00000000000..547e44f87b3 --- /dev/null +++ b/db/schema_migrations/20210422181809 @@ -0,0 +1 @@ +870589d3a4b4bc139ac29b0d87b0f9e777de21e854e5692c0dedd6683c83649a
\ No newline at end of file diff --git a/db/schema_migrations/20210422195929 b/db/schema_migrations/20210422195929 new file mode 100644 index 00000000000..1078f45678d --- /dev/null +++ b/db/schema_migrations/20210422195929 @@ -0,0 +1 @@ +d72c4cbd4d34fcfb3aae5aa11c583509b41499aa8bd107957934ab57d1756544
\ No newline at end of file diff --git a/db/schema_migrations/20210423054022 b/db/schema_migrations/20210423054022 new file mode 100644 index 00000000000..4717a9e99b7 --- /dev/null +++ b/db/schema_migrations/20210423054022 @@ -0,0 +1 @@ +84f7b631c9017b286665beca42fb30e064c852d5a21c2f82a8bee6f0d5e62c25
\ No newline at end of file diff --git a/db/schema_migrations/20210423054537 b/db/schema_migrations/20210423054537 new file mode 100644 index 00000000000..a530190a32e --- /dev/null +++ b/db/schema_migrations/20210423054537 @@ -0,0 +1 @@ +0ea5c328f9d15d73744f8847c4b1071e2a360cd52ce0da1216ca6acc768050e5
\ No newline at end of file diff --git a/db/schema_migrations/20210423054846 b/db/schema_migrations/20210423054846 new file mode 100644 index 00000000000..08669e2427b --- /dev/null +++ b/db/schema_migrations/20210423054846 @@ -0,0 +1 @@ +013106237f73a94606f962f54c740af23deac637c8e075471ba03ef5d6c1b953
\ No newline at end of file diff --git a/db/schema_migrations/20210423124223 b/db/schema_migrations/20210423124223 new file mode 100644 index 00000000000..d5b07602553 --- /dev/null +++ b/db/schema_migrations/20210423124223 @@ -0,0 +1 @@ +6b508f1a48402aa2db3862e2e31ee4ccb851f535ed59f9b949ac1bad0ff2f0e1
\ No newline at end of file diff --git a/db/schema_migrations/20210423155059 b/db/schema_migrations/20210423155059 new file mode 100644 index 00000000000..2ac51dcdd2b --- /dev/null +++ b/db/schema_migrations/20210423155059 @@ -0,0 +1 @@ +c582b7dda33492e122725001200aeb470cbf4458f247728a3b2102e325c97193
\ No newline at end of file diff --git a/db/schema_migrations/20210423160427 b/db/schema_migrations/20210423160427 new file mode 100644 index 00000000000..ecae878d8a2 --- /dev/null +++ b/db/schema_migrations/20210423160427 @@ -0,0 +1 @@ +e8f88972826a030894f38b8959418096771bf4e88a3b90f0026aaae3977d1db1
\ No newline at end of file diff --git a/db/schema_migrations/20210423164702 b/db/schema_migrations/20210423164702 new file mode 100644 index 00000000000..3f800be3749 --- /dev/null +++ b/db/schema_migrations/20210423164702 @@ -0,0 +1 @@ +b5e34f7827edcdf81c66250353cddc3481e39c693f983df610b8ed20c58cb65b
\ No newline at end of file diff --git a/db/schema_migrations/20210423171304 b/db/schema_migrations/20210423171304 new file mode 100644 index 00000000000..56db70a407c --- /dev/null +++ b/db/schema_migrations/20210423171304 @@ -0,0 +1 @@ +06ead319cbc56b25769ed06b6a246d705b467d34a5d09ab9282e2d83c55511ba
\ No newline at end of file diff --git a/db/schema_migrations/20210424115725 b/db/schema_migrations/20210424115725 new file mode 100644 index 00000000000..e1b7faf5276 --- /dev/null +++ b/db/schema_migrations/20210424115725 @@ -0,0 +1 @@ +66c4c48c53131a156c0bf45982691e9017373aefae1f7b6d7053467481b3f5cf
\ No newline at end of file diff --git a/db/schema_migrations/20210424163400 b/db/schema_migrations/20210424163400 new file mode 100644 index 00000000000..ebc4b319aca --- /dev/null +++ b/db/schema_migrations/20210424163400 @@ -0,0 +1 @@ +808e4c1b0bb4f44afea57cce84820ef1371ae852d7cbc79ef454c04219ea956d
\ No newline at end of file diff --git a/db/schema_migrations/20210426094524 b/db/schema_migrations/20210426094524 new file mode 100644 index 00000000000..832f2728534 --- /dev/null +++ b/db/schema_migrations/20210426094524 @@ -0,0 +1 @@ +46de2e905a591c14ce18acf041bac6fb48ec19ad9f40fababcbf27ae02f7fa75
\ No newline at end of file diff --git a/db/schema_migrations/20210426094549 b/db/schema_migrations/20210426094549 new file mode 100644 index 00000000000..8e3c5347a50 --- /dev/null +++ b/db/schema_migrations/20210426094549 @@ -0,0 +1 @@ +12ad8f05a4d864d9986d6ca400a687c40b2de1acb461b134a8103f9a882921e7
\ No newline at end of file diff --git a/db/schema_migrations/20210427045604 b/db/schema_migrations/20210427045604 new file mode 100644 index 00000000000..6cb29994a87 --- /dev/null +++ b/db/schema_migrations/20210427045604 @@ -0,0 +1 @@ +bdeb78403607d45d5eb779623d0e2aa1acf026f6aced6f1134824a35dfec7e74
\ No newline at end of file diff --git a/db/schema_migrations/20210427045711 b/db/schema_migrations/20210427045711 new file mode 100644 index 00000000000..bb713fc08d0 --- /dev/null +++ b/db/schema_migrations/20210427045711 @@ -0,0 +1 @@ +3cd56794ac903d9598863215a34eda62c3dc96bed78bed5b8a99fc522e319b35
\ No newline at end of file diff --git a/db/schema_migrations/20210427062807 b/db/schema_migrations/20210427062807 new file mode 100644 index 00000000000..c9d82dfa931 --- /dev/null +++ b/db/schema_migrations/20210427062807 @@ -0,0 +1 @@ +306bb2bc3bfd20a57f1ac473e32596e7b7e7b6c2ae41c3fe5a7f45c551ce9207
\ No newline at end of file diff --git a/db/schema_migrations/20210427084924 b/db/schema_migrations/20210427084924 new file mode 100644 index 00000000000..feaeeefa80b --- /dev/null +++ b/db/schema_migrations/20210427084924 @@ -0,0 +1 @@ +a2fcf3576de4ee5afdab8d07ffc6c2c8f96d6cc85c332f6ab69f2936bf9e58ae
\ No newline at end of file diff --git a/db/schema_migrations/20210427085020 b/db/schema_migrations/20210427085020 new file mode 100644 index 00000000000..7f45de093b4 --- /dev/null +++ b/db/schema_migrations/20210427085020 @@ -0,0 +1 @@ +2e30910d106dd6805f42ffc226d9008b826fa88eaec7091960e11db850b714c4
\ No newline at end of file diff --git a/db/schema_migrations/20210427094931 b/db/schema_migrations/20210427094931 new file mode 100644 index 00000000000..830c92e9878 --- /dev/null +++ b/db/schema_migrations/20210427094931 @@ -0,0 +1 @@ +aa0ae491a7f94d99ea0c42250434245a4f23b0084657b709b0aaad0317dfd6b1
\ No newline at end of file diff --git a/db/schema_migrations/20210427125400 b/db/schema_migrations/20210427125400 new file mode 100644 index 00000000000..285f1efb026 --- /dev/null +++ b/db/schema_migrations/20210427125400 @@ -0,0 +1 @@ +7632c2442c5cb9194c177df9b9106efdb433d43b34250fc434c1e1ff2f8ed8f0
\ No newline at end of file diff --git a/db/schema_migrations/20210427194958 b/db/schema_migrations/20210427194958 new file mode 100644 index 00000000000..a707b804ba9 --- /dev/null +++ b/db/schema_migrations/20210427194958 @@ -0,0 +1 @@ +0a7bf3fe10a5eca94392a599d0736c881065a0b2c33bb383c0b91eb5ac453db9
\ No newline at end of file diff --git a/db/schema_migrations/20210427200840 b/db/schema_migrations/20210427200840 new file mode 100644 index 00000000000..3e84d260952 --- /dev/null +++ b/db/schema_migrations/20210427200840 @@ -0,0 +1 @@ +7e90e64df39205c79a67acc311cd58dd9b55d2b3919d58749e3253854f99a44a
\ No newline at end of file diff --git a/db/schema_migrations/20210427212034 b/db/schema_migrations/20210427212034 new file mode 100644 index 00000000000..4954b5722a9 --- /dev/null +++ b/db/schema_migrations/20210427212034 @@ -0,0 +1 @@ +2ffe65c4abcb8f638198943e1b74de710387438fb7c93addb05ccb3e86729934
\ No newline at end of file diff --git a/db/schema_migrations/20210428151144 b/db/schema_migrations/20210428151144 new file mode 100644 index 00000000000..53771dd9401 --- /dev/null +++ b/db/schema_migrations/20210428151144 @@ -0,0 +1 @@ +468373a97f7bd66197c81f01bebd27256cf96ec8fc226c5d73e579a7ecc3930d
\ No newline at end of file diff --git a/db/schema_migrations/20210428151238 b/db/schema_migrations/20210428151238 new file mode 100644 index 00000000000..3fa6ecefc42 --- /dev/null +++ b/db/schema_migrations/20210428151238 @@ -0,0 +1 @@ +3244023441c2afa450ad76345a494975b4a7154892298daf1ec4223d27fb7ca3
\ No newline at end of file diff --git a/db/schema_migrations/20210429024843 b/db/schema_migrations/20210429024843 new file mode 100644 index 00000000000..2016dde93b6 --- /dev/null +++ b/db/schema_migrations/20210429024843 @@ -0,0 +1 @@ +5307ed6d22ba2575db0734eb8949b6987e58be27a845921b4943123adc2b9f41
\ No newline at end of file diff --git a/db/schema_migrations/20210429032320 b/db/schema_migrations/20210429032320 new file mode 100644 index 00000000000..a026fb1a3c5 --- /dev/null +++ b/db/schema_migrations/20210429032320 @@ -0,0 +1 @@ +f1a5f9a394c02544be99316d8e64464adeb4f9849875200e7e8be6fe826e5e62
\ No newline at end of file diff --git a/db/schema_migrations/20210429131525 b/db/schema_migrations/20210429131525 new file mode 100644 index 00000000000..4ab6b84eea9 --- /dev/null +++ b/db/schema_migrations/20210429131525 @@ -0,0 +1 @@ +68ac54fa7b4e4ef99e58c31d8f960b6f986fd679c11ead235704c7a75b4617ac
\ No newline at end of file diff --git a/db/schema_migrations/20210429143649 b/db/schema_migrations/20210429143649 new file mode 100644 index 00000000000..6e7469ef4de --- /dev/null +++ b/db/schema_migrations/20210429143649 @@ -0,0 +1 @@ +949e1323d1fadd8db3b8b337f3071ab7b7a7c45b11dc40924fb64c074596a327
\ No newline at end of file diff --git a/db/schema_migrations/20210429181325 b/db/schema_migrations/20210429181325 new file mode 100644 index 00000000000..d778566a580 --- /dev/null +++ b/db/schema_migrations/20210429181325 @@ -0,0 +1 @@ +9674f04640f897928925ff1e23ff6d3ff918627b7c2374713a31071678956614
\ No newline at end of file diff --git a/db/schema_migrations/20210429192653 b/db/schema_migrations/20210429192653 new file mode 100644 index 00000000000..5e380380d72 --- /dev/null +++ b/db/schema_migrations/20210429192653 @@ -0,0 +1 @@ +c2b5ad6786e1c71ccff391b03fcd0635dfd42d69484443291a692cef9f3ffda5
\ No newline at end of file diff --git a/db/schema_migrations/20210429193106 b/db/schema_migrations/20210429193106 new file mode 100644 index 00000000000..49f1838a585 --- /dev/null +++ b/db/schema_migrations/20210429193106 @@ -0,0 +1 @@ +e0898e4e439cde4e3b84808e7505490fe956cf17922f5c779b3384997d36cafd
\ No newline at end of file diff --git a/db/schema_migrations/20210430034712 b/db/schema_migrations/20210430034712 new file mode 100644 index 00000000000..df9fe0755cf --- /dev/null +++ b/db/schema_migrations/20210430034712 @@ -0,0 +1 @@ +6b7436d7712e31ca116204d37270435ccc059ca75a128750e5c39fdddfa020e3
\ No newline at end of file diff --git a/db/schema_migrations/20210430100947 b/db/schema_migrations/20210430100947 new file mode 100644 index 00000000000..409d807ff2a --- /dev/null +++ b/db/schema_migrations/20210430100947 @@ -0,0 +1 @@ +c8875e02134542370cc5a792bdaefc77b66f58a33a46720f5ef562c33c5b8f41
\ No newline at end of file diff --git a/db/schema_migrations/20210430122951 b/db/schema_migrations/20210430122951 new file mode 100644 index 00000000000..43c90a10f22 --- /dev/null +++ b/db/schema_migrations/20210430122951 @@ -0,0 +1 @@ +476dc70eae87ad3ee30e6be8c1afb4a2aec23a09b96daba2afbd9c4e2edb12b9
\ No newline at end of file diff --git a/db/schema_migrations/20210430124212 b/db/schema_migrations/20210430124212 new file mode 100644 index 00000000000..dd3e8c1f371 --- /dev/null +++ b/db/schema_migrations/20210430124212 @@ -0,0 +1 @@ +ebdeb56647f3a7ff5620141833c90b796a9ddfed39234bcf8063ca5b3df6c1f3
\ No newline at end of file diff --git a/db/schema_migrations/20210430124630 b/db/schema_migrations/20210430124630 new file mode 100644 index 00000000000..2366ab58ef4 --- /dev/null +++ b/db/schema_migrations/20210430124630 @@ -0,0 +1 @@ +7f6862205e8c315da8433083fc5391f8889951f62d466e0048063322a46f9cc7
\ No newline at end of file diff --git a/db/schema_migrations/20210430130259 b/db/schema_migrations/20210430130259 new file mode 100644 index 00000000000..b8064b30f52 --- /dev/null +++ b/db/schema_migrations/20210430130259 @@ -0,0 +1 @@ +c4a4b214f15a1a8d7f6832782d50077189281ca9a9b1b746a0a3bc3af4a47e3c
\ No newline at end of file diff --git a/db/schema_migrations/20210430134202 b/db/schema_migrations/20210430134202 new file mode 100644 index 00000000000..cb9eee98cc0 --- /dev/null +++ b/db/schema_migrations/20210430134202 @@ -0,0 +1 @@ +77e2b8c1c6054a80122f97dda1e843149fefb7bf6694fdfa897d691d61162d81
\ No newline at end of file diff --git a/db/schema_migrations/20210430135954 b/db/schema_migrations/20210430135954 new file mode 100644 index 00000000000..9e201905704 --- /dev/null +++ b/db/schema_migrations/20210430135954 @@ -0,0 +1 @@ +c5fe6f74822168599ad5069bb7c793ec96a4bba99d15ad29cb161ef24291b56d
\ No newline at end of file diff --git a/db/schema_migrations/20210430154631 b/db/schema_migrations/20210430154631 new file mode 100644 index 00000000000..6369c657d5a --- /dev/null +++ b/db/schema_migrations/20210430154631 @@ -0,0 +1 @@ +08f4cd1f8f7ddc336d0edee7581b0cb59e0cdc7b5f3cbeb1ccdcd7a1c52d366f
\ No newline at end of file diff --git a/db/schema_migrations/20210503105022 b/db/schema_migrations/20210503105022 new file mode 100644 index 00000000000..ada5b2db7da --- /dev/null +++ b/db/schema_migrations/20210503105022 @@ -0,0 +1 @@ +de8bf6c02589bf308914d43e5cd44dae91d3bbabcdaafcebdb96fba0a09b20bc
\ No newline at end of file diff --git a/db/schema_migrations/20210503105845 b/db/schema_migrations/20210503105845 new file mode 100644 index 00000000000..ff2c910491b --- /dev/null +++ b/db/schema_migrations/20210503105845 @@ -0,0 +1 @@ +2fdcb66e511d8322ea8fc4de66ecce859f8e91b2a9da22336281a1e784d9b4a5
\ No newline at end of file diff --git a/db/schema_migrations/20210503131747 b/db/schema_migrations/20210503131747 new file mode 100644 index 00000000000..52771dcb5de --- /dev/null +++ b/db/schema_migrations/20210503131747 @@ -0,0 +1 @@ +583c350d82c4d02e910f2c16ed2ec55ccdc880c87b55bf7bd6be3e1839958732
\ No newline at end of file diff --git a/db/schema_migrations/20210504085144 b/db/schema_migrations/20210504085144 new file mode 100644 index 00000000000..67abcd8eece --- /dev/null +++ b/db/schema_migrations/20210504085144 @@ -0,0 +1 @@ +3cdf8e93c4b80867a5d8e086f3f44eaeb479e875abf16187b94b3f6238faf062
\ No newline at end of file diff --git a/db/schema_migrations/20210504135823 b/db/schema_migrations/20210504135823 new file mode 100644 index 00000000000..24c5fd50087 --- /dev/null +++ b/db/schema_migrations/20210504135823 @@ -0,0 +1 @@ +9d1254393da80e0b1e387fba493f83f8775f0340f23c648e638a9983f965f5c9
\ No newline at end of file diff --git a/db/schema_migrations/20210504153354 b/db/schema_migrations/20210504153354 new file mode 100644 index 00000000000..a1f9b1d6d37 --- /dev/null +++ b/db/schema_migrations/20210504153354 @@ -0,0 +1 @@ +c4593c1638f937618ecf3ae94a409e550dce93cc190989f581fb0007e591696d
\ No newline at end of file diff --git a/db/schema_migrations/20210504164429 b/db/schema_migrations/20210504164429 new file mode 100644 index 00000000000..2ad8695856f --- /dev/null +++ b/db/schema_migrations/20210504164429 @@ -0,0 +1 @@ +767cea885e6544b6958082397812357d7223b193d4b73bf09c8486dc2ec645d0
\ No newline at end of file diff --git a/db/schema_migrations/20210505092746 b/db/schema_migrations/20210505092746 new file mode 100644 index 00000000000..b23d8ee3538 --- /dev/null +++ b/db/schema_migrations/20210505092746 @@ -0,0 +1 @@ +ccf7bce753adabfd7dd8a68fd49853514367f11af42879cae1b6aa28e4ebe94c
\ No newline at end of file diff --git a/db/schema_migrations/20210505124816 b/db/schema_migrations/20210505124816 new file mode 100644 index 00000000000..a5877ffee20 --- /dev/null +++ b/db/schema_migrations/20210505124816 @@ -0,0 +1 @@ +56aa9590f4bc37d8f8c4ed869a4b095ba39925fb06ab58500eead895d19ee336
\ No newline at end of file diff --git a/db/schema_migrations/20210506064413 b/db/schema_migrations/20210506064413 new file mode 100644 index 00000000000..72e3336d898 --- /dev/null +++ b/db/schema_migrations/20210506064413 @@ -0,0 +1 @@ +f400225e6caa854f825422b9799e61ea557ab4bd3e4a33dc3cd3193ed3ce1db2
\ No newline at end of file diff --git a/db/schema_migrations/20210506065000 b/db/schema_migrations/20210506065000 new file mode 100644 index 00000000000..5ffe1800cd9 --- /dev/null +++ b/db/schema_migrations/20210506065000 @@ -0,0 +1 @@ +d286628cce50c469afe899d5ac40f20df8dceb6ee10c6cf49c64fbaeea7e4a2e
\ No newline at end of file diff --git a/db/schema_migrations/20210507191949 b/db/schema_migrations/20210507191949 new file mode 100644 index 00000000000..398bcbe6638 --- /dev/null +++ b/db/schema_migrations/20210507191949 @@ -0,0 +1 @@ +ab662ff92a4e2a7d324f0652da6f0725e1c38e387f08b89921b43816b5d35834
\ No newline at end of file diff --git a/db/schema_migrations/20210510191551 b/db/schema_migrations/20210510191551 new file mode 100644 index 00000000000..a3a58e4b59e --- /dev/null +++ b/db/schema_migrations/20210510191551 @@ -0,0 +1 @@ +949038f9f66788e3289afbf210617f7947762e4bbab4c7389164cbd775302642
\ No newline at end of file diff --git a/db/schema_migrations/20210510191552 b/db/schema_migrations/20210510191552 new file mode 100644 index 00000000000..ca7fd00428d --- /dev/null +++ b/db/schema_migrations/20210510191552 @@ -0,0 +1 @@ +e59505ee2a3ef04c1af8a426f7ebdb83874c926cf7d7f98b56e0af8cd38988f5
\ No newline at end of file diff --git a/db/schema_migrations/20210511095657 b/db/schema_migrations/20210511095657 new file mode 100644 index 00000000000..503ccfb459a --- /dev/null +++ b/db/schema_migrations/20210511095657 @@ -0,0 +1 @@ +4d11cdf876786db5e827ea1a50b70e2d5b3814fd7c0b0c083ab61adad9685364
\ No newline at end of file diff --git a/db/schema_migrations/20210511095658 b/db/schema_migrations/20210511095658 new file mode 100644 index 00000000000..d3fa692768d --- /dev/null +++ b/db/schema_migrations/20210511095658 @@ -0,0 +1 @@ +7387c23bbbc376e26c057179ebe2796be183462acb1fc509d451f0fede13ed93
\ No newline at end of file diff --git a/db/schema_migrations/20210511104929 b/db/schema_migrations/20210511104929 new file mode 100644 index 00000000000..af4f0ae0c01 --- /dev/null +++ b/db/schema_migrations/20210511104929 @@ -0,0 +1 @@ +7c2a036033a3f6a3f80755c8ce4a0deab5933084974af4d87e7b97cc446fcbda
\ No newline at end of file diff --git a/db/schema_migrations/20210511104930 b/db/schema_migrations/20210511104930 new file mode 100644 index 00000000000..9c07569e616 --- /dev/null +++ b/db/schema_migrations/20210511104930 @@ -0,0 +1 @@ +51a8eeb8919e3f59579885b9e316ba8116566ae9b363b5dd750a65f42503c391
\ No newline at end of file diff --git a/db/schema_migrations/20210511142748 b/db/schema_migrations/20210511142748 new file mode 100644 index 00000000000..e0900a0b8ca --- /dev/null +++ b/db/schema_migrations/20210511142748 @@ -0,0 +1 @@ +def18f68ad71a1581452d52d331d2fd99ec9a3eb9b8e2fd111277eda498169fa
\ No newline at end of file diff --git a/db/schema_migrations/20210512183309 b/db/schema_migrations/20210512183309 new file mode 100644 index 00000000000..efdceb8aed5 --- /dev/null +++ b/db/schema_migrations/20210512183309 @@ -0,0 +1 @@ +490dd9a1fe59fb1454f938763f9b8bce7a0567569ad5f7b8e29b196551d869e1
\ No newline at end of file diff --git a/db/schema_migrations/20210512183310 b/db/schema_migrations/20210512183310 new file mode 100644 index 00000000000..7f14b53caf0 --- /dev/null +++ b/db/schema_migrations/20210512183310 @@ -0,0 +1 @@ +d1e389755e4f5ed0075b07c5680eee5ae3557550071d14360ad3030e4c2d3ac1
\ No newline at end of file diff --git a/db/schema_migrations/20210513093418 b/db/schema_migrations/20210513093418 new file mode 100644 index 00000000000..770d0f1ebdc --- /dev/null +++ b/db/schema_migrations/20210513093418 @@ -0,0 +1 @@ +f2c85121d217aa953b6ae52e32624cf4164b1f1408bcbe8ae3facafc15b037ce
\ No newline at end of file diff --git a/db/schema_migrations/20210513155447 b/db/schema_migrations/20210513155447 new file mode 100644 index 00000000000..c2fd6c22a05 --- /dev/null +++ b/db/schema_migrations/20210513155447 @@ -0,0 +1 @@ +1f5ea8527107d4cffac535b9ae3e532a98ebd69a8711abdbe68b12fe005dfbb5
\ No newline at end of file diff --git a/db/schema_migrations/20210513155546 b/db/schema_migrations/20210513155546 new file mode 100644 index 00000000000..97f9dc2b3c0 --- /dev/null +++ b/db/schema_migrations/20210513155546 @@ -0,0 +1 @@ +44abbe007dae17982f923b1b15fd0534d3d3a7fd154cd9e4b5409f86030de2f7
\ No newline at end of file diff --git a/db/schema_migrations/20210513155635 b/db/schema_migrations/20210513155635 new file mode 100644 index 00000000000..57da33a0bd2 --- /dev/null +++ b/db/schema_migrations/20210513155635 @@ -0,0 +1 @@ +d1fccf214f2e237482fc4d9e2b5d5ea6e9241ad4ace8739e7b799555afafa215
\ No newline at end of file diff --git a/db/schema_migrations/20210517075444 b/db/schema_migrations/20210517075444 new file mode 100644 index 00000000000..4b4aee8710c --- /dev/null +++ b/db/schema_migrations/20210517075444 @@ -0,0 +1 @@ +ec08c18ac37f2ae7298650df58345755eada20aaa5b7ed3dfd54ee5cea88ebdd
\ No newline at end of file diff --git a/db/schema_migrations/20210518001450 b/db/schema_migrations/20210518001450 new file mode 100644 index 00000000000..5f3694d8b93 --- /dev/null +++ b/db/schema_migrations/20210518001450 @@ -0,0 +1 @@ +212a2db8b1183eb4ae313eacae7d54f2bec26c5ea3f961981d34e57ca1420ad9
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index db463645810..5d33a61e942 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -46,9 +46,9 @@ CREATE FUNCTION table_sync_function_29bc99d6db() RETURNS trigger AS $$ BEGIN IF (TG_OP = 'DELETE') THEN - DELETE FROM web_hook_logs_part_0c5294f417 where id = OLD.id; + DELETE FROM web_hook_logs_archived where id = OLD.id; ELSIF (TG_OP = 'UPDATE') THEN - UPDATE web_hook_logs_part_0c5294f417 + UPDATE web_hook_logs_archived SET web_hook_id = NEW.web_hook_id, trigger = NEW.trigger, url = NEW.url, @@ -59,11 +59,11 @@ ELSIF (TG_OP = 'UPDATE') THEN 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; + created_at = NEW.created_at, + updated_at = NEW.updated_at + WHERE web_hook_logs_archived.id = NEW.id; ELSIF (TG_OP = 'INSERT') THEN - INSERT INTO web_hook_logs_part_0c5294f417 (id, + INSERT INTO web_hook_logs_archived (id, web_hook_id, trigger, url, @@ -74,8 +74,8 @@ ELSIF (TG_OP = 'INSERT') THEN response_status, execution_duration, internal_error_message, - updated_at, - created_at) + created_at, + updated_at) VALUES (NEW.id, NEW.web_hook_id, NEW.trigger, @@ -87,8 +87,8 @@ ELSIF (TG_OP = 'INSERT') THEN NEW.response_status, NEW.execution_duration, NEW.internal_error_message, - NEW.updated_at, - NEW.created_at); + NEW.created_at, + NEW.updated_at); END IF; RETURN NULL; @@ -106,6 +106,34 @@ BEGIN END; $$; +CREATE FUNCTION trigger_21e7a2602957() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."build_id_convert_to_bigint" := NEW."build_id"; + RETURN NEW; +END; +$$; + +CREATE FUNCTION trigger_3f6129be01d2() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."id_convert_to_bigint" := NEW."id"; + NEW."stage_id_convert_to_bigint" := NEW."stage_id"; + RETURN NEW; +END; +$$; + +CREATE FUNCTION trigger_51ab7cef8934() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."build_id_convert_to_bigint" := NEW."build_id"; + RETURN NEW; +END; +$$; + CREATE FUNCTION trigger_69523443cc10() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -115,6 +143,34 @@ BEGIN END; $$; +CREATE FUNCTION trigger_8485e97c00e3() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."source_job_id_convert_to_bigint" := NEW."source_job_id"; + RETURN NEW; +END; +$$; + +CREATE FUNCTION trigger_be1804f21693() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."id_convert_to_bigint" := NEW."id"; + NEW."job_id_convert_to_bigint" := NEW."job_id"; + RETURN NEW; +END; +$$; + +CREATE FUNCTION trigger_cf2f9e35f002() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."build_id_convert_to_bigint" := NEW."build_id"; + RETURN NEW; +END; +$$; + CREATE TABLE audit_events ( id bigint NOT NULL, author_id integer NOT NULL, @@ -135,7 +191,7 @@ CREATE TABLE audit_events ( ) PARTITION BY RANGE (created_at); -CREATE TABLE web_hook_logs_part_0c5294f417 ( +CREATE TABLE web_hook_logs ( id bigint NOT NULL, web_hook_id integer NOT NULL, trigger character varying, @@ -8995,7 +9051,8 @@ CREATE TABLE analytics_cycle_analytics_project_stages ( end_event_label_id bigint, hidden boolean DEFAULT false NOT NULL, custom boolean DEFAULT true NOT NULL, - name character varying(255) NOT NULL + name character varying(255) NOT NULL, + project_value_stream_id bigint NOT NULL ); CREATE SEQUENCE analytics_cycle_analytics_project_stages_id_seq @@ -9007,6 +9064,24 @@ CREATE SEQUENCE analytics_cycle_analytics_project_stages_id_seq ALTER SEQUENCE analytics_cycle_analytics_project_stages_id_seq OWNED BY analytics_cycle_analytics_project_stages.id; +CREATE TABLE analytics_cycle_analytics_project_value_streams ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + project_id bigint NOT NULL, + name text NOT NULL, + CONSTRAINT check_9b1970a898 CHECK ((char_length(name) <= 100)) +); + +CREATE SEQUENCE analytics_cycle_analytics_project_value_streams_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE analytics_cycle_analytics_project_value_streams_id_seq OWNED BY analytics_cycle_analytics_project_value_streams.id; + CREATE TABLE analytics_devops_adoption_segment_selections ( id bigint NOT NULL, segment_id bigint NOT NULL, @@ -9028,12 +9103,11 @@ ALTER SEQUENCE analytics_devops_adoption_segment_selections_id_seq OWNED BY anal CREATE TABLE analytics_devops_adoption_segments ( id bigint NOT NULL, - name text, last_recorded_at timestamp with time zone, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, namespace_id integer, - CONSTRAINT check_4be7a006fd CHECK ((char_length(name) <= 255)) + display_namespace_id integer ); CREATE SEQUENCE analytics_devops_adoption_segments_id_seq @@ -9056,7 +9130,10 @@ CREATE TABLE analytics_devops_adoption_snapshots ( pipeline_succeeded boolean NOT NULL, deploy_succeeded boolean NOT NULL, security_scan_succeeded boolean NOT NULL, - end_time timestamp with time zone NOT NULL + end_time timestamp with time zone NOT NULL, + total_projects_count integer, + code_owners_used_count integer, + namespace_id integer ); CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq @@ -9445,6 +9522,20 @@ CREATE TABLE application_settings ( encrypted_external_pipeline_validation_service_token text, encrypted_external_pipeline_validation_service_token_iv text, external_pipeline_validation_service_url text, + throttle_unauthenticated_packages_api_requests_per_period integer DEFAULT 800 NOT NULL, + throttle_unauthenticated_packages_api_period_in_seconds integer DEFAULT 15 NOT NULL, + throttle_authenticated_packages_api_requests_per_period integer DEFAULT 1000 NOT NULL, + throttle_authenticated_packages_api_period_in_seconds integer DEFAULT 15 NOT NULL, + throttle_unauthenticated_packages_api_enabled boolean DEFAULT false NOT NULL, + throttle_authenticated_packages_api_enabled boolean DEFAULT false NOT NULL, + deactivate_dormant_users boolean DEFAULT false NOT NULL, + whats_new_variant smallint DEFAULT 0, + encrypted_spam_check_api_key bytea, + encrypted_spam_check_api_key_iv bytea, + floc_enabled boolean DEFAULT false NOT NULL, + elasticsearch_username text, + encrypted_elasticsearch_password bytea, + encrypted_elasticsearch_password_iv bytea, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)), CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), @@ -9460,6 +9551,7 @@ CREATE TABLE application_settings ( CONSTRAINT check_a5704163cc CHECK ((char_length(secret_detection_revocation_token_types_url) <= 255)), CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)), CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)), + CONSTRAINT check_e5024c8801 CHECK ((char_length(elasticsearch_username) <= 255)), CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)), CONSTRAINT check_ef6176834f CHECK ((char_length(encrypted_cloud_license_auth_token_iv) <= 255)) ); @@ -9808,7 +9900,8 @@ CREATE TABLE batched_background_migration_jobs ( sub_batch_size integer NOT NULL, status smallint DEFAULT 0 NOT NULL, attempts smallint DEFAULT 0 NOT NULL, - metrics jsonb DEFAULT '{}'::jsonb NOT NULL + metrics jsonb DEFAULT '{}'::jsonb NOT NULL, + pause_ms integer DEFAULT 100 NOT NULL ); CREATE SEQUENCE batched_background_migration_jobs_id_seq @@ -9836,6 +9929,7 @@ CREATE TABLE batched_background_migrations ( column_name text NOT NULL, job_arguments jsonb DEFAULT '"[]"'::jsonb NOT NULL, total_tuple_count bigint, + pause_ms integer DEFAULT 100 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)), @@ -9986,6 +10080,24 @@ CREATE SEQUENCE boards_epic_board_positions_id_seq ALTER SEQUENCE boards_epic_board_positions_id_seq OWNED BY boards_epic_board_positions.id; +CREATE TABLE boards_epic_board_recent_visits ( + id bigint NOT NULL, + user_id bigint NOT NULL, + epic_board_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 +); + +CREATE SEQUENCE boards_epic_board_recent_visits_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE boards_epic_board_recent_visits_id_seq OWNED BY boards_epic_board_recent_visits.id; + CREATE TABLE boards_epic_boards ( id bigint NOT NULL, hide_backlog_list boolean DEFAULT false NOT NULL, @@ -10144,6 +10256,47 @@ CREATE SEQUENCE bulk_import_entities_id_seq ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id; +CREATE TABLE bulk_import_export_uploads ( + id bigint NOT NULL, + export_id bigint NOT NULL, + updated_at timestamp with time zone NOT NULL, + export_file text, + CONSTRAINT check_5add76239d CHECK ((char_length(export_file) <= 255)) +); + +CREATE SEQUENCE bulk_import_export_uploads_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE bulk_import_export_uploads_id_seq OWNED BY bulk_import_export_uploads.id; + +CREATE TABLE bulk_import_exports ( + id bigint NOT NULL, + group_id bigint, + project_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + status smallint DEFAULT 0 NOT NULL, + relation text NOT NULL, + jid text, + error text, + CONSTRAINT check_24cb010672 CHECK ((char_length(relation) <= 255)), + CONSTRAINT check_8f0f357334 CHECK ((char_length(error) <= 255)), + CONSTRAINT check_9ee6d14d33 CHECK ((char_length(jid) <= 255)) +); + +CREATE SEQUENCE bulk_import_exports_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE bulk_import_exports_id_seq OWNED BY bulk_import_exports.id; + CREATE TABLE bulk_import_failures ( id bigint NOT NULL, bulk_import_entity_id bigint NOT NULL, @@ -10256,7 +10409,8 @@ CREATE TABLE ci_build_needs ( build_id integer NOT NULL, name text NOT NULL, artifacts boolean DEFAULT true NOT NULL, - optional boolean DEFAULT false NOT NULL + optional boolean DEFAULT false NOT NULL, + build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE ci_build_needs_id_seq @@ -10310,7 +10464,8 @@ CREATE TABLE ci_build_trace_chunks ( data_store integer NOT NULL, raw_data bytea, checksum bytea, - lock_version integer DEFAULT 0 NOT NULL + lock_version integer DEFAULT 0 NOT NULL, + build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE ci_build_trace_chunks_id_seq @@ -10393,6 +10548,8 @@ CREATE TABLE ci_builds ( waiting_for_resource_at timestamp with time zone, processed boolean, scheduling_type smallint, + id_convert_to_bigint bigint DEFAULT 0 NOT NULL, + stage_id_convert_to_bigint bigint, CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)) ); @@ -10434,7 +10591,8 @@ CREATE TABLE ci_builds_runner_session ( build_id integer NOT NULL, url character varying NOT NULL, certificate character varying, - "authorization" character varying + "authorization" character varying, + build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE ci_builds_runner_session_id_seq @@ -10566,6 +10724,8 @@ CREATE TABLE ci_job_artifacts ( file_sha256 bytea, file_format smallint, file_location smallint, + id_convert_to_bigint bigint DEFAULT 0 NOT NULL, + job_id_convert_to_bigint bigint DEFAULT 0 NOT NULL, CONSTRAINT check_27f0f6dbab CHECK ((file_store IS NOT NULL)) ); @@ -10959,7 +11119,8 @@ CREATE TABLE ci_sources_pipelines ( pipeline_id integer, source_project_id integer, source_job_id integer, - source_pipeline_id integer + source_pipeline_id integer, + source_job_id_convert_to_bigint bigint ); CREATE SEQUENCE ci_sources_pipelines_id_seq @@ -11577,11 +11738,22 @@ CREATE SEQUENCE clusters_id_seq ALTER SEQUENCE clusters_id_seq OWNED BY clusters.id; +CREATE TABLE clusters_integration_elasticstack ( + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + cluster_id bigint NOT NULL, + enabled boolean DEFAULT false NOT NULL, + chart_version text, + CONSTRAINT check_f8d671ce04 CHECK ((char_length(chart_version) <= 10)) +); + CREATE TABLE clusters_integration_prometheus ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, cluster_id bigint NOT NULL, - enabled boolean DEFAULT false NOT NULL + enabled boolean DEFAULT false NOT NULL, + encrypted_alert_manager_token text, + encrypted_alert_manager_token_iv text ); CREATE TABLE clusters_kubernetes_namespaces ( @@ -11878,6 +12050,13 @@ CREATE SEQUENCE dast_site_profiles_id_seq ALTER SEQUENCE dast_site_profiles_id_seq OWNED BY dast_site_profiles.id; +CREATE TABLE dast_site_profiles_pipelines ( + dast_site_profile_id bigint NOT NULL, + ci_pipeline_id bigint NOT NULL +); + +COMMENT ON TABLE dast_site_profiles_pipelines IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Site Profiles and CI Pipelines"}'; + CREATE TABLE dast_site_tokens ( id bigint NOT NULL, project_id bigint NOT NULL, @@ -12268,13 +12447,34 @@ CREATE SEQUENCE elastic_index_settings_id_seq ALTER SEQUENCE elastic_index_settings_id_seq OWNED BY elastic_index_settings.id; +CREATE TABLE elastic_reindexing_slices ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + elastic_reindexing_subtask_id bigint NOT NULL, + elastic_slice smallint DEFAULT 0 NOT NULL, + elastic_max_slice smallint DEFAULT 0 NOT NULL, + retry_attempt smallint DEFAULT 0 NOT NULL, + elastic_task text, + CONSTRAINT check_ca30e1396e CHECK ((char_length(elastic_task) <= 255)) +); + +CREATE SEQUENCE elastic_reindexing_slices_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE elastic_reindexing_slices_id_seq OWNED BY elastic_reindexing_slices.id; + CREATE TABLE elastic_reindexing_subtasks ( id bigint NOT NULL, elastic_reindexing_task_id bigint NOT NULL, alias_name text NOT NULL, index_name_from text NOT NULL, index_name_to text NOT NULL, - elastic_task text NOT NULL, + elastic_task text, documents_count_target integer, documents_count integer, created_at timestamp with time zone NOT NULL, @@ -12307,6 +12507,8 @@ CREATE TABLE elastic_reindexing_tasks ( error_message text, documents_count_target integer, delete_original_index_at timestamp with time zone, + max_slices_running smallint DEFAULT 60 NOT NULL, + slice_multiplier smallint DEFAULT 2 NOT NULL, CONSTRAINT check_04151aca42 CHECK ((char_length(index_name_from) <= 255)), CONSTRAINT check_7f64acda8e CHECK ((char_length(error_message) <= 255)), CONSTRAINT check_85ebff7124 CHECK ((char_length(index_name_to) <= 255)), @@ -13425,7 +13627,9 @@ CREATE TABLE import_export_uploads ( project_id integer, import_file text, export_file text, - group_id bigint + group_id bigint, + remote_import_url text, + CONSTRAINT check_58f0d37481 CHECK ((char_length(remote_import_url) <= 512)) ); CREATE SEQUENCE import_export_uploads_id_seq @@ -13479,6 +13683,41 @@ CREATE SEQUENCE in_product_marketing_emails_id_seq ALTER SEQUENCE in_product_marketing_emails_id_seq OWNED BY in_product_marketing_emails.id; +CREATE TABLE incident_management_escalation_policies ( + id bigint NOT NULL, + project_id bigint NOT NULL, + name text NOT NULL, + description text, + CONSTRAINT check_510b2a5258 CHECK ((char_length(description) <= 160)), + CONSTRAINT check_9a26365850 CHECK ((char_length(name) <= 72)) +); + +CREATE SEQUENCE incident_management_escalation_policies_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE incident_management_escalation_policies_id_seq OWNED BY incident_management_escalation_policies.id; + +CREATE TABLE incident_management_escalation_rules ( + id bigint NOT NULL, + policy_id bigint NOT NULL, + oncall_schedule_id bigint NOT NULL, + status smallint NOT NULL, + elapsed_time_seconds integer NOT NULL +); + +CREATE SEQUENCE incident_management_escalation_rules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE incident_management_escalation_rules_id_seq OWNED BY incident_management_escalation_rules.id; + CREATE TABLE incident_management_oncall_participants ( id bigint NOT NULL, oncall_rotation_id bigint NOT NULL, @@ -13853,6 +14092,9 @@ CREATE TABLE iterations_cadences ( active boolean DEFAULT true NOT NULL, automatic boolean DEFAULT true NOT NULL, title text NOT NULL, + roll_over boolean DEFAULT false NOT NULL, + description text, + CONSTRAINT check_5c5d2b44bd CHECK ((char_length(description) <= 5000)), CONSTRAINT check_fedff82d3b CHECK ((char_length(title) <= 255)) ); @@ -13950,14 +14192,6 @@ CREATE TABLE jira_tracker_data ( deployment_type smallint DEFAULT 0 NOT NULL, vulnerabilities_issuetype text, vulnerabilities_enabled boolean DEFAULT false NOT NULL, - encrypted_proxy_address text, - encrypted_proxy_address_iv text, - encrypted_proxy_port text, - encrypted_proxy_port_iv text, - encrypted_proxy_username text, - encrypted_proxy_username_iv text, - encrypted_proxy_password text, - encrypted_proxy_password_iv text, jira_issue_transition_automatic boolean DEFAULT false NOT NULL, CONSTRAINT check_0bf84b76e9 CHECK ((char_length(vulnerabilities_issuetype) <= 255)), CONSTRAINT check_214cf6a48b CHECK ((char_length(project_key) <= 255)) @@ -14046,7 +14280,8 @@ CREATE TABLE labels ( description_html text, type character varying, group_id integer, - cached_markdown_version integer + cached_markdown_version integer, + remove_on_close boolean DEFAULT false NOT NULL ); CREATE SEQUENCE labels_id_seq @@ -14504,6 +14739,7 @@ CREATE TABLE merge_requests ( squash_commit_sha bytea, sprint_id bigint, merge_ref_sha bytea, + draft boolean DEFAULT false NOT NULL, CONSTRAINT check_970d272570 CHECK ((lock_version IS NOT NULL)) ); @@ -14659,6 +14895,9 @@ CREATE TABLE namespace_package_settings ( namespace_id bigint NOT NULL, maven_duplicates_allowed boolean DEFAULT true NOT NULL, maven_duplicate_exception_regex text DEFAULT ''::text NOT NULL, + generic_duplicates_allowed boolean DEFAULT true NOT NULL, + generic_duplicate_exception_regex text DEFAULT ''::text NOT NULL, + CONSTRAINT check_31340211b1 CHECK ((char_length(generic_duplicate_exception_regex) <= 255)), CONSTRAINT check_d63274b2b6 CHECK ((char_length(maven_duplicate_exception_regex) <= 255)) ); @@ -15507,6 +15746,15 @@ CREATE SEQUENCE packages_events_id_seq ALTER SEQUENCE packages_events_id_seq OWNED BY packages_events.id; +CREATE TABLE packages_helm_file_metadata ( + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + package_file_id bigint NOT NULL, + channel text NOT NULL, + metadata jsonb, + CONSTRAINT check_c34067922d CHECK ((char_length(channel) <= 63)) +); + CREATE TABLE packages_maven_metadata ( id bigint NOT NULL, package_id bigint NOT NULL, @@ -15883,7 +16131,11 @@ CREATE TABLE plan_limits ( 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, - terraform_module_max_file_size bigint DEFAULT 1073741824 NOT NULL + terraform_module_max_file_size bigint DEFAULT 1073741824 NOT NULL, + helm_max_file_size bigint DEFAULT 5242880 NOT NULL, + ci_registered_group_runners integer DEFAULT 1000 NOT NULL, + ci_registered_project_runners integer DEFAULT 1000 NOT NULL, + web_hook_calls integer DEFAULT 0 NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -17359,7 +17611,8 @@ CREATE TABLE security_orchestration_policy_configurations ( project_id bigint NOT NULL, security_policy_management_project_id bigint NOT NULL, created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL + updated_at timestamp with time zone NOT NULL, + configured_at timestamp with time zone ); COMMENT ON TABLE security_orchestration_policy_configurations IS '{"owner":"group::container security","description":"Configuration used to store relationship between project and security policy repository"}'; @@ -17373,6 +17626,29 @@ CREATE SEQUENCE security_orchestration_policy_configurations_id_seq ALTER SEQUENCE security_orchestration_policy_configurations_id_seq OWNED BY security_orchestration_policy_configurations.id; +CREATE TABLE security_orchestration_policy_rule_schedules ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + next_run_at timestamp with time zone, + security_orchestration_policy_configuration_id bigint NOT NULL, + user_id bigint NOT NULL, + policy_index integer NOT NULL, + cron text NOT NULL, + CONSTRAINT check_915825a76e CHECK ((char_length(cron) <= 255)) +); + +COMMENT ON TABLE security_orchestration_policy_rule_schedules IS '{"owner":"group::container security","description":"Schedules used to store relationship between project and security policy repository"}'; + +CREATE SEQUENCE security_orchestration_policy_rule_schedules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE security_orchestration_policy_rule_schedules_id_seq OWNED BY security_orchestration_policy_rule_schedules.id; + CREATE TABLE security_scans ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17735,6 +18011,21 @@ CREATE SEQUENCE sprints_id_seq ALTER SEQUENCE sprints_id_seq OWNED BY sprints.id; +CREATE TABLE status_check_responses ( + id bigint NOT NULL, + merge_request_id bigint NOT NULL, + external_approval_rule_id bigint NOT NULL +); + +CREATE SEQUENCE status_check_responses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE status_check_responses_id_seq OWNED BY status_check_responses.id; + CREATE TABLE status_page_published_incidents ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17903,6 +18194,8 @@ CREATE TABLE terraform_state_versions ( verification_checksum bytea, verification_failure text, ci_build_id bigint, + verification_started_at timestamp with time zone, + verification_state smallint DEFAULT 0 NOT NULL, CONSTRAINT check_0824bb7bbd CHECK ((char_length(file) <= 255)), CONSTRAINT tf_state_versions_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255)) ); @@ -17949,7 +18242,8 @@ CREATE TABLE timelogs ( issue_id integer, merge_request_id integer, spent_at timestamp without time zone, - note_id integer + note_id integer, + project_id integer ); CREATE SEQUENCE timelogs_id_seq @@ -18115,6 +18409,11 @@ CREATE SEQUENCE user_canonical_emails_id_seq ALTER SEQUENCE user_canonical_emails_id_seq OWNED BY user_canonical_emails.id; +CREATE TABLE user_credit_card_validations ( + user_id bigint NOT NULL, + credit_card_validated_at timestamp with time zone NOT NULL +); + CREATE TABLE user_custom_attributes ( id integer NOT NULL, created_at timestamp without time zone NOT NULL, @@ -18541,6 +18840,49 @@ CREATE SEQUENCE vulnerability_feedback_id_seq ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id; +CREATE TABLE vulnerability_finding_evidence_requests ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + vulnerability_finding_evidence_id bigint NOT NULL, + method text, + url text, + body text, + CONSTRAINT check_7e37f2d01a CHECK ((char_length(body) <= 2048)), + CONSTRAINT check_8152fbb236 CHECK ((char_length(url) <= 2048)), + CONSTRAINT check_d9d11300f4 CHECK ((char_length(method) <= 32)) +); + +CREATE SEQUENCE vulnerability_finding_evidence_requests_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_finding_evidence_requests_id_seq OWNED BY vulnerability_finding_evidence_requests.id; + +CREATE TABLE vulnerability_finding_evidence_responses ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + vulnerability_finding_evidence_id bigint NOT NULL, + status_code integer, + reason_phrase text, + body text, + CONSTRAINT check_58b124ab48 CHECK ((char_length(reason_phrase) <= 2048)), + CONSTRAINT check_76bac0c32b CHECK ((char_length(body) <= 2048)) +); + +CREATE SEQUENCE vulnerability_finding_evidence_responses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_finding_evidence_responses_id_seq OWNED BY vulnerability_finding_evidence_responses.id; + CREATE TABLE vulnerability_finding_evidences ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -18835,7 +19177,7 @@ CREATE SEQUENCE vulnerability_user_mentions_id_seq ALTER SEQUENCE vulnerability_user_mentions_id_seq OWNED BY vulnerability_user_mentions.id; -CREATE TABLE web_hook_logs ( +CREATE TABLE web_hook_logs_archived ( id integer NOT NULL, web_hook_id integer NOT NULL, trigger character varying, @@ -18889,7 +19231,10 @@ CREATE TABLE web_hooks ( releases_events boolean DEFAULT false NOT NULL, feature_flag_events boolean DEFAULT false NOT NULL, member_events boolean DEFAULT false NOT NULL, - subgroup_events boolean DEFAULT false NOT NULL + subgroup_events boolean DEFAULT false NOT NULL, + recent_failures smallint DEFAULT 0 NOT NULL, + backoff_count smallint DEFAULT 0 NOT NULL, + disabled_until timestamp with time zone ); CREATE SEQUENCE web_hooks_id_seq @@ -19054,6 +19399,8 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER COLUMN id S ALTER TABLE ONLY analytics_cycle_analytics_project_stages ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_project_stages_id_seq'::regclass); +ALTER TABLE ONLY analytics_cycle_analytics_project_value_streams ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_project_value_streams_id_seq'::regclass); + ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segment_selections_id_seq'::regclass); ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segments_id_seq'::regclass); @@ -19122,6 +19469,8 @@ ALTER TABLE ONLY boards_epic_board_labels ALTER COLUMN id SET DEFAULT nextval('b ALTER TABLE ONLY boards_epic_board_positions ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_positions_id_seq'::regclass); +ALTER TABLE ONLY boards_epic_board_recent_visits ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_recent_visits_id_seq'::regclass); + 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); @@ -19136,6 +19485,10 @@ ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass); +ALTER TABLE ONLY bulk_import_export_uploads ALTER COLUMN id SET DEFAULT nextval('bulk_import_export_uploads_id_seq'::regclass); + +ALTER TABLE ONLY bulk_import_exports ALTER COLUMN id SET DEFAULT nextval('bulk_import_exports_id_seq'::regclass); + ALTER TABLE ONLY bulk_import_failures ALTER COLUMN id SET DEFAULT nextval('bulk_import_failures_id_seq'::regclass); ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_trackers_id_seq'::regclass); @@ -19328,6 +19681,8 @@ ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id ALTER TABLE ONLY elastic_index_settings ALTER COLUMN id SET DEFAULT nextval('elastic_index_settings_id_seq'::regclass); +ALTER TABLE ONLY elastic_reindexing_slices ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_slices_id_seq'::regclass); + ALTER TABLE ONLY elastic_reindexing_subtasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_subtasks_id_seq'::regclass); ALTER TABLE ONLY elastic_reindexing_tasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_tasks_id_seq'::regclass); @@ -19440,6 +19795,10 @@ ALTER TABLE ONLY import_failures ALTER COLUMN id SET DEFAULT nextval('import_fai ALTER TABLE ONLY in_product_marketing_emails ALTER COLUMN id SET DEFAULT nextval('in_product_marketing_emails_id_seq'::regclass); +ALTER TABLE ONLY incident_management_escalation_policies ALTER COLUMN id SET DEFAULT nextval('incident_management_escalation_policies_id_seq'::regclass); + +ALTER TABLE ONLY incident_management_escalation_rules ALTER COLUMN id SET DEFAULT nextval('incident_management_escalation_rules_id_seq'::regclass); + ALTER TABLE ONLY incident_management_oncall_participants ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_participants_id_seq'::regclass); ALTER TABLE ONLY incident_management_oncall_rotations ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_rotations_id_seq'::regclass); @@ -19750,6 +20109,8 @@ ALTER TABLE ONLY security_findings ALTER COLUMN id SET DEFAULT nextval('security ALTER TABLE ONLY security_orchestration_policy_configurations ALTER COLUMN id SET DEFAULT nextval('security_orchestration_policy_configurations_id_seq'::regclass); +ALTER TABLE ONLY security_orchestration_policy_rule_schedules ALTER COLUMN id SET DEFAULT nextval('security_orchestration_policy_rule_schedules_id_seq'::regclass); + ALTER TABLE ONLY security_scans ALTER COLUMN id SET DEFAULT nextval('security_scans_id_seq'::regclass); ALTER TABLE ONLY self_managed_prometheus_alert_events ALTER COLUMN id SET DEFAULT nextval('self_managed_prometheus_alert_events_id_seq'::regclass); @@ -19780,6 +20141,8 @@ ALTER TABLE ONLY spam_logs ALTER COLUMN id SET DEFAULT nextval('spam_logs_id_seq ALTER TABLE ONLY sprints ALTER COLUMN id SET DEFAULT nextval('sprints_id_seq'::regclass); +ALTER TABLE ONLY status_check_responses ALTER COLUMN id SET DEFAULT nextval('status_check_responses_id_seq'::regclass); + ALTER TABLE ONLY status_page_published_incidents ALTER COLUMN id SET DEFAULT nextval('status_page_published_incidents_id_seq'::regclass); ALTER TABLE ONLY status_page_settings ALTER COLUMN project_id SET DEFAULT nextval('status_page_settings_project_id_seq'::regclass); @@ -19846,6 +20209,10 @@ ALTER TABLE ONLY vulnerability_external_issue_links ALTER COLUMN id SET DEFAULT ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_finding_evidence_requests ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_requests_id_seq'::regclass); + +ALTER TABLE ONLY vulnerability_finding_evidence_responses ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_responses_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_finding_evidences ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidences_id_seq'::regclass); ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass); @@ -20114,6 +20481,9 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER TABLE ONLY analytics_cycle_analytics_project_stages ADD CONSTRAINT analytics_cycle_analytics_project_stages_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_cycle_analytics_project_value_streams + ADD CONSTRAINT analytics_cycle_analytics_project_value_streams_pkey PRIMARY KEY (id); + ALTER TABLE ONLY analytics_devops_adoption_segment_selections ADD CONSTRAINT analytics_devops_adoption_segment_selections_pkey PRIMARY KEY (id); @@ -20225,6 +20595,9 @@ ALTER TABLE ONLY boards_epic_board_labels ALTER TABLE ONLY boards_epic_board_positions ADD CONSTRAINT boards_epic_board_positions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY boards_epic_board_recent_visits + ADD CONSTRAINT boards_epic_board_recent_visits_pkey PRIMARY KEY (id); + ALTER TABLE ONLY boards_epic_boards ADD CONSTRAINT boards_epic_boards_pkey PRIMARY KEY (id); @@ -20249,6 +20622,12 @@ ALTER TABLE ONLY bulk_import_configurations ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id); +ALTER TABLE ONLY bulk_import_export_uploads + ADD CONSTRAINT bulk_import_export_uploads_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY bulk_import_exports + ADD CONSTRAINT bulk_import_exports_pkey PRIMARY KEY (id); + ALTER TABLE ONLY bulk_import_failures ADD CONSTRAINT bulk_import_failures_pkey PRIMARY KEY (id); @@ -20462,6 +20841,9 @@ ALTER TABLE ONLY clusters_applications_prometheus ALTER TABLE ONLY clusters_applications_runners ADD CONSTRAINT clusters_applications_runners_pkey PRIMARY KEY (id); +ALTER TABLE ONLY clusters_integration_elasticstack + ADD CONSTRAINT clusters_integration_elasticstack_pkey PRIMARY KEY (cluster_id); + ALTER TABLE ONLY clusters_integration_prometheus ADD CONSTRAINT clusters_integration_prometheus_pkey PRIMARY KEY (cluster_id); @@ -20504,6 +20886,9 @@ ALTER TABLE ONLY dast_scanner_profiles ALTER TABLE ONLY dast_site_profile_secret_variables ADD CONSTRAINT dast_site_profile_secret_variables_pkey PRIMARY KEY (id); +ALTER TABLE ONLY dast_site_profiles_pipelines + ADD CONSTRAINT dast_site_profiles_pipelines_pkey PRIMARY KEY (dast_site_profile_id, ci_pipeline_id); + ALTER TABLE ONLY dast_site_profiles ADD CONSTRAINT dast_site_profiles_pkey PRIMARY KEY (id); @@ -20567,6 +20952,9 @@ ALTER TABLE ONLY draft_notes ALTER TABLE ONLY elastic_index_settings ADD CONSTRAINT elastic_index_settings_pkey PRIMARY KEY (id); +ALTER TABLE ONLY elastic_reindexing_slices + ADD CONSTRAINT elastic_reindexing_slices_pkey PRIMARY KEY (id); + ALTER TABLE ONLY elastic_reindexing_subtasks ADD CONSTRAINT elastic_reindexing_subtasks_pkey PRIMARY KEY (id); @@ -20753,6 +21141,12 @@ ALTER TABLE ONLY in_product_marketing_emails ALTER TABLE ONLY incident_management_oncall_shifts ADD CONSTRAINT inc_mgmnt_no_overlapping_oncall_shifts EXCLUDE USING gist (rotation_id WITH =, tstzrange(starts_at, ends_at, '[)'::text) WITH &&); +ALTER TABLE ONLY incident_management_escalation_policies + ADD CONSTRAINT incident_management_escalation_policies_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY incident_management_escalation_rules + ADD CONSTRAINT incident_management_escalation_rules_pkey PRIMARY KEY (id); + ALTER TABLE ONLY incident_management_oncall_participants ADD CONSTRAINT incident_management_oncall_participants_pkey PRIMARY KEY (id); @@ -21056,6 +21450,9 @@ ALTER TABLE ONLY packages_dependency_links ALTER TABLE ONLY packages_events ADD CONSTRAINT packages_events_pkey PRIMARY KEY (id); +ALTER TABLE ONLY packages_helm_file_metadata + ADD CONSTRAINT packages_helm_file_metadata_pkey PRIMARY KEY (package_file_id); + ALTER TABLE ONLY packages_maven_metadata ADD CONSTRAINT packages_maven_metadata_pkey PRIMARY KEY (id); @@ -21308,6 +21705,9 @@ ALTER TABLE ONLY security_findings ALTER TABLE ONLY security_orchestration_policy_configurations ADD CONSTRAINT security_orchestration_policy_configurations_pkey PRIMARY KEY (id); +ALTER TABLE ONLY security_orchestration_policy_rule_schedules + ADD CONSTRAINT security_orchestration_policy_rule_schedules_pkey PRIMARY KEY (id); + ALTER TABLE ONLY security_scans ADD CONSTRAINT security_scans_pkey PRIMARY KEY (id); @@ -21365,6 +21765,9 @@ ALTER TABLE ONLY spam_logs ALTER TABLE ONLY sprints ADD CONSTRAINT sprints_pkey PRIMARY KEY (id); +ALTER TABLE ONLY status_check_responses + ADD CONSTRAINT status_check_responses_pkey PRIMARY KEY (id); + ALTER TABLE ONLY status_page_published_incidents ADD CONSTRAINT status_page_published_incidents_pkey PRIMARY KEY (id); @@ -21422,6 +21825,9 @@ ALTER TABLE ONLY user_callouts ALTER TABLE ONLY user_canonical_emails ADD CONSTRAINT user_canonical_emails_pkey PRIMARY KEY (id); +ALTER TABLE ONLY user_credit_card_validations + ADD CONSTRAINT user_credit_card_validations_pkey PRIMARY KEY (user_id); + ALTER TABLE ONLY user_custom_attributes ADD CONSTRAINT user_custom_attributes_pkey PRIMARY KEY (id); @@ -21476,6 +21882,12 @@ ALTER TABLE ONLY vulnerability_external_issue_links ALTER TABLE ONLY vulnerability_feedback ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_finding_evidence_requests + ADD CONSTRAINT vulnerability_finding_evidence_requests_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY vulnerability_finding_evidence_responses + ADD CONSTRAINT vulnerability_finding_evidence_responses_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_finding_evidences ADD CONSTRAINT vulnerability_finding_evidences_pkey PRIMARY KEY (id); @@ -21518,11 +21930,11 @@ 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_archived + ADD CONSTRAINT web_hook_logs_archived_pkey PRIMARY KEY (id); ALTER TABLE ONLY web_hook_logs - ADD CONSTRAINT web_hook_logs_pkey PRIMARY KEY (id); + ADD CONSTRAINT web_hook_logs_pkey PRIMARY KEY (id, created_at); ALTER TABLE ONLY web_hooks ADD CONSTRAINT web_hooks_pkey PRIMARY KEY (id); @@ -21710,7 +22122,9 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL); -CREATE INDEX expired_artifacts_temp_index ON ci_job_artifacts USING btree (id, created_at) WHERE ((expire_at IS NULL) AND (date(timezone('UTC'::text, created_at)) < '2020-06-22'::date)); +CREATE INDEX finding_evidence_requests_on_finding_evidence_id ON vulnerability_finding_evidence_requests USING btree (vulnerability_finding_evidence_id); + +CREATE INDEX finding_evidence_responses_on_finding_evidences_id ON vulnerability_finding_evidence_responses USING btree (vulnerability_finding_evidence_id); CREATE INDEX finding_evidences_on_vulnerability_occurrence_id ON vulnerability_finding_evidences USING btree (vulnerability_occurrence_id); @@ -21722,14 +22136,24 @@ CREATE INDEX idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id ON a CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1); +CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at ON container_expiration_policies USING btree (project_id, next_run_at) WHERE (enabled = true); + CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled); CREATE INDEX idx_container_repositories_on_exp_cleanup_status_and_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, expiration_policy_started_at); CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); +CREATE INDEX idx_devops_adoption_segments_namespace_end_time ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time); + +CREATE INDEX idx_devops_adoption_segments_namespace_recorded_at ON analytics_devops_adoption_snapshots USING btree (namespace_id, recorded_at); + +CREATE UNIQUE INDEX idx_devops_adoption_segments_namespaces_pair ON analytics_devops_adoption_segments USING btree (display_namespace_id, namespace_id); + CREATE INDEX idx_eaprpb_external_approval_rule_id ON external_approval_rules_protected_branches USING btree (external_approval_rule_id); +CREATE INDEX idx_elastic_reindexing_slices_on_elastic_reindexing_subtask_id ON elastic_reindexing_slices USING btree (elastic_reindexing_subtask_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); @@ -21740,6 +22164,8 @@ CREATE INDEX idx_issues_on_project_id_and_created_at_and_id_and_state_id ON issu CREATE INDEX idx_issues_on_project_id_and_due_date_and_id_and_state_id ON issues USING btree (project_id, due_date, id, state_id) WHERE (due_date IS NOT NULL); +CREATE INDEX idx_issues_on_project_id_and_rel_asc_and_id ON issues USING btree (project_id, relative_position, id); + CREATE INDEX idx_issues_on_project_id_and_rel_position_and_state_id_and_id ON issues USING btree (project_id, relative_position, state_id, id DESC); CREATE INDEX idx_issues_on_project_id_and_updated_at_and_id_and_state_id ON issues USING btree (project_id, updated_at, id, state_id); @@ -21786,10 +22212,6 @@ CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON p CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); -CREATE INDEX idx_pkgs_deb_grp_architectures_on_distribution_id ON packages_debian_group_architectures USING btree (distribution_id); - -CREATE INDEX idx_pkgs_deb_proj_architectures_on_distribution_id ON packages_debian_project_architectures USING btree (distribution_id); - CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type); CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_cloud_last_sync_at, project_id) WHERE (jira_dvcs_cloud_last_sync_at IS NOT NULL); @@ -21884,6 +22306,10 @@ CREATE INDEX index_analytics_ca_project_stages_on_relative_position ON analytics CREATE INDEX index_analytics_ca_project_stages_on_start_event_label_id ON analytics_cycle_analytics_project_stages USING btree (start_event_label_id); +CREATE INDEX index_analytics_ca_project_stages_on_value_stream_id ON analytics_cycle_analytics_project_stages USING btree (project_value_stream_id); + +CREATE UNIQUE INDEX index_analytics_ca_project_value_streams_on_project_id_and_name ON analytics_cycle_analytics_project_value_streams USING btree (project_id, name); + CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true); CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id); @@ -21980,6 +22406,8 @@ 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_jobs_on_batched_migration_id_and_status ON batched_background_migration_jobs USING btree (batched_background_migration_id, status); + 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); @@ -22022,6 +22450,12 @@ CREATE INDEX index_boards_epic_board_positions_on_epic_id ON boards_epic_board_p CREATE INDEX index_boards_epic_board_positions_on_scoped_relative_position ON boards_epic_board_positions USING btree (epic_board_id, epic_id, relative_position); +CREATE INDEX index_boards_epic_board_recent_visits_on_epic_board_id ON boards_epic_board_recent_visits USING btree (epic_board_id); + +CREATE INDEX index_boards_epic_board_recent_visits_on_group_id ON boards_epic_board_recent_visits USING btree (group_id); + +CREATE INDEX index_boards_epic_board_recent_visits_on_user_id ON boards_epic_board_recent_visits USING btree (user_id); + 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); @@ -22060,6 +22494,8 @@ CREATE INDEX index_bulk_import_entities_on_parent_id ON bulk_import_entities USI CREATE INDEX index_bulk_import_entities_on_project_id ON bulk_import_entities USING btree (project_id); +CREATE INDEX index_bulk_import_export_uploads_on_export_id ON bulk_import_export_uploads USING btree (export_id); + CREATE INDEX index_bulk_import_failures_on_bulk_import_entity_id ON bulk_import_failures USING btree (bulk_import_entity_id); CREATE INDEX index_bulk_import_failures_on_correlation_id_value ON bulk_import_failures USING btree (correlation_id_value); @@ -22136,6 +22572,10 @@ CREATE INDEX index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build ON c CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON ci_builds USING btree (project_id, status) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text]))); +CREATE INDEX index_ci_builds_runner_id_pending_covering ON ci_builds USING btree (runner_id, id) INCLUDE (project_id) WHERE (((status)::text = 'pending'::text) AND ((type)::text = 'Ci::Build'::text)); + +CREATE INDEX index_ci_builds_runner_id_running ON ci_builds USING btree (runner_id) WHERE (((status)::text = 'running'::text) AND ((type)::text = 'Ci::Build'::text)); + CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runner_session USING btree (build_id); CREATE INDEX index_ci_daily_build_group_report_results_on_group_id ON ci_daily_build_group_report_results USING btree (group_id); @@ -22324,7 +22764,7 @@ CREATE INDEX index_ci_variables_on_key ON ci_variables USING btree (key); CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_scope ON ci_variables USING btree (project_id, key, environment_scope); -CREATE INDEX index_cluster_agent_tokens_on_agent_id ON cluster_agent_tokens USING btree (agent_id); +CREATE INDEX index_cluster_agent_tokens_on_agent_id_and_last_used_at ON cluster_agent_tokens USING btree (agent_id, last_used_at DESC NULLS LAST); CREATE INDEX index_cluster_agent_tokens_on_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id); @@ -22436,6 +22876,8 @@ CREATE INDEX index_dast_site_profiles_on_dast_site_id ON dast_site_profiles USIN CREATE UNIQUE INDEX index_dast_site_profiles_on_project_id_and_name ON dast_site_profiles USING btree (project_id, name); +CREATE UNIQUE INDEX index_dast_site_profiles_pipelines_on_ci_pipeline_id ON dast_site_profiles_pipelines USING btree (ci_pipeline_id); + CREATE INDEX index_dast_site_tokens_on_project_id ON dast_site_tokens USING btree (project_id); CREATE INDEX index_dast_site_validations_on_dast_site_token_id ON dast_site_validations USING btree (dast_site_token_id); @@ -22488,7 +22930,7 @@ CREATE INDEX index_deployments_on_id_and_status_and_created_at ON deployments US CREATE INDEX index_deployments_on_id_where_cluster_id_present ON deployments USING btree (id) WHERE (cluster_id IS NOT NULL); -CREATE INDEX index_deployments_on_project_and_environment_and_updated_at ON deployments USING btree (project_id, environment_id, updated_at); +CREATE INDEX index_deployments_on_project_and_environment_and_updated_at_id ON deployments USING btree (project_id, environment_id, updated_at, id); CREATE INDEX index_deployments_on_project_and_finished ON deployments USING btree (project_id, finished_at) WHERE (status = 2); @@ -22580,6 +23022,8 @@ CREATE INDEX index_environments_on_state_and_auto_stop_at ON environments USING CREATE UNIQUE INDEX index_epic_board_list_preferences_on_user_and_list ON boards_epic_list_user_preferences USING btree (user_id, epic_list_id); +CREATE UNIQUE INDEX index_epic_board_recent_visits_on_user_group_and_board ON boards_epic_board_recent_visits USING btree (user_id, group_id, epic_board_id); + 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); @@ -23150,6 +23594,8 @@ CREATE INDEX index_metrics_dashboard_annotations_on_timespan_end ON metrics_dash CREATE INDEX index_metrics_users_starred_dashboards_on_project_id ON metrics_users_starred_dashboards USING btree (project_id); +CREATE INDEX index_migration_jobs_on_migration_id_and_finished_at ON batched_background_migration_jobs USING btree (batched_background_migration_id, finished_at); + CREATE INDEX index_milestone_releases_on_release_id ON milestone_releases USING btree (release_id); CREATE INDEX index_milestones_on_description_trigram ON milestones USING gin (description gin_trgm_ops); @@ -23184,6 +23630,8 @@ CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON n CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id); +CREATE INDEX index_namespaces_id_parent_id_is_not_null ON namespaces USING btree (id) WHERE (parent_id IS NOT NULL); + CREATE INDEX index_namespaces_id_parent_id_is_null ON namespaces USING btree (id) WHERE (parent_id IS NULL); CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at); @@ -23288,8 +23736,14 @@ 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_oncall_schedule_escalation_rule ON incident_management_escalation_rules USING btree (oncall_schedule_id); + 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 UNIQUE INDEX index_on_policy_schedule_status_elapsed_time_escalation_rules ON incident_management_escalation_rules USING btree (policy_id, oncall_schedule_id, status, elapsed_time_seconds); + +CREATE UNIQUE INDEX index_on_project_id_escalation_policy_name_unique ON incident_management_escalation_policies USING btree (project_id, name); + 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)); @@ -23376,6 +23830,8 @@ CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_depend CREATE INDEX index_packages_events_on_package_id ON packages_events USING btree (package_id); +CREATE INDEX index_packages_helm_file_metadata_on_channel ON packages_helm_file_metadata USING btree (channel); + CREATE INDEX index_packages_maven_metadata_on_package_id_and_path ON packages_maven_metadata USING btree (package_id, path); CREATE INDEX index_packages_maven_metadata_on_path ON packages_maven_metadata USING btree (path); @@ -23964,6 +24420,10 @@ CREATE UNIQUE INDEX index_sop_configs_on_project_id ON security_orchestration_po 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_sop_schedules_on_sop_configuration_id ON security_orchestration_policy_rule_schedules USING btree (security_orchestration_policy_configuration_id); + +CREATE INDEX index_sop_schedules_on_user_id ON security_orchestration_policy_rule_schedules USING btree (user_id); + CREATE INDEX index_spam_logs_on_user_id ON spam_logs USING btree (user_id); CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id); @@ -23984,6 +24444,10 @@ CREATE INDEX index_sprints_on_title ON sprints USING btree (title); CREATE INDEX index_sprints_on_title_trigram ON sprints USING gin (title gin_trgm_ops); +CREATE INDEX index_status_check_responses_on_external_approval_rule_id ON status_check_responses USING btree (external_approval_rule_id); + +CREATE INDEX index_status_check_responses_on_merge_request_id ON status_check_responses USING btree (merge_request_id); + CREATE UNIQUE INDEX index_status_page_published_incidents_on_issue_id ON status_page_published_incidents USING btree (issue_id); CREATE INDEX index_status_page_settings_on_project_id ON status_page_settings USING btree (project_id); @@ -24014,12 +24478,20 @@ CREATE INDEX index_term_agreements_on_term_id ON term_agreements USING btree (te CREATE INDEX index_term_agreements_on_user_id ON term_agreements USING btree (user_id); +CREATE INDEX index_terraform_state_versions_failed_verification ON terraform_state_versions USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3); + +CREATE INDEX index_terraform_state_versions_needs_verification ON terraform_state_versions USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3)); + CREATE INDEX index_terraform_state_versions_on_ci_build_id ON terraform_state_versions USING btree (ci_build_id); CREATE INDEX index_terraform_state_versions_on_created_by_user_id ON terraform_state_versions USING btree (created_by_user_id); CREATE UNIQUE INDEX index_terraform_state_versions_on_state_id_and_version ON terraform_state_versions USING btree (terraform_state_id, version); +CREATE INDEX index_terraform_state_versions_on_verification_state ON terraform_state_versions USING btree (verification_state); + +CREATE INDEX index_terraform_state_versions_pending_verification ON terraform_state_versions USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0); + CREATE INDEX index_terraform_states_on_file_store ON terraform_states USING btree (file_store); CREATE INDEX index_terraform_states_on_locked_by_user_id ON terraform_states USING btree (locked_by_user_id); @@ -24036,6 +24508,8 @@ CREATE INDEX index_timelogs_on_merge_request_id ON timelogs USING btree (merge_r CREATE INDEX index_timelogs_on_note_id ON timelogs USING btree (note_id); +CREATE INDEX index_timelogs_on_project_id_and_spent_at ON timelogs USING btree (project_id, spent_at); + CREATE INDEX index_timelogs_on_spent_at ON timelogs USING btree (spent_at) WHERE (spent_at IS NOT NULL); CREATE INDEX index_timelogs_on_user_id ON timelogs USING btree (user_id); @@ -24136,6 +24610,8 @@ CREATE INDEX index_users_on_feed_token ON users USING btree (feed_token); CREATE INDEX index_users_on_group_view ON users USING btree (group_view); +CREATE INDEX index_users_on_id_and_last_activity_on_for_non_internal_active ON users USING btree (id, last_activity_on) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[NULL::integer, 6, 4])))); + CREATE INDEX index_users_on_incoming_email_token ON users USING btree (incoming_email_token); CREATE INDEX index_users_on_managing_group_id ON users USING btree (managing_group_id); @@ -24276,18 +24752,20 @@ CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id ON vulnerabili CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id_and_note_id ON vulnerability_user_mentions USING btree (vulnerability_id, note_id); -CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs USING btree (created_at, web_hook_id); +CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs_archived USING btree (created_at, web_hook_id); -CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs USING btree (web_hook_id); +CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs_archived USING btree (web_hook_id); -CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (created_at, web_hook_id); +CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs USING btree (created_at, web_hook_id); -CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (web_hook_id); +CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs USING btree (web_hook_id); CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHERE ((type)::text = 'GroupHook'::text); CREATE INDEX index_web_hooks_on_project_id ON web_hooks USING btree (project_id); +CREATE INDEX index_web_hooks_on_project_id_recent_failures ON web_hooks USING btree (project_id, recent_failures); + CREATE INDEX index_web_hooks_on_service_id ON web_hooks USING btree (service_id); CREATE INDEX index_web_hooks_on_type ON web_hooks USING btree (type); @@ -24354,6 +24832,10 @@ CREATE INDEX packages_packages_needs_verification ON packages_package_files USIN CREATE INDEX packages_packages_pending_verification ON packages_package_files USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0); +CREATE UNIQUE INDEX partial_index_bulk_import_exports_on_group_id_and_relation ON bulk_import_exports USING btree (group_id, relation) WHERE (group_id IS NOT NULL); + +CREATE UNIQUE INDEX partial_index_bulk_import_exports_on_project_id_and_relation ON bulk_import_exports USING btree (project_id, relation) WHERE (project_id IS NOT NULL); + CREATE INDEX partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs ON ci_builds USING btree (scheduled_at) WHERE ((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text)); CREATE INDEX partial_index_deployments_for_legacy_successful_deployments ON deployments USING btree (id) WHERE ((finished_at IS NULL) AND (status = 2)); @@ -24656,23 +25138,35 @@ 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_b99eb6998c AFTER INSERT OR DELETE OR UPDATE ON web_hook_logs FOR EACH ROW EXECUTE FUNCTION table_sync_function_29bc99d6db(); + +CREATE TRIGGER trigger_07c94931164e BEFORE INSERT OR UPDATE ON push_event_payloads FOR EACH ROW EXECUTE FUNCTION trigger_07c94931164e(); -CREATE TRIGGER trigger_07c94931164e BEFORE INSERT OR UPDATE ON push_event_payloads FOR EACH ROW EXECUTE PROCEDURE trigger_07c94931164e(); +CREATE TRIGGER trigger_21e7a2602957 BEFORE INSERT OR UPDATE ON ci_build_needs FOR EACH ROW EXECUTE FUNCTION trigger_21e7a2602957(); -CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE PROCEDURE trigger_69523443cc10(); +CREATE TRIGGER trigger_3f6129be01d2 BEFORE INSERT OR UPDATE ON ci_builds FOR EACH ROW EXECUTE FUNCTION trigger_3f6129be01d2(); -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(); +CREATE TRIGGER trigger_51ab7cef8934 BEFORE INSERT OR UPDATE ON ci_builds_runner_session FOR EACH ROW EXECUTE FUNCTION trigger_51ab7cef8934(); -CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); +CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_69523443cc10(); -CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); +CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_8485e97c00e3(); -CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.type)::text = 'ExternalWikiService'::text) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_wiki(); +CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION trigger_be1804f21693(); -CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON services FOR EACH ROW WHEN (((new.active = true) AND ((new.type)::text = 'ExternalWikiService'::text) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_wiki(); +CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE FUNCTION trigger_cf2f9e35f002(); -CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.type)::text = 'ExternalWikiService'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_wiki(); +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 FUNCTION set_has_external_issue_tracker(); + +CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker(); + +CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker(); + +CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.type)::text = 'ExternalWikiService'::text) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki(); + +CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON services FOR EACH ROW WHEN (((new.active = true) AND ((new.type)::text = 'ExternalWikiService'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki(); + +CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.type)::text = 'ExternalWikiService'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki(); ALTER TABLE ONLY chat_names ADD CONSTRAINT fk_00797a2bf9 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE; @@ -24719,6 +25213,9 @@ ALTER TABLE ONLY ci_unit_test_failures ALTER TABLE ONLY project_pages_metadata ADD CONSTRAINT fk_0fd5b22688 FOREIGN KEY (pages_deployment_id) REFERENCES pages_deployments(id) ON DELETE SET NULL; +ALTER TABLE ONLY status_check_responses + ADD CONSTRAINT fk_116e7e7369 FOREIGN KEY (external_approval_rule_id) REFERENCES external_approval_rules(id) ON DELETE CASCADE; + ALTER TABLE ONLY group_deletion_schedules ADD CONSTRAINT fk_11e3ebfcdd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -24746,6 +25243,9 @@ ALTER TABLE ONLY project_features ALTER TABLE ONLY ci_pipelines ADD CONSTRAINT fk_190998ef09 FOREIGN KEY (external_pull_request_id) REFERENCES external_pull_requests(id) ON DELETE SET NULL; +ALTER TABLE ONLY analytics_devops_adoption_segments + ADD CONSTRAINT fk_190a24754d FOREIGN KEY (display_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY user_details ADD CONSTRAINT fk_190e4fcc88 FOREIGN KEY (provisioned_by_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; @@ -24812,9 +25312,6 @@ ALTER TABLE ONLY approvals ALTER TABLE ONLY namespaces ADD CONSTRAINT fk_319256d87a FOREIGN KEY (file_template_project_id) REFERENCES projects(id) ON DELETE SET NULL; -ALTER TABLE ONLY merge_requests - ADD CONSTRAINT fk_3308fe130c FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL; - ALTER TABLE ONLY ci_group_variables ADD CONSTRAINT fk_33ae4d58d8 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -24833,11 +25330,14 @@ ALTER TABLE ONLY sprints ALTER TABLE ONLY push_event_payloads ADD CONSTRAINT fk_36c74129da FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE; +ALTER TABLE ONLY bulk_import_exports + ADD CONSTRAINT fk_39c726d3b5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_builds ADD CONSTRAINT fk_3a9eaa254d FOREIGN KEY (stage_id) REFERENCES ci_stages(id) ON DELETE CASCADE; ALTER TABLE ONLY issues - ADD CONSTRAINT fk_3b8c72ea56 FOREIGN KEY (sprint_id) REFERENCES sprints(id) ON DELETE CASCADE; + ADD CONSTRAINT fk_3b8c72ea56 FOREIGN KEY (sprint_id) REFERENCES sprints(id) ON DELETE SET NULL; ALTER TABLE ONLY epics ADD CONSTRAINT fk_3c1fd1cccc FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; @@ -24875,6 +25375,9 @@ ALTER TABLE ONLY alert_management_alerts ALTER TABLE ONLY path_locks ADD CONSTRAINT fk_5265c98f24 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY dast_site_profiles_pipelines + ADD CONSTRAINT fk_53849b0ad5 FOREIGN KEY (ci_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; + ALTER TABLE ONLY clusters_applications_prometheus ADD CONSTRAINT fk_557e773639 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; @@ -24962,6 +25465,9 @@ ALTER TABLE ONLY users ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_78a6492f68 FOREIGN KEY (repository_updated_event_id) REFERENCES geo_repository_updated_events(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_snapshots + ADD CONSTRAINT fk_78c9eac821 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY lists ADD CONSTRAINT fk_7a5553d60f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE; @@ -24981,7 +25487,7 @@ ALTER TABLE ONLY 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; + ADD CONSTRAINT fk_7e85395a64 FOREIGN KEY (sprint_id) REFERENCES sprints(id) ON DELETE SET NULL; ALTER TABLE ONLY merge_request_metrics ADD CONSTRAINT fk_7f28d925f3 FOREIGN KEY (merged_by_id) REFERENCES users(id) ON DELETE SET NULL; @@ -25028,8 +25534,8 @@ ALTER TABLE ONLY issues ALTER TABLE ONLY protected_branch_merge_access_levels ADD CONSTRAINT fk_8a3072ccb3 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; -ALTER TABLE ONLY timelogs - ADD CONSTRAINT fk_8d058cd571 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE; +ALTER TABLE ONLY bulk_import_exports + ADD CONSTRAINT fk_8c6f33cebe FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; ALTER TABLE ONLY releases ADD CONSTRAINT fk_8e4456f90f FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL; @@ -25202,6 +25708,9 @@ ALTER TABLE ONLY geo_event_log ALTER TABLE ONLY vulnerability_exports ADD CONSTRAINT fk_c3d3cb5d0f FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY timelogs + ADD CONSTRAINT fk_c49c83dd77 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_c4b1c1f66e FOREIGN KEY (repository_deleted_event_id) REFERENCES geo_repository_deleted_events(id) ON DELETE CASCADE; @@ -25226,6 +25735,9 @@ ALTER TABLE ONLY experiment_subjects ALTER TABLE ONLY todos ADD CONSTRAINT fk_ccf0373936 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY dast_site_profiles_pipelines + ADD CONSTRAINT fk_cf05cf8fe1 FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE; + ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_cff7185ad2 FOREIGN KEY (reset_checksum_event_id) REFERENCES geo_reset_checksum_events(id) ON DELETE CASCADE; @@ -25361,6 +25873,9 @@ ALTER TABLE ONLY boards ALTER TABLE ONLY ci_pipeline_variables ADD CONSTRAINT fk_f29c5f4380 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE; +ALTER TABLE ONLY status_check_responses + ADD CONSTRAINT fk_f3953d86c6 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; + ALTER TABLE ONLY design_management_designs_versions ADD CONSTRAINT fk_f4d25ba00c FOREIGN KEY (version_id) REFERENCES design_management_versions(id) ON DELETE CASCADE; @@ -25547,6 +26062,12 @@ ALTER TABLE ONLY analytics_cycle_analytics_project_stages ALTER TABLE ONLY packages_build_infos ADD CONSTRAINT fk_rails_17a9a0dffc FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL; +ALTER TABLE ONLY security_orchestration_policy_rule_schedules + ADD CONSTRAINT fk_rails_17ade83f17 FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE; + +ALTER TABLE ONLY incident_management_escalation_rules + ADD CONSTRAINT fk_rails_17dbea07a6 FOREIGN KEY (policy_id) REFERENCES incident_management_escalation_policies(id) ON DELETE CASCADE; + ALTER TABLE ONLY clusters_applications_jupyter ADD CONSTRAINT fk_rails_17df21c98c FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; @@ -25625,6 +26146,9 @@ ALTER TABLE ONLY service_desk_settings ALTER TABLE ONLY saml_group_links ADD CONSTRAINT fk_rails_22e312c530 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_finding_evidence_responses + ADD CONSTRAINT fk_rails_2390a09723 FOREIGN KEY (vulnerability_finding_evidence_id) REFERENCES vulnerability_finding_evidences(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_profiles ADD CONSTRAINT fk_rails_23cae5abe1 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(id) ON DELETE CASCADE; @@ -25655,6 +26179,9 @@ ALTER TABLE ONLY lfs_file_locks ALTER TABLE ONLY project_alerting_settings ADD CONSTRAINT fk_rails_27a84b407d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY user_credit_card_validations + ADD CONSTRAINT fk_rails_27ebc03cbf FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_site_validations ADD CONSTRAINT fk_rails_285c617324 FOREIGN KEY (dast_site_token_id) REFERENCES dast_site_tokens(id) ON DELETE CASCADE; @@ -26051,9 +26578,12 @@ ALTER TABLE ONLY operations_feature_flags_clients ALTER TABLE ONLY namespace_admin_notes ADD CONSTRAINT fk_rails_666166ea7b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; -ALTER TABLE ONLY web_hook_logs +ALTER TABLE ONLY web_hook_logs_archived ADD CONSTRAINT fk_rails_666826e111 FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_cycle_analytics_project_value_streams + ADD CONSTRAINT fk_rails_669f4ba293 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY jira_imports ADD CONSTRAINT fk_rails_675d38c03b FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE SET NULL; @@ -26105,6 +26635,9 @@ ALTER TABLE ONLY dast_scanner_profiles ALTER TABLE ONLY vulnerability_historical_statistics ADD CONSTRAINT fk_rails_72b73ed023 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_finding_evidence_requests + ADD CONSTRAINT fk_rails_72c87c8eb6 FOREIGN KEY (vulnerability_finding_evidence_id) REFERENCES vulnerability_finding_evidences(id) ON DELETE CASCADE; + ALTER TABLE ONLY slack_integrations ADD CONSTRAINT fk_rails_73db19721a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE; @@ -26153,6 +26686,9 @@ ALTER TABLE ONLY ci_subscriptions_projects ALTER TABLE ONLY terraform_states ADD CONSTRAINT fk_rails_78f54ca485 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_cycle_analytics_project_stages + ADD CONSTRAINT fk_rails_796a7dbc9c FOREIGN KEY (project_value_stream_id) REFERENCES analytics_cycle_analytics_project_value_streams(id) ON DELETE CASCADE; + ALTER TABLE ONLY software_license_policies ADD CONSTRAINT fk_rails_7a7a2a92de FOREIGN KEY (software_license_id) REFERENCES software_licenses(id) ON DELETE CASCADE; @@ -26294,6 +26830,9 @@ ALTER TABLE ONLY packages_rubygems_metadata ALTER TABLE ONLY packages_pypi_metadata ADD CONSTRAINT fk_rails_9698717cdd FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_recent_visits + ADD CONSTRAINT fk_rails_96c2c18642 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY packages_dependency_links ADD CONSTRAINT fk_rails_96ef1c00d3 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; @@ -26348,6 +26887,9 @@ ALTER TABLE ONLY resource_milestone_events ALTER TABLE ONLY namespace_root_storage_statistics ADD CONSTRAINT fk_rails_a0702c430b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY elastic_reindexing_slices + ADD CONSTRAINT fk_rails_a17d86aeb9 FOREIGN KEY (elastic_reindexing_subtask_id) REFERENCES elastic_reindexing_subtasks(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_aliases ADD CONSTRAINT fk_rails_a1804f74a7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -26372,6 +26914,9 @@ ALTER TABLE ONLY fork_network_members ALTER TABLE ONLY operations_feature_flag_scopes ADD CONSTRAINT fk_rails_a50a04d0a4 FOREIGN KEY (feature_flag_id) REFERENCES operations_feature_flags(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_helm_file_metadata + ADD CONSTRAINT fk_rails_a559865345 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE; + ALTER TABLE ONLY cluster_projects ADD CONSTRAINT fk_rails_a5a958bca1 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; @@ -26462,6 +27007,9 @@ ALTER TABLE ONLY issues_prometheus_alert_events ALTER TABLE ONLY merge_trains ADD CONSTRAINT fk_rails_b374b5225d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; +ALTER TABLE ONLY incident_management_escalation_rules + ADD CONSTRAINT fk_rails_b3c9c17bd4 FOREIGN KEY (oncall_schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE; + ALTER TABLE ONLY application_settings ADD CONSTRAINT fk_rails_b53e481273 FOREIGN KEY (custom_project_templates_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; @@ -26486,7 +27034,7 @@ ALTER TABLE ONLY approval_project_rules_users ALTER TABLE ONLY lists ADD CONSTRAINT fk_rails_baed5f39b7 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE; -ALTER TABLE web_hook_logs_part_0c5294f417 +ALTER TABLE web_hook_logs ADD CONSTRAINT fk_rails_bb3355782d FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE; ALTER TABLE ONLY security_findings @@ -26552,6 +27100,9 @@ ALTER TABLE ONLY pages_deployments ALTER TABLE ONLY merge_request_user_mentions ADD CONSTRAINT fk_rails_c440b9ea31 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_recent_visits + ADD CONSTRAINT fk_rails_c4dcba4a3e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_job_artifacts ADD CONSTRAINT fk_rails_c5137cb2c1 FOREIGN KEY (job_id) REFERENCES ci_builds(id) ON DELETE CASCADE; @@ -26594,6 +27145,9 @@ ALTER TABLE ONLY boards_epic_board_positions ALTER TABLE ONLY vulnerability_finding_links ADD CONSTRAINT fk_rails_cbdfde27ce FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; +ALTER TABLE ONLY clusters_integration_elasticstack + ADD CONSTRAINT fk_rails_cc5ba8f658 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues_self_managed_prometheus_alert_events ADD CONSTRAINT fk_rails_cc5d88bbb0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -26628,7 +27182,7 @@ ALTER TABLE ONLY pool_repositories ADD CONSTRAINT fk_rails_d2711daad4 FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL; ALTER TABLE ONLY web_hooks - ADD CONSTRAINT fk_rails_d35697648e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID; + ADD CONSTRAINT fk_rails_d35697648e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; ALTER TABLE ONLY group_group_links ADD CONSTRAINT fk_rails_d3a0488427 FOREIGN KEY (shared_group_id) REFERENCES namespaces(id) ON DELETE CASCADE; @@ -26681,6 +27235,9 @@ ALTER TABLE ONLY incident_management_oncall_shifts ALTER TABLE ONLY analytics_cycle_analytics_group_stages ADD CONSTRAINT fk_rails_dfb37c880d FOREIGN KEY (end_event_label_id) REFERENCES labels(id) ON DELETE CASCADE; +ALTER TABLE ONLY bulk_import_export_uploads + ADD CONSTRAINT fk_rails_dfbfb45eca FOREIGN KEY (export_id) REFERENCES bulk_import_exports(id) ON DELETE CASCADE; + ALTER TABLE ONLY label_priorities ADD CONSTRAINT fk_rails_e161058b0f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE; @@ -26705,6 +27262,9 @@ ALTER TABLE ONLY vulnerability_occurrence_identifiers ALTER TABLE ONLY serverless_domain_cluster ADD CONSTRAINT fk_rails_e59e868733 FOREIGN KEY (clusters_applications_knative_id) REFERENCES clusters_applications_knative(id) ON DELETE CASCADE; +ALTER TABLE ONLY incident_management_escalation_policies + ADD CONSTRAINT fk_rails_e5b513daa7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY vulnerability_external_issue_links ADD CONSTRAINT fk_rails_e5ba7f7b13 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL; @@ -26726,6 +27286,9 @@ ALTER TABLE ONLY draft_notes ALTER TABLE ONLY namespace_package_settings ADD CONSTRAINT fk_rails_e773444769 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY boards_epic_board_recent_visits + ADD CONSTRAINT fk_rails_e77911cf03 FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE; + ALTER TABLE ONLY dast_site_tokens ADD CONSTRAINT fk_rails_e84f721a8e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -26780,6 +27343,9 @@ ALTER TABLE ONLY label_priorities ALTER TABLE ONLY fork_network_members ADD CONSTRAINT fk_rails_efccadc4ec FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY security_orchestration_policy_rule_schedules + ADD CONSTRAINT fk_rails_efe1d9b133 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY prometheus_alerts ADD CONSTRAINT fk_rails_f0e8db86aa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -26879,12 +27445,18 @@ ALTER TABLE ONLY ci_builds_metadata ALTER TABLE ONLY services ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE CASCADE; +ALTER TABLE ONLY merge_requests + ADD CONSTRAINT fk_source_project FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL; + ALTER TABLE ONLY timelogs ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; ALTER TABLE ONLY timelogs ADD CONSTRAINT fk_timelogs_merge_requests_merge_request_id FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; +ALTER TABLE ONLY timelogs + ADD CONSTRAINT fk_timelogs_note_id FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE SET NULL; + ALTER TABLE ONLY u2f_registrations ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; |