diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /db/migrate | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'db/migrate')
949 files changed, 657 insertions, 18510 deletions
diff --git a/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb b/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb deleted file mode 100644 index 21520f86bf8..00000000000 --- a/db/migrate/20200102140148_add_expanded_environment_name_to_ci_build_metadata.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddExpandedEnvironmentNameToCiBuildMetadata < ActiveRecord::Migration[5.2] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def up - add_column :ci_builds_metadata, :expanded_environment_name, :string, limit: 255 - end - # rubocop:enable Migration/PreventStrings - - def down - remove_column :ci_builds_metadata, :expanded_environment_name - end -end diff --git a/db/migrate/20200102170221_add_storage_version_index_to_projects.rb b/db/migrate/20200102170221_add_storage_version_index_to_projects.rb deleted file mode 100644 index 8965b5eedb9..00000000000 --- a/db/migrate/20200102170221_add_storage_version_index_to_projects.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddStorageVersionIndexToProjects < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, :id, where: 'storage_version < 2 or storage_version IS NULL', name: 'index_on_id_partial_with_legacy_storage' - end - - def down - remove_concurrent_index :projects, :id, where: 'storage_version < 2 or storage_version IS NULL', name: 'index_on_id_partial_with_legacy_storage' - end -end diff --git a/db/migrate/20200103190741_add_column_for_instance_administrators_group.rb b/db/migrate/20200103190741_add_column_for_instance_administrators_group.rb deleted file mode 100644 index 5afc7dc6a4d..00000000000 --- a/db/migrate/20200103190741_add_column_for_instance_administrators_group.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddColumnForInstanceAdministratorsGroup < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :application_settings, :instance_administrators_group_id, :integer - end -end diff --git a/db/migrate/20200103192859_add_fk_for_instance_administrators_group.rb b/db/migrate/20200103192859_add_fk_for_instance_administrators_group.rb deleted file mode 100644 index 0ad37d6bd29..00000000000 --- a/db/migrate/20200103192859_add_fk_for_instance_administrators_group.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddFkForInstanceAdministratorsGroup < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key( - :application_settings, - :namespaces, - column: :instance_administrators_group_id, - on_delete: :nullify - ) - end - - def down - remove_foreign_key :application_settings, column: :instance_administrators_group_id - end -end diff --git a/db/migrate/20200103192914_add_index_for_instance_administrators_group.rb b/db/migrate/20200103192914_add_index_for_instance_administrators_group.rb deleted file mode 100644 index 703dcf5d0e3..00000000000 --- a/db/migrate/20200103192914_add_index_for_instance_administrators_group.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexForInstanceAdministratorsGroup < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :application_settings, :instance_administrators_group_id - end - - def down - remove_concurrent_index :application_settings, :instance_administrators_group_id - end -end diff --git a/db/migrate/20200103195205_add_autoclose_referenced_issues_to_projects.rb b/db/migrate/20200103195205_add_autoclose_referenced_issues_to_projects.rb deleted file mode 100644 index db473434205..00000000000 --- a/db/migrate/20200103195205_add_autoclose_referenced_issues_to_projects.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddAutocloseReferencedIssuesToProjects < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :projects, :autoclose_referenced_issues, :boolean # rubocop:disable Migration/AddColumnsToWideTables - end -end diff --git a/db/migrate/20200104113850_add_forking_access_level_to_project_feature.rb b/db/migrate/20200104113850_add_forking_access_level_to_project_feature.rb deleted file mode 100644 index 2c5f764ebf3..00000000000 --- a/db/migrate/20200104113850_add_forking_access_level_to_project_feature.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddForkingAccessLevelToProjectFeature < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :project_features, :forking_access_level, :integer - end -end diff --git a/db/migrate/20200106085831_add_timestamps_to_packages_tags.rb b/db/migrate/20200106085831_add_timestamps_to_packages_tags.rb deleted file mode 100644 index 2720d9b3297..00000000000 --- a/db/migrate/20200106085831_add_timestamps_to_packages_tags.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddTimestampsToPackagesTags < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # We disable these cops here because adding this column is safe. The table does not - # have any data in it. - # rubocop: disable Migration/AddIndex - def up - add_timestamps_with_timezone(:packages_tags, null: false) - add_index(:packages_tags, [:package_id, :updated_at], order: { updated_at: :desc }) - end - - # We disable these cops here because adding this column is safe. The table does not - # have any data in it. - # rubocop: disable Migration/RemoveIndex - def down - remove_index(:packages_tags, [:package_id, :updated_at]) - remove_timestamps(:packages_tags) - end -end diff --git a/db/migrate/20200107172020_add_timestamp_softwarelicensespolicy.rb b/db/migrate/20200107172020_add_timestamp_softwarelicensespolicy.rb deleted file mode 100644 index 0d62f3051ce..00000000000 --- a/db/migrate/20200107172020_add_timestamp_softwarelicensespolicy.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddTimestampSoftwarelicensespolicy < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - add_timestamps_with_timezone(:software_license_policies, null: true) - end - - def down - remove_timestamps(:software_license_policies) - end -end diff --git a/db/migrate/20200108100603_update_project_hooks_limit.rb b/db/migrate/20200108100603_update_project_hooks_limit.rb deleted file mode 100644 index 91533b69afa..00000000000 --- a/db/migrate/20200108100603_update_project_hooks_limit.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class UpdateProjectHooksLimit < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - return unless Gitlab.com? - - create_or_update_plan_limit('project_hooks', 'free', 100) - create_or_update_plan_limit('project_hooks', 'bronze', 100) - create_or_update_plan_limit('project_hooks', 'silver', 100) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('project_hooks', 'free', 10) - create_or_update_plan_limit('project_hooks', 'bronze', 20) - create_or_update_plan_limit('project_hooks', 'silver', 30) - end -end diff --git a/db/migrate/20200108155731_create_indexes_for_project_api_created_at_order.rb b/db/migrate/20200108155731_create_indexes_for_project_api_created_at_order.rb deleted file mode 100644 index 2356f08b681..00000000000 --- a/db/migrate/20200108155731_create_indexes_for_project_api_created_at_order.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CreateIndexesForProjectApiCreatedAtOrder < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, %i(visibility_level created_at id), order: { id: :desc }, name: 'index_projects_on_visibility_level_created_at_id_desc' - add_concurrent_index :projects, %i(visibility_level created_at id), order: { created_at: :desc, id: :desc }, name: 'index_projects_on_visibility_level_created_at_desc_id_desc' - remove_concurrent_index_by_name :projects, 'index_projects_on_visibility_level_and_created_at_and_id' - end - - def down - add_concurrent_index :projects, %i(visibility_level created_at id), name: 'index_projects_on_visibility_level_and_created_at_and_id' - remove_concurrent_index_by_name :projects, 'index_projects_on_visibility_level_created_at_id_desc' - remove_concurrent_index_by_name :projects, 'index_projects_on_visibility_level_created_at_desc_id_desc' - end -end diff --git a/db/migrate/20200108233040_remove_index_project_mirror_data_on_jid.rb b/db/migrate/20200108233040_remove_index_project_mirror_data_on_jid.rb deleted file mode 100644 index 86a69275cb7..00000000000 --- a/db/migrate/20200108233040_remove_index_project_mirror_data_on_jid.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexProjectMirrorDataOnJid < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :project_mirror_data, :jid - end - - def down - add_concurrent_index :project_mirror_data, :jid - end -end diff --git a/db/migrate/20200109030418_add_sorting_index_to_packages.rb b/db/migrate/20200109030418_add_sorting_index_to_packages.rb deleted file mode 100644 index 989f3de3c04..00000000000 --- a/db/migrate/20200109030418_add_sorting_index_to_packages.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSortingIndexToPackages < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_packages, [:project_id, :created_at] - add_concurrent_index :packages_packages, [:project_id, :version] - add_concurrent_index :packages_packages, [:project_id, :package_type] - end - - def down - remove_concurrent_index :packages_packages, [:project_id, :created_at] - remove_concurrent_index :packages_packages, [:project_id, :version] - remove_concurrent_index :packages_packages, [:project_id, :package_type] - end -end diff --git a/db/migrate/20200109085206_create_approval_project_rules_protected_branches.rb b/db/migrate/20200109085206_create_approval_project_rules_protected_branches.rb deleted file mode 100644 index 4e75f7d41fd..00000000000 --- a/db/migrate/20200109085206_create_approval_project_rules_protected_branches.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreateApprovalProjectRulesProtectedBranches < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - create_table :approval_project_rules_protected_branches, id: false do |t| - t.references :approval_project_rule, - null: false, - index: false, - foreign_key: { on_delete: :cascade } - t.references :protected_branch, - null: false, - index: { name: 'index_approval_project_rules_protected_branches_pb_id' }, - foreign_key: { on_delete: :cascade } - t.index [:approval_project_rule_id, :protected_branch_id], name: 'index_approval_project_rules_protected_branches_unique', unique: true, using: :btree - end - end -end diff --git a/db/migrate/20200109233938_remove_project_id_index_from_packages.rb b/db/migrate/20200109233938_remove_project_id_index_from_packages.rb deleted file mode 100644 index e806c5d5a18..00000000000 --- a/db/migrate/20200109233938_remove_project_id_index_from_packages.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveProjectIdIndexFromPackages < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :packages_packages, [:project_id] - end - - def down - add_concurrent_index :packages_packages, [:project_id] - end -end diff --git a/db/migrate/20200110089001_fix_invalid_epic_sourcing_milestone_ids.rb b/db/migrate/20200110089001_fix_invalid_epic_sourcing_milestone_ids.rb deleted file mode 100644 index 04f65c3a810..00000000000 --- a/db/migrate/20200110089001_fix_invalid_epic_sourcing_milestone_ids.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class FixInvalidEpicSourcingMilestoneIds < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def up - nullify_invalid_data(:start_date_sourcing_milestone_id) - nullify_invalid_data(:due_date_sourcing_milestone_id) - end - - def down - # no-op - end - - private - - def nullify_invalid_data(column_name) - execute(<<-SQL.squish) - UPDATE epics - SET #{column_name} = null - WHERE #{column_name} NOT IN (SELECT id FROM milestones); - SQL - end -end diff --git a/db/migrate/20200110090153_validate_foreign_key_epic_start_date_sourcing_milestone.rb b/db/migrate/20200110090153_validate_foreign_key_epic_start_date_sourcing_milestone.rb deleted file mode 100644 index 26ddf44cfeb..00000000000 --- a/db/migrate/20200110090153_validate_foreign_key_epic_start_date_sourcing_milestone.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class ValidateForeignKeyEpicStartDateSourcingMilestone < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - validate_foreign_key(:epics, :start_date_sourcing_milestone_id) - end - - def down - # no-op - end -end diff --git a/db/migrate/20200110144316_add_indexes_for_projects_api.rb b/db/migrate/20200110144316_add_indexes_for_projects_api.rb deleted file mode 100644 index 6b0ca252456..00000000000 --- a/db/migrate/20200110144316_add_indexes_for_projects_api.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesForProjectsApi < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - COLUMNS = %i(created_at last_activity_at updated_at name path) - - def up - COLUMNS.each do |column| - add_concurrent_index :projects, [column, :id], where: 'visibility_level = 20', order: { id: :desc }, name: "index_projects_api_vis20_#{column}_id_desc" - add_concurrent_index :projects, [column, :id], where: 'visibility_level = 20', name: "index_projects_api_vis20_#{column}" - end - - remove_concurrent_index_by_name :projects, 'index_projects_on_visibility_level_created_at_id_desc' - remove_concurrent_index_by_name :projects, 'index_projects_on_visibility_level_created_at_desc_id_desc' - end - - def down - add_concurrent_index :projects, %i(visibility_level created_at id), order: { id: :desc }, name: 'index_projects_on_visibility_level_created_at_id_desc' - add_concurrent_index :projects, %i(visibility_level created_at id), order: { created_at: :desc, id: :desc }, name: 'index_projects_on_visibility_level_created_at_desc_id_desc' - - COLUMNS.each do |column| - remove_concurrent_index_by_name :projects, "index_projects_api_vis20_#{column}_id_desc" - remove_concurrent_index_by_name :projects, "index_projects_api_vis20_#{column}" - end - end -end diff --git a/db/migrate/20200110203532_validate_foreign_key_epic_due_date_sourcing_milestone.rb b/db/migrate/20200110203532_validate_foreign_key_epic_due_date_sourcing_milestone.rb deleted file mode 100644 index 2ff48715068..00000000000 --- a/db/migrate/20200110203532_validate_foreign_key_epic_due_date_sourcing_milestone.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class ValidateForeignKeyEpicDueDateSourcingMilestone < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - validate_foreign_key(:epics, :due_date_sourcing_milestone_id) - end - - def down - # no-op - end -end diff --git a/db/migrate/20200113133352_add_indexes_for_projects_api_authenticated.rb b/db/migrate/20200113133352_add_indexes_for_projects_api_authenticated.rb deleted file mode 100644 index 53d317b3321..00000000000 --- a/db/migrate/20200113133352_add_indexes_for_projects_api_authenticated.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesForProjectsApiAuthenticated < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - COLUMNS = %i(updated_at name) - - def up - add_concurrent_index :projects, %i(created_at id), order: { id: :desc }, name: 'index_projects_api_created_at_id_desc' - - add_concurrent_index :projects, %i(last_activity_at id), name: 'index_projects_on_last_activity_at_and_id' - remove_concurrent_index :projects, :last_activity_at - add_concurrent_index :projects, %i(last_activity_at id), order: { id: :desc }, name: 'index_projects_api_last_activity_at_id_desc' - - add_concurrent_index :projects, %i(path id), name: 'index_projects_on_path_and_id' - remove_concurrent_index_by_name :projects, 'index_projects_on_path' - add_concurrent_index :projects, %i(path id), order: { id: :desc }, name: 'index_projects_api_path_id_desc' - - COLUMNS.each do |column| - add_concurrent_index :projects, [column, :id], name: "index_projects_on_#{column}_and_id" - add_concurrent_index :projects, [column, :id], order: { id: :desc }, name: "index_projects_api_#{column}_id_desc" - end - end - - def down - remove_concurrent_index_by_name :projects, 'index_projects_api_created_at_id_desc' - - remove_concurrent_index_by_name :projects, 'index_projects_on_last_activity_at_and_id' - add_concurrent_index :projects, :last_activity_at, name: 'index_projects_on_last_activity_at' - remove_concurrent_index_by_name :projects, 'index_projects_api_last_activity_at_id_desc' - - remove_concurrent_index_by_name :projects, 'index_projects_on_path_and_id' - add_concurrent_index :projects, :path, name: 'index_projects_on_path' - remove_concurrent_index_by_name :projects, 'index_projects_api_path_id_desc' - - COLUMNS.each do |column| - remove_concurrent_index_by_name :projects, "index_projects_on_#{column}_and_id" - remove_concurrent_index_by_name :projects, "index_projects_api_#{column}_id_desc" - end - end -end diff --git a/db/migrate/20200114140305_add_fields_to_application_settings_for_merge_requests_approvals.rb b/db/migrate/20200114140305_add_fields_to_application_settings_for_merge_requests_approvals.rb deleted file mode 100644 index 5e035f91f24..00000000000 --- a/db/migrate/20200114140305_add_fields_to_application_settings_for_merge_requests_approvals.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddFieldsToApplicationSettingsForMergeRequestsApprovals < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def up - add_column(:application_settings, - :disable_overriding_approvers_per_merge_request, - :boolean, - default: false, - null: false) - add_column(:application_settings, - :prevent_merge_requests_author_approval, - :boolean, - default: false, - null: false) - add_column(:application_settings, - :prevent_merge_requests_committers_approval, - :boolean, - default: false, - null: false) - end - - def down - remove_column(:application_settings, :disable_overriding_approvers_per_merge_request) - remove_column(:application_settings, :prevent_merge_requests_author_approval) - remove_column(:application_settings, :prevent_merge_requests_committers_approval) - end -end diff --git a/db/migrate/20200114204949_add_index_to_sentry_issues_sentry_issue_identifier.rb b/db/migrate/20200114204949_add_index_to_sentry_issues_sentry_issue_identifier.rb deleted file mode 100644 index 05b9e6d5958..00000000000 --- a/db/migrate/20200114204949_add_index_to_sentry_issues_sentry_issue_identifier.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToSentryIssuesSentryIssueIdentifier < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :sentry_issues, :sentry_issue_identifier - end - - def down - remove_concurrent_index :sentry_issues, :sentry_issue_identifier - end -end diff --git a/db/migrate/20200115135132_add_retry_count_and_group_id_to_import_failures.rb b/db/migrate/20200115135132_add_retry_count_and_group_id_to_import_failures.rb deleted file mode 100644 index 8f62aaba60e..00000000000 --- a/db/migrate/20200115135132_add_retry_count_and_group_id_to_import_failures.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddRetryCountAndGroupIdToImportFailures < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :import_failures, :retry_count, :integer - add_column :import_failures, :group_id, :integer - change_column_null(:import_failures, :project_id, true) - end -end diff --git a/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb b/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb deleted file mode 100644 index c7f2354440b..00000000000 --- a/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddGroupIndexAndFkToImportFailures < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - GROUP_INDEX = 'index_import_failures_on_group_id_not_null' - - disable_ddl_transaction! - - def up - add_concurrent_index(:import_failures, :group_id, where: 'group_id IS NOT NULL', name: GROUP_INDEX) - - add_concurrent_foreign_key(:import_failures, :namespaces, column: :group_id) - end - - def down - remove_foreign_key(:import_failures, column: :group_id) - - remove_concurrent_index_by_name(:import_failures, GROUP_INDEX) - end -end diff --git a/db/migrate/20200116051619_drop_background_migration_jobs.rb b/db/migrate/20200116051619_drop_background_migration_jobs.rb deleted file mode 100644 index f492ec0af9d..00000000000 --- a/db/migrate/20200116051619_drop_background_migration_jobs.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class DropBackgroundMigrationJobs < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications' - QUEUE = 'background_migration' - - def up - Sidekiq::Queue.new(QUEUE).each do |job| - klass, project_id, *should_be_empty = job.args - next unless klass == DROPPED_JOB_CLASS && project_id.is_a?(Integer) && should_be_empty.empty? - - job.delete - end - end -end diff --git a/db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb b/db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb deleted file mode 100644 index 5ed797e33a3..00000000000 --- a/db/migrate/20200116175538_update_timestamp_softwarelicensespolicy.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class UpdateTimestampSoftwarelicensespolicy < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - time = Time.zone.now - - update_column_in_batches(:software_license_policies, :created_at, time) do |table, query| - query.where(table[:created_at].eq(nil)) - end - - update_column_in_batches(:software_license_policies, :updated_at, time) do |table, query| - query.where(table[:updated_at].eq(nil)) - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20200117112554_update_project_index_to_import_failures.rb b/db/migrate/20200117112554_update_project_index_to_import_failures.rb deleted file mode 100644 index 888a9bec778..00000000000 --- a/db/migrate/20200117112554_update_project_index_to_import_failures.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class UpdateProjectIndexToImportFailures < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - PROJECT_INDEX_OLD = 'index_import_failures_on_project_id' - PROJECT_INDEX_NEW = 'index_import_failures_on_project_id_not_null' - - disable_ddl_transaction! - - def up - add_concurrent_index(:import_failures, :project_id, where: 'project_id IS NOT NULL', name: PROJECT_INDEX_NEW) - remove_concurrent_index_by_name(:import_failures, PROJECT_INDEX_OLD) - end - - def down - add_concurrent_index(:import_failures, :project_id, name: PROJECT_INDEX_OLD) - remove_concurrent_index_by_name(:import_failures, PROJECT_INDEX_NEW) - end -end diff --git a/db/migrate/20200117194830_add_iid_to_operations_feature_flags.rb b/db/migrate/20200117194830_add_iid_to_operations_feature_flags.rb deleted file mode 100644 index b18d9788b9f..00000000000 --- a/db/migrate/20200117194830_add_iid_to_operations_feature_flags.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddIidToOperationsFeatureFlags < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def up - add_column :operations_feature_flags, :iid, :integer - end - - def down - remove_column :operations_feature_flags, :iid - end -end diff --git a/db/migrate/20200117194840_add_index_on_operations_feature_flags_iid.rb b/db/migrate/20200117194840_add_index_on_operations_feature_flags_iid.rb deleted file mode 100644 index 67dedb56ec1..00000000000 --- a/db/migrate/20200117194840_add_index_on_operations_feature_flags_iid.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnOperationsFeatureFlagsIid < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :operations_feature_flags, [:project_id, :iid], unique: true - end - - def down - remove_concurrent_index :operations_feature_flags, [:project_id, :iid] - end -end diff --git a/db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb b/db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb deleted file mode 100644 index 1da96b470ef..00000000000 --- a/db/migrate/20200121132641_update_timestamp_softwarelicensespolicy_not_null.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class UpdateTimestampSoftwarelicensespolicyNotNull < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - change_column_null(:software_license_policies, :created_at, false) - change_column_null(:software_license_policies, :updated_at, false) - end -end diff --git a/db/migrate/20200121192942_create_geo_events.rb b/db/migrate/20200121192942_create_geo_events.rb deleted file mode 100644 index 0c885e8524c..00000000000 --- a/db/migrate/20200121192942_create_geo_events.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateGeoEvents < ActiveRecord::Migration[5.2] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :geo_events do |t| - t.string :replicable_name, limit: 255, null: false - t.string :event_name, limit: 255, null: false - t.jsonb :payload, default: {}, null: false - t.datetime_with_timezone :created_at, null: false - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200121194000_add_geo_event_id_to_geo_event_log.rb b/db/migrate/20200121194000_add_geo_event_id_to_geo_event_log.rb deleted file mode 100644 index 720995164b2..00000000000 --- a/db/migrate/20200121194000_add_geo_event_id_to_geo_event_log.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddGeoEventIdToGeoEventLog < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :geo_event_log, :geo_event_id, :integer - end -end diff --git a/db/migrate/20200121194048_add_geo_event_id_index_to_geo_event_log.rb b/db/migrate/20200121194048_add_geo_event_id_index_to_geo_event_log.rb deleted file mode 100644 index 9b0ec12c959..00000000000 --- a/db/migrate/20200121194048_add_geo_event_id_index_to_geo_event_log.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddGeoEventIdIndexToGeoEventLog < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :geo_event_log, :geo_event_id, - where: "(geo_event_id IS NOT NULL)", - using: :btree, - name: 'index_geo_event_log_on_geo_event_id' - end - - def down - remove_concurrent_index :geo_event_log, :geo_event_id, name: 'index_geo_event_log_on_geo_event_id' - end -end diff --git a/db/migrate/20200121194154_add_geo_events_foreign_key.rb b/db/migrate/20200121194154_add_geo_events_foreign_key.rb deleted file mode 100644 index b5e16e22989..00000000000 --- a/db/migrate/20200121194154_add_geo_events_foreign_key.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddGeoEventsForeignKey < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :geo_event_log, :geo_events, - column: :geo_event_id, - name: 'fk_geo_event_log_on_geo_event_id', - on_delete: :cascade - end - - def down - remove_foreign_key_without_error :geo_event_log, column: :geo_event_id, name: 'fk_geo_event_log_on_geo_event_id' - end -end diff --git a/db/migrate/20200121200203_create_group_deploy_tokens.rb b/db/migrate/20200121200203_create_group_deploy_tokens.rb deleted file mode 100644 index 55b30745fcf..00000000000 --- a/db/migrate/20200121200203_create_group_deploy_tokens.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateGroupDeployTokens < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - create_table :group_deploy_tokens do |t| - t.timestamps_with_timezone null: false - - t.references :group, index: false, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade } - t.references :deploy_token, null: false, foreign_key: { on_delete: :cascade } - - t.index [:group_id, :deploy_token_id], unique: true, name: 'index_group_deploy_tokens_on_group_and_deploy_token_ids' - end - end -end diff --git a/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb b/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb deleted file mode 100644 index 99459199709..00000000000 --- a/db/migrate/20200122161638_add_deploy_token_type_to_deploy_tokens.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddDeployTokenTypeToDeployTokens < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - - DOWNTIME = false - - def up - add_column_with_default :deploy_tokens, :deploy_token_type, :integer, default: 2, limit: 2, allow_null: false # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column :deploy_tokens, :deploy_token_type - end -end diff --git a/db/migrate/20200123040535_add_multi_column_index_on_lfs_objects_projects.rb b/db/migrate/20200123040535_add_multi_column_index_on_lfs_objects_projects.rb deleted file mode 100644 index 36ccfa4743e..00000000000 --- a/db/migrate/20200123040535_add_multi_column_index_on_lfs_objects_projects.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddMultiColumnIndexOnLfsObjectsProjects < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :lfs_objects_projects, [:project_id, :lfs_object_id] - end - - def down - remove_concurrent_index :lfs_objects_projects, [:project_id, :lfs_object_id] - end -end diff --git a/db/migrate/20200123045415_remove_project_id_index_on_lfs_objects_projects.rb b/db/migrate/20200123045415_remove_project_id_index_on_lfs_objects_projects.rb deleted file mode 100644 index 540383e8808..00000000000 --- a/db/migrate/20200123045415_remove_project_id_index_on_lfs_objects_projects.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveProjectIdIndexOnLfsObjectsProjects < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :lfs_objects_projects, :project_id - end - - def down - add_concurrent_index :lfs_objects_projects, :project_id - end -end diff --git a/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb b/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb deleted file mode 100644 index 18fd349df2a..00000000000 --- a/db/migrate/20200123090839_remove_analytics_repository_table_fks_on_projects.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class RemoveAnalyticsRepositoryTableFksOnProjects < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # Requires ExclusiveLock on all tables. analytics_* tables are empty - with_lock_retries do - remove_foreign_key_if_exists(:analytics_repository_files, :projects) - end - - with_lock_retries do - remove_foreign_key_if_exists(:analytics_repository_file_edits, :projects) if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment - end - - with_lock_retries do - remove_foreign_key_if_exists(:analytics_repository_file_commits, :projects) - end - end - - def down - add_concurrent_foreign_key(:analytics_repository_files, :projects, column: :project_id, on_delete: :cascade) - add_concurrent_foreign_key(:analytics_repository_file_edits, :projects, column: :project_id, on_delete: :cascade) - add_concurrent_foreign_key(:analytics_repository_file_commits, :projects, column: :project_id, on_delete: :cascade) - end -end diff --git a/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb b/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb deleted file mode 100644 index a436ad8d529..00000000000 --- a/db/migrate/20200123091422_remove_analytics_repository_files_fk_on_other_analytics_tables.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class RemoveAnalyticsRepositoryFilesFkOnOtherAnalyticsTables < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # Requires ExclusiveLock on all tables. analytics_* tables are empty - with_lock_retries do - remove_foreign_key_if_exists(:analytics_repository_file_edits, :analytics_repository_files) if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment - end - - with_lock_retries do - remove_foreign_key_if_exists(:analytics_repository_file_commits, :analytics_repository_files) - end - end - - def down - add_concurrent_foreign_key(:analytics_repository_file_edits, :analytics_repository_files, column: :analytics_repository_file_id, on_delete: :cascade) - add_concurrent_foreign_key(:analytics_repository_file_commits, :analytics_repository_files, column: :analytics_repository_file_id, on_delete: :cascade) - end -end diff --git a/db/migrate/20200123091622_drop_analytics_repository_files_table.rb b/db/migrate/20200123091622_drop_analytics_repository_files_table.rb deleted file mode 100644 index ed6746165a8..00000000000 --- a/db/migrate/20200123091622_drop_analytics_repository_files_table.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class DropAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - # Requires ExclusiveLock on the table. Not in use, no records, no FKs. - # rubocop:disable Migration/DropTable - drop_table :analytics_repository_files - # rubocop:enable Migration/DropTable - end - - def down - create_table :analytics_repository_files do |t| - t.bigint :project_id, null: false - t.string :file_path, limit: 4096, null: false - end - - add_index :analytics_repository_files, [:project_id, :file_path], unique: true - end -end diff --git a/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb b/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb deleted file mode 100644 index 2eb10a9056d..00000000000 --- a/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class DropAnalyticsRepositoryFileCommitsTable < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - # Requires ExclusiveLock on the table. Not in use, no records, no FKs. - # rubocop:disable Migration/DropTable - drop_table :analytics_repository_file_commits - # rubocop:enable Migration/DropTable - end - - def down - create_table :analytics_repository_file_commits do |t| - t.bigint :analytics_repository_file_id, null: false - t.index :analytics_repository_file_id, name: 'index_analytics_repository_file_commits_file_id' - t.bigint :project_id, null: false - t.date :committed_date, null: false - t.integer :commit_count, limit: 2, null: false - end - - add_index :analytics_repository_file_commits, - [:project_id, :committed_date, :analytics_repository_file_id], - name: 'index_file_commits_on_committed_date_file_id_and_project_id', - unique: true - end -end diff --git a/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb b/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb deleted file mode 100644 index e4bdb6f6ec2..00000000000 --- a/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class DropAnalyticsRepositoryFileEditsTable < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - # Requires ExclusiveLock on the table. Not in use, no records, no FKs. - # rubocop:disable Migration/DropTable - drop_table :analytics_repository_file_edits if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment - # rubocop:enable Migration/DropTable - end - - def down - create_table :analytics_repository_file_edits do |t| - t.bigint :project_id, null: false - t.index :project_id - t.bigint :analytics_repository_file_id, null: false - t.date :committed_date, null: false - t.integer :num_edits, null: false, default: 0 - end - - add_index :analytics_repository_file_edits, - [:analytics_repository_file_id, :committed_date, :project_id], - name: 'index_file_edits_on_committed_date_file_id_and_project_id', - unique: true - end -end diff --git a/db/migrate/20200124053531_add_source_to_import_failures.rb b/db/migrate/20200124053531_add_source_to_import_failures.rb deleted file mode 100644 index 2ca0bcba09f..00000000000 --- a/db/migrate/20200124053531_add_source_to_import_failures.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddSourceToImportFailures < ActiveRecord::Migration[5.2] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - add_column :import_failures, :source, :string, limit: 128 - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200124143014_add_restrict_deployment_order_to_project_ci_cd_settings.rb b/db/migrate/20200124143014_add_restrict_deployment_order_to_project_ci_cd_settings.rb deleted file mode 100644 index 6a222ce8d51..00000000000 --- a/db/migrate/20200124143014_add_restrict_deployment_order_to_project_ci_cd_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddRestrictDeploymentOrderToProjectCiCdSettings < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :project_ci_cd_settings, :forward_deployment_enabled, :boolean - end -end diff --git a/db/migrate/20200128105731_add_duration_to_merge_trains.rb b/db/migrate/20200128105731_add_duration_to_merge_trains.rb deleted file mode 100644 index a7aacaba5e1..00000000000 --- a/db/migrate/20200128105731_add_duration_to_merge_trains.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddDurationToMergeTrains < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :merge_trains, :merged_at, :datetime_with_timezone - add_column :merge_trains, :duration, :integer - end -end diff --git a/db/migrate/20200128141125_add_index_web_hooks_on_group_id.rb b/db/migrate/20200128141125_add_index_web_hooks_on_group_id.rb deleted file mode 100644 index 8c7f6426587..00000000000 --- a/db/migrate/20200128141125_add_index_web_hooks_on_group_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexWebHooksOnGroupId < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :web_hooks, :group_id, where: "type = 'GroupHook'" - end - - def down - remove_concurrent_index :web_hooks, :group_id, where: "type = 'GroupHook'" - end -end diff --git a/db/migrate/20200128184209_add_usage_to_pages_domains.rb b/db/migrate/20200128184209_add_usage_to_pages_domains.rb deleted file mode 100644 index 292490078cd..00000000000 --- a/db/migrate/20200128184209_add_usage_to_pages_domains.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddUsageToPagesDomains < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - PAGES_USAGE = 0 - - disable_ddl_transaction! - - def up - add_column_with_default :pages_domains, :usage, :integer, limit: 2, default: PAGES_USAGE, allow_null: false # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column :pages_domains, :usage - end -end diff --git a/db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb b/db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb deleted file mode 100644 index 2f13567c540..00000000000 --- a/db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class UpdateIndexesOfPagesDomainsAddUsageDomainWildcardRemoveDomain < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :pages_domains, :usage - add_concurrent_index :pages_domains, [:domain, :wildcard], unique: true - remove_concurrent_index :pages_domains, :domain - end - - def down - remove_concurrent_index :pages_domains, :usage - remove_concurrent_index :pages_domains, [:domain, :wildcard] - add_concurrent_index :pages_domains, :domain, unique: true - end -end diff --git a/db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb b/db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb deleted file mode 100644 index 74d9827e370..00000000000 --- a/db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RenamePagesDomainsDomainTypeToScope < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - rename_column_concurrently :pages_domains, :domain_type, :scope - end - - def down - undo_rename_column_concurrently :pages_domains, :domain_type, :scope - end -end diff --git a/db/migrate/20200129133716_add_resource_milestone_events_table.rb b/db/migrate/20200129133716_add_resource_milestone_events_table.rb deleted file mode 100644 index 681190a8744..00000000000 --- a/db/migrate/20200129133716_add_resource_milestone_events_table.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class AddResourceMilestoneEventsTable < ActiveRecord::Migration[5.2] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - def change - create_table :resource_milestone_events, id: :bigserial do |t| - t.references :user, null: false, foreign_key: { on_delete: :nullify }, - index: { name: 'index_resource_milestone_events_on_user_id' } - t.references :issue, null: true, foreign_key: { on_delete: :cascade }, - index: { name: 'index_resource_milestone_events_on_issue_id' } - t.references :merge_request, null: true, foreign_key: { on_delete: :cascade }, - index: { name: 'index_resource_milestone_events_on_merge_request_id' } - t.references :milestone, foreign_key: { on_delete: :cascade }, - index: { name: 'index_resource_milestone_events_on_milestone_id' } - - t.integer :action, limit: 2, null: false - t.integer :state, limit: 2, null: false - t.integer :cached_markdown_version - t.text :reference - t.text :reference_html - t.datetime_with_timezone :created_at, null: false - end - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200129172428_add_index_on_audit_events_id_desc.rb b/db/migrate/20200129172428_add_index_on_audit_events_id_desc.rb deleted file mode 100644 index b9182c99ebf..00000000000 --- a/db/migrate/20200129172428_add_index_on_audit_events_id_desc.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnAuditEventsIdDesc < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - OLD_INDEX_NAME = 'index_audit_events_on_entity_id_and_entity_type' - NEW_INDEX_NAME = 'index_audit_events_on_entity_id_and_entity_type_and_id_desc' - - disable_ddl_transaction! - - def up - add_concurrent_index :audit_events, [:entity_id, :entity_type, :id], name: NEW_INDEX_NAME, - order: { entity_id: :asc, entity_type: :asc, id: :desc } - - remove_concurrent_index_by_name :audit_events, OLD_INDEX_NAME - end - - def down - add_concurrent_index :audit_events, [:entity_id, :entity_type], name: OLD_INDEX_NAME - - remove_concurrent_index_by_name :audit_events, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb b/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb deleted file mode 100644 index 81764aefe7c..00000000000 --- a/db/migrate/20200130134335_add_cert_and_key_to_serverless_domain_cluster.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddCertAndKeyToServerlessDomainCluster < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - # rubocop:disable Migration/AddLimitToTextColumns - def change - add_column :serverless_domain_cluster, :encrypted_key, :text - add_column :serverless_domain_cluster, :encrypted_key_iv, :string, limit: 255 - add_column :serverless_domain_cluster, :certificate, :text - end - # rubocop:enable Migration/AddLimitToTextColumns - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200130161817_drop_unneeded_indexes_for_projects_api_requests.rb b/db/migrate/20200130161817_drop_unneeded_indexes_for_projects_api_requests.rb deleted file mode 100644 index 50b98ab9dba..00000000000 --- a/db/migrate/20200130161817_drop_unneeded_indexes_for_projects_api_requests.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class DropUnneededIndexesForProjectsApiRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - - DOWNTIME = false - - def up - indexes = %w( - index_projects_api_vis20_created_at_id_desc - index_projects_api_vis20_last_activity_at_id_desc - index_projects_api_vis20_updated_at_id_desc - index_projects_api_vis20_name_id_desc - index_projects_api_vis20_path_id_desc - ) - - indexes.each do |index| - remove_concurrent_index_by_name :projects, index - end - end - - def down - columns = %i(created_at last_activity_at updated_at name path) - - columns.each do |column| - add_concurrent_index :projects, [column, :id], where: 'visibility_level = 20', order: { id: :desc }, name: "index_projects_api_vis20_#{column}_id_desc" - end - end -end diff --git a/db/migrate/20200131140428_create_index_on_auto_stop_in.rb b/db/migrate/20200131140428_create_index_on_auto_stop_in.rb deleted file mode 100644 index 526e7dcfe30..00000000000 --- a/db/migrate/20200131140428_create_index_on_auto_stop_in.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class CreateIndexOnAutoStopIn < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :environments, %i[state auto_stop_at], where: "auto_stop_at IS NOT NULL AND state = 'available'" - end - - def down - remove_concurrent_index :environments, %i[state auto_stop_at] - end -end diff --git a/db/migrate/20200131181354_add_health_status_to_epics.rb b/db/migrate/20200131181354_add_health_status_to_epics.rb deleted file mode 100644 index 4e5f9ab138d..00000000000 --- a/db/migrate/20200131181354_add_health_status_to_epics.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddHealthStatusToEpics < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :epics, :health_status, :integer, limit: 2 - end -end diff --git a/db/migrate/20200131191754_add_health_status_to_issues.rb b/db/migrate/20200131191754_add_health_status_to_issues.rb deleted file mode 100644 index ca4e797f4b7..00000000000 --- a/db/migrate/20200131191754_add_health_status_to_issues.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddHealthStatusToIssues < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :issues, :health_status, :integer, limit: 2 - end -end diff --git a/db/migrate/20200202100932_add_service_desk_project_key.rb b/db/migrate/20200202100932_add_service_desk_project_key.rb deleted file mode 100644 index 5095e628b42..00000000000 --- a/db/migrate/20200202100932_add_service_desk_project_key.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddServiceDeskProjectKey < ActiveRecord::Migration[5.2] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - add_column :service_desk_settings, :project_key, :string, limit: 255 - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200203015140_add_id_to_design_management_designs_versions.rb b/db/migrate/20200203015140_add_id_to_design_management_designs_versions.rb deleted file mode 100644 index f809bc84fae..00000000000 --- a/db/migrate/20200203015140_add_id_to_design_management_designs_versions.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddIdToDesignManagementDesignsVersions < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :design_management_designs_versions, :id, :primary_key - end -end diff --git a/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb b/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb deleted file mode 100644 index 8e48490af77..00000000000 --- a/db/migrate/20200203025400_default_lock_version_to_zero_for_merge_requests.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class DefaultLockVersionToZeroForMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :merge_requests, :lock_version, from: nil, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :merge_requests, :lock_version, from: 0, to: nil - end - end -end diff --git a/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb b/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb deleted file mode 100644 index 1265de70728..00000000000 --- a/db/migrate/20200203025602_default_lock_version_to_zero_for_issues.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class DefaultLockVersionToZeroForIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :issues, :lock_version, from: nil, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :issues, :lock_version, from: 0, to: nil - end - end -end diff --git a/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb b/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb deleted file mode 100644 index b2af8cbe707..00000000000 --- a/db/migrate/20200203025619_default_lock_version_to_zero_for_epics.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class DefaultLockVersionToZeroForEpics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :epics, :lock_version, from: nil, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :epics, :lock_version, from: 0, to: nil - end - end -end diff --git a/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb b/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb deleted file mode 100644 index f40bf7d6309..00000000000 --- a/db/migrate/20200203025744_default_lock_version_to_zero_for_ci_builds.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class DefaultLockVersionToZeroForCiBuilds < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :ci_builds, :lock_version, from: nil, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :ci_builds, :lock_version, from: 0, to: nil - end - end -end diff --git a/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb b/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb deleted file mode 100644 index fd3194a742a..00000000000 --- a/db/migrate/20200203025801_default_lock_version_to_zero_for_ci_stages.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class DefaultLockVersionToZeroForCiStages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :ci_stages, :lock_version, from: nil, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :ci_stages, :lock_version, from: 0, to: nil - end - end -end diff --git a/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb b/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb deleted file mode 100644 index 6b4568cc7e8..00000000000 --- a/db/migrate/20200203025821_default_lock_version_to_zero_for_ci_pipelines.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class DefaultLockVersionToZeroForCiPipelines < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :ci_pipelines, :lock_version, from: nil, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :ci_pipelines, :lock_version, from: 0, to: nil - end - end -end diff --git a/db/migrate/20200203173508_add_confirmed_attributes_to_vulnerabilities.rb b/db/migrate/20200203173508_add_confirmed_attributes_to_vulnerabilities.rb deleted file mode 100644 index 43a375c011f..00000000000 --- a/db/migrate/20200203173508_add_confirmed_attributes_to_vulnerabilities.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddConfirmedAttributesToVulnerabilities < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :vulnerabilities, :confirmed_by_id, :bigint - add_column :vulnerabilities, :confirmed_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20200203183508_add_index_for_vulnerability_confirmed_by.rb b/db/migrate/20200203183508_add_index_for_vulnerability_confirmed_by.rb deleted file mode 100644 index dd50e7be893..00000000000 --- a/db/migrate/20200203183508_add_index_for_vulnerability_confirmed_by.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexForVulnerabilityConfirmedBy < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerabilities, :confirmed_by_id - add_concurrent_foreign_key :vulnerabilities, :users, column: :confirmed_by_id, on_delete: :nullify - end - - def down - remove_foreign_key :vulnerabilities, column: :confirmed_by_id - remove_concurrent_index :vulnerabilities, :confirmed_by_id - end -end diff --git a/db/migrate/20200203232433_create_security_scan.rb b/db/migrate/20200203232433_create_security_scan.rb deleted file mode 100644 index a5fe73efbf2..00000000000 --- a/db/migrate/20200203232433_create_security_scan.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CreateSecurityScan < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - create_table :security_scans, id: :bigserial do |t| - t.timestamps_with_timezone null: false - - t.references :build, - null: false, - index: false, - foreign_key: { to_table: :ci_builds, on_delete: :cascade }, - type: :bigint - - t.integer :scan_type, - null: false, - index: { name: "idx_security_scans_on_scan_type" }, - limit: 2 - - t.index [:build_id, :scan_type], name: "idx_security_scans_on_build_and_scan_type", unique: true - end - end -end diff --git a/db/migrate/20200204070729_add_elasticsearch_indexed_field_length_limit_to_application_settings.rb b/db/migrate/20200204070729_add_elasticsearch_indexed_field_length_limit_to_application_settings.rb deleted file mode 100644 index 7d478706613..00000000000 --- a/db/migrate/20200204070729_add_elasticsearch_indexed_field_length_limit_to_application_settings.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddElasticsearchIndexedFieldLengthLimitToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :application_settings, :elasticsearch_indexed_field_length_limit, :integer, null: false, default: 0 - - if Gitlab.com? - execute 'UPDATE application_settings SET elasticsearch_indexed_field_length_limit = 20000' - end - end - - def down - remove_column :application_settings, :elasticsearch_indexed_field_length_limit - end -end diff --git a/db/migrate/20200204131054_change_broadcast_message_index.rb b/db/migrate/20200204131054_change_broadcast_message_index.rb deleted file mode 100644 index 9545eacd3a1..00000000000 --- a/db/migrate/20200204131054_change_broadcast_message_index.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class ChangeBroadcastMessageIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :broadcast_messages, %i(ends_at broadcast_type id), name: 'index_broadcast_message_on_ends_at_and_broadcast_type_and_id' - remove_concurrent_index_by_name :broadcast_messages, :index_broadcast_messages_on_starts_at_and_ends_at_and_id - end - - def down - add_concurrent_index :broadcast_messages, %i(starts_at ends_at id), name: 'index_broadcast_messages_on_starts_at_and_ends_at_and_id' - remove_concurrent_index_by_name :broadcast_messages, :index_broadcast_message_on_ends_at_and_broadcast_type_and_id - end -end diff --git a/db/migrate/20200204131831_create_daily_report_results.rb b/db/migrate/20200204131831_create_daily_report_results.rb deleted file mode 100644 index 6992b6317e1..00000000000 --- a/db/migrate/20200204131831_create_daily_report_results.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CreateDailyReportResults < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :ci_daily_report_results do |t| - t.date :date, null: false - t.bigint :project_id, null: false - t.bigint :last_pipeline_id, null: false - t.float :value, null: false - t.integer :param_type, limit: 8, null: false - t.string :ref_path, null: false - t.string :title, null: false - - t.index :last_pipeline_id - t.index [:project_id, :ref_path, :param_type, :date, :title], name: 'index_daily_report_results_unique_columns', unique: true - t.foreign_key :projects, on_delete: :cascade - t.foreign_key :ci_pipelines, column: :last_pipeline_id, on_delete: :cascade - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200205143231_add_dissmised_at_to_user_callouts.rb b/db/migrate/20200205143231_add_dissmised_at_to_user_callouts.rb deleted file mode 100644 index f9942d442b5..00000000000 --- a/db/migrate/20200205143231_add_dissmised_at_to_user_callouts.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDissmisedAtToUserCallouts < ActiveRecord::Migration[5.2] - DOWNTIME = false - - def change - add_column :user_callouts, :dismissed_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20200206112850_create_snippet_repository_table.rb b/db/migrate/20200206112850_create_snippet_repository_table.rb deleted file mode 100644 index b9120264bb7..00000000000 --- a/db/migrate/20200206112850_create_snippet_repository_table.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class CreateSnippetRepositoryTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :snippet_repositories, id: false, primary_key: :snippet_id do |t| - t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } - t.references :snippet, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade } - t.string :disk_path, limit: 80, null: false, index: { unique: true } - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200206141511_change_saml_provider_outer_forks_default.rb b/db/migrate/20200206141511_change_saml_provider_outer_forks_default.rb deleted file mode 100644 index 971cc4da921..00000000000 --- a/db/migrate/20200206141511_change_saml_provider_outer_forks_default.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class ChangeSamlProviderOuterForksDefault < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column_null :saml_providers, :prohibited_outer_forks, false - change_column_default :saml_providers, :prohibited_outer_forks, true - end - - def down - change_column_default :saml_providers, :prohibited_outer_forks, false - change_column_null :saml_providers, :prohibited_outer_forks, true - end -end diff --git a/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb b/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb deleted file mode 100644 index 56a30b02290..00000000000 --- a/db/migrate/20200207062728_add_default_branch_protection_to_namespaces.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultBranchProtectionToNamespaces < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespaces, :default_branch_protection, :integer, limit: 2 # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :default_branch_protection - end - end -end diff --git a/db/migrate/20200207090921_add_nuget_index_to_packages_packages.rb b/db/migrate/20200207090921_add_nuget_index_to_packages_packages.rb deleted file mode 100644 index 1bd9c4dc0d0..00000000000 --- a/db/migrate/20200207090921_add_nuget_index_to_packages_packages.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddNugetIndexToPackagesPackages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_packages_project_id_name_partial_for_nuget' - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_packages, [:project_id, :name], name: INDEX_NAME, where: "name <> 'NuGet.Temporary.Package' AND version is not null AND package_type = 4" - end - - def down - remove_concurrent_index_by_name :packages_packages, INDEX_NAME - end -end diff --git a/db/migrate/20200207132752_add_es_bulk_config.rb b/db/migrate/20200207132752_add_es_bulk_config.rb deleted file mode 100644 index c460971139c..00000000000 --- a/db/migrate/20200207132752_add_es_bulk_config.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddEsBulkConfig < ActiveRecord::Migration[6.0] - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def change - add_column :application_settings, :elasticsearch_max_bulk_size_mb, :smallint, null: false, default: 10 - add_column :application_settings, :elasticsearch_max_bulk_concurrency, :smallint, null: false, default: 10 - end -end diff --git a/db/migrate/20200207151640_create_deployment_clusters.rb b/db/migrate/20200207151640_create_deployment_clusters.rb deleted file mode 100644 index dd05d1730d9..00000000000 --- a/db/migrate/20200207151640_create_deployment_clusters.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreateDeploymentClusters < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :deployment_clusters, id: false, force: :cascade do |t| - t.references :deployment, foreign_key: { on_delete: :cascade }, primary_key: true, type: :integer, index: false, default: nil - t.references :cluster, foreign_key: { on_delete: :cascade }, type: :integer, index: false, null: false - t.string :kubernetes_namespace, limit: 255 - - t.index [:cluster_id, :kubernetes_namespace], name: 'idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace' - t.index [:cluster_id, :deployment_id], unique: true - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200207182131_replace_conan_metadata_index.rb b/db/migrate/20200207182131_replace_conan_metadata_index.rb deleted file mode 100644 index 4f55a2974d8..00000000000 --- a/db/migrate/20200207182131_replace_conan_metadata_index.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class ReplaceConanMetadataIndex < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - OLD_INDEX = 'index_packages_conan_metadata_on_package_id' - NEW_INDEX = 'index_packages_conan_metadata_on_package_id_username_channel' - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_conan_metadata, - [:package_id, :package_username, :package_channel], - unique: true, name: NEW_INDEX - - remove_concurrent_index_by_name :packages_conan_metadata, OLD_INDEX - end - - def down - add_concurrent_index :packages_conan_metadata, :package_id, name: OLD_INDEX - - remove_concurrent_index_by_name :packages_conan_metadata, NEW_INDEX - end -end diff --git a/db/migrate/20200209131152_add_feature_filter_type_to_user_preferences.rb b/db/migrate/20200209131152_add_feature_filter_type_to_user_preferences.rb deleted file mode 100644 index c05b624c438..00000000000 --- a/db/migrate/20200209131152_add_feature_filter_type_to_user_preferences.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddFeatureFilterTypeToUserPreferences < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :user_preferences, :feature_filter_type, :bigint - end -end diff --git a/db/migrate/20200210135504_remove_packages_deprecated_dependencies.rb b/db/migrate/20200210135504_remove_packages_deprecated_dependencies.rb deleted file mode 100644 index 476b3de659a..00000000000 --- a/db/migrate/20200210135504_remove_packages_deprecated_dependencies.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class RemovePackagesDeprecatedDependencies < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute('DELETE FROM packages_dependency_links WHERE dependency_type = 5') - end - - def down - # There is nothing to do to reverse this migration - end -end diff --git a/db/migrate/20200210184410_create_operations_strategies_table.rb b/db/migrate/20200210184410_create_operations_strategies_table.rb deleted file mode 100644 index 4d65267c1a7..00000000000 --- a/db/migrate/20200210184410_create_operations_strategies_table.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class CreateOperationsStrategiesTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :operations_strategies do |t| - t.references :feature_flag, index: true, null: false, foreign_key: { to_table: :operations_feature_flags, on_delete: :cascade } - t.string :name, null: false, limit: 255 - t.jsonb :parameters, null: false, default: {} - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200210184420_create_operations_scopes_table.rb b/db/migrate/20200210184420_create_operations_scopes_table.rb deleted file mode 100644 index 7ce21feb865..00000000000 --- a/db/migrate/20200210184420_create_operations_scopes_table.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateOperationsScopesTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :operations_scopes do |t| - t.references :strategy, null: false, index: false, foreign_key: { to_table: :operations_strategies, on_delete: :cascade } - t.string :environment_scope, null: false, limit: 255 - end - - add_index :operations_scopes, [:strategy_id, :environment_scope], unique: true - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200211174946_add_auto_renew_to_gitlab_subscriptions.rb b/db/migrate/20200211174946_add_auto_renew_to_gitlab_subscriptions.rb deleted file mode 100644 index 6bce74bb8f8..00000000000 --- a/db/migrate/20200211174946_add_auto_renew_to_gitlab_subscriptions.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddAutoRenewToGitlabSubscriptions < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :gitlab_subscription_histories, :auto_renew, :boolean - add_column :gitlab_subscriptions, :auto_renew, :boolean - end -end diff --git a/db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb b/db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb deleted file mode 100644 index 8d37f6c1dd4..00000000000 --- a/db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class RenameSecurityDashboardFeatureFlagToInstanceSecurityDashboard < ActiveRecord::Migration[6.0] - DOWNTIME = false - - class FeatureGate < ApplicationRecord - self.table_name = 'feature_gates' - end - - def up - security_dashboard_feature = FeatureGate.find_by(feature_key: :security_dashboard, key: :boolean) - - if security_dashboard_feature.present? - FeatureGate.safe_find_or_create_by!( - feature_key: :instance_security_dashboard, - key: :boolean, - value: security_dashboard_feature.value - ) - end - end - - def down - FeatureGate.find_by(feature_key: :instance_security_dashboard, key: :boolean)&.delete - end -end diff --git a/db/migrate/20200212133945_add_group_hooks_to_plan_limits.rb b/db/migrate/20200212133945_add_group_hooks_to_plan_limits.rb deleted file mode 100644 index 4e279ff903d..00000000000 --- a/db/migrate/20200212133945_add_group_hooks_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddGroupHooksToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :group_hooks, :integer, default: 0, null: false) - end -end diff --git a/db/migrate/20200212134201_insert_group_hooks_plan_limits.rb b/db/migrate/20200212134201_insert_group_hooks_plan_limits.rb deleted file mode 100644 index a2963cfaf4d..00000000000 --- a/db/migrate/20200212134201_insert_group_hooks_plan_limits.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class InsertGroupHooksPlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - return unless Gitlab.com? - - create_or_update_plan_limit('group_hooks', 'bronze', 50) - create_or_update_plan_limit('group_hooks', 'silver', 50) - create_or_update_plan_limit('group_hooks', 'gold', 50) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('group_hooks', 'bronze', 0) - create_or_update_plan_limit('group_hooks', 'silver', 0) - create_or_update_plan_limit('group_hooks', 'gold', 0) - end -end diff --git a/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb b/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb deleted file mode 100644 index 2b8afacb6b3..00000000000 --- a/db/migrate/20200213093702_add_email_restrictions_to_application_settings.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddEmailRestrictionsToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - def up - add_column(:application_settings, :email_restrictions_enabled, :boolean, default: false, null: false) - add_column(:application_settings, :email_restrictions, :text, null: true) - end - # rubocop:enable Migration/AddLimitToTextColumns - - def down - remove_column(:application_settings, :email_restrictions_enabled) - remove_column(:application_settings, :email_restrictions) - end -end diff --git a/db/migrate/20200213100530_add_verification_columns_to_packages.rb b/db/migrate/20200213100530_add_verification_columns_to_packages.rb deleted file mode 100644 index b715f35fcab..00000000000 --- a/db/migrate/20200213100530_add_verification_columns_to_packages.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationColumnsToPackages < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - add_column :packages_package_files, :verification_retry_at, :datetime_with_timezone - add_column :packages_package_files, :verified_at, :datetime_with_timezone - add_column :packages_package_files, :verification_checksum, :string, limit: 255 - add_column :packages_package_files, :verification_failure, :string, limit: 255 - add_column :packages_package_files, :verification_retry_count, :integer - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb b/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb deleted file mode 100644 index 3815117a7e8..00000000000 --- a/db/migrate/20200213155311_add_npm_package_requests_forwarding_to_application_settings.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddNpmPackageRequestsForwardingToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:application_settings, :npm_package_requests_forwarding, # rubocop:disable Migration/AddColumnWithDefault - :boolean, - default: false, - allow_null: false) - end - - def down - remove_column(:application_settings, :npm_package_requests_forwarding) - end -end diff --git a/db/migrate/20200213224220_add_sprints.rb b/db/migrate/20200213224220_add_sprints.rb deleted file mode 100644 index 8d82d1e261a..00000000000 --- a/db/migrate/20200213224220_add_sprints.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class AddSprints < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :sprints, id: :bigserial do |t| - t.timestamps_with_timezone null: false - t.date :start_date - t.date :due_date - - t.references :project, foreign_key: false, index: false - t.references :group, foreign_key: false, index: true - - t.integer :iid, null: false - t.integer :cached_markdown_version - t.integer :state, limit: 2 - # rubocop:disable Migration/AddLimitToTextColumns - t.text :title, null: false - t.text :title_html - t.text :description - t.text :description_html - # rubocop:enable Migration/AddLimitToTextColumns - - t.index :description, name: "index_sprints_on_description_trigram", opclass: :gin_trgm_ops, using: :gin - t.index :due_date - t.index %w(project_id iid), unique: true - t.index :title - t.index :title, name: "index_sprints_on_title_trigram", opclass: :gin_trgm_ops, using: :gin - - t.index %w(project_id title), unique: true, where: 'project_id IS NOT NULL' - t.index %w(group_id title), unique: true, where: 'group_id IS NOT NULL' - end - end -end diff --git a/db/migrate/20200214025454_add_canonical_emails.rb b/db/migrate/20200214025454_add_canonical_emails.rb deleted file mode 100644 index 0732d39169d..00000000000 --- a/db/migrate/20200214025454_add_canonical_emails.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddCanonicalEmails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :user_canonical_emails do |t| - t.timestamps_with_timezone - t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade } - t.string :canonical_email, null: false, index: true # rubocop:disable Migration/PreventStrings - end - end - - add_index :user_canonical_emails, [:user_id, :canonical_email], unique: true - add_index :user_canonical_emails, :user_id, unique: true - end - - def down - with_lock_retries do - drop_table(:user_canonical_emails) - end - end -end diff --git a/db/migrate/20200215222507_drop_forked_project_links_fk.rb b/db/migrate/20200215222507_drop_forked_project_links_fk.rb deleted file mode 100644 index 7fe38a6ccdb..00000000000 --- a/db/migrate/20200215222507_drop_forked_project_links_fk.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class DropForkedProjectLinksFk < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - remove_foreign_key_if_exists :forked_project_links, column: :forked_to_project_id - end - end - - def down - unless foreign_key_exists?(:forked_project_links, :projects, column: :forked_to_project_id) - with_lock_retries do - add_foreign_key :forked_project_links, :projects, column: :forked_to_project_id, on_delete: :cascade, validate: false - end - end - - fk_name = concurrent_foreign_key_name(:forked_project_links, :forked_to_project_id, prefix: 'fk_rails_') - validate_foreign_key(:forked_project_links, :forked_to_project_id, name: fk_name) - end -end diff --git a/db/migrate/20200215225103_drop_forked_project_links_table.rb b/db/migrate/20200215225103_drop_forked_project_links_table.rb deleted file mode 100644 index 6acced2c734..00000000000 --- a/db/migrate/20200215225103_drop_forked_project_links_table.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# rubocop:disable Migration/Datetime - -class DropForkedProjectLinksTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - # rubocop:disable Migration/DropTable - drop_table "forked_project_links", id: :serial do |t| - t.integer "forked_to_project_id", null: false - t.integer "forked_from_project_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.index ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true - end - # rubocop:enable Migration/DropTable - end -end diff --git a/db/migrate/20200218113721_add_indexes_to_package_file.rb b/db/migrate/20200218113721_add_indexes_to_package_file.rb deleted file mode 100644 index 7c66da6819e..00000000000 --- a/db/migrate/20200218113721_add_indexes_to_package_file.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesToPackageFile < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_package_files, :verification_failure, where: "(verification_failure IS NOT NULL)", name: "packages_packages_verification_failure_partial" - add_concurrent_index :packages_package_files, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "packages_packages_verification_checksum_partial" - end - - def down - remove_concurrent_index :packages_package_files, :verification_failure - remove_concurrent_index :packages_package_files, :verification_checksum - end -end diff --git a/db/migrate/20200219105209_add_filepath_to_release_links.rb b/db/migrate/20200219105209_add_filepath_to_release_links.rb deleted file mode 100644 index ba69332fb70..00000000000 --- a/db/migrate/20200219105209_add_filepath_to_release_links.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -class AddFilepathToReleaseLinks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :release_links, :filepath, :string, limit: 128 # rubocop:disable Migration/PreventStrings - end -end diff --git a/db/migrate/20200219133859_add_environment_id_to_deployment_merge_requests.rb b/db/migrate/20200219133859_add_environment_id_to_deployment_merge_requests.rb deleted file mode 100644 index a57d0b44c52..00000000000 --- a/db/migrate/20200219133859_add_environment_id_to_deployment_merge_requests.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddEnvironmentIdToDeploymentMergeRequests < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :deployment_merge_requests, :environment_id, :integer, null: true - end -end diff --git a/db/migrate/20200219135440_add_limit_metric_type_to_list.rb b/db/migrate/20200219135440_add_limit_metric_type_to_list.rb deleted file mode 100644 index a2b2fb25ac9..00000000000 --- a/db/migrate/20200219135440_add_limit_metric_type_to_list.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddLimitMetricTypeToList < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :lists, :limit_metric, :string, limit: 20 # rubocop:disable Migration/PreventStrings - end -end diff --git a/db/migrate/20200219141307_add_environment_id_fk_to_deployment_merge_requests.rb b/db/migrate/20200219141307_add_environment_id_fk_to_deployment_merge_requests.rb deleted file mode 100644 index 76980b21feb..00000000000 --- a/db/migrate/20200219141307_add_environment_id_fk_to_deployment_merge_requests.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddEnvironmentIdFkToDeploymentMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :deployment_merge_requests, :environments, column: :environment_id, on_delete: :cascade - end - - def down - remove_foreign_key_if_exists :deployment_merge_requests, column: :environment_id - end -end diff --git a/db/migrate/20200219142522_add_environment_id_merge_request_id_uniq_idx_to_deployment_merge_requests.rb b/db/migrate/20200219142522_add_environment_id_merge_request_id_uniq_idx_to_deployment_merge_requests.rb deleted file mode 100644 index a557f3f88d7..00000000000 --- a/db/migrate/20200219142522_add_environment_id_merge_request_id_uniq_idx_to_deployment_merge_requests.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddEnvironmentIdMergeRequestIdUniqIdxToDeploymentMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :deployment_merge_requests, [:environment_id, :merge_request_id], unique: true, name: 'idx_environment_merge_requests_unique_index' - end - - def down - remove_concurrent_index_by_name :deployment_merge_requests, 'idx_environment_merge_requests_unique_index' - end -end diff --git a/db/migrate/20200220180944_add_keep_divergent_refs.rb b/db/migrate/20200220180944_add_keep_divergent_refs.rb deleted file mode 100644 index 0b123bc9d72..00000000000 --- a/db/migrate/20200220180944_add_keep_divergent_refs.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddKeepDivergentRefs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - add_column :remote_mirrors, :keep_divergent_refs, :boolean - end -end diff --git a/db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb b/db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb deleted file mode 100644 index 53f8f5e7f81..00000000000 --- a/db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnPagesDomainOnDomainLowercase < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'index_pages_domains_on_domain_lowercase' - - disable_ddl_transaction! - - def up - add_concurrent_index :pages_domains, 'LOWER(domain)', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :pages_domains, INDEX_NAME - end -end diff --git a/db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb b/db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb deleted file mode 100644 index 993905f66ce..00000000000 --- a/db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddMrMetricsFirstApprovedAt < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :merge_request_metrics, :first_approved_at, :datetime_with_timezone - end - - def down - remove_column :merge_request_metrics, :first_approved_at - end -end diff --git a/db/migrate/20200221100514_create_users_statistics.rb b/db/migrate/20200221100514_create_users_statistics.rb deleted file mode 100644 index c02e635bdd4..00000000000 --- a/db/migrate/20200221100514_create_users_statistics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreateUsersStatistics < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :users_statistics do |t| - t.timestamps_with_timezone null: false - t.integer :without_groups_and_projects, null: false, default: 0 - t.integer :with_highest_role_guest, null: false, default: 0 - t.integer :with_highest_role_reporter, null: false, default: 0 - t.integer :with_highest_role_developer, null: false, default: 0 - t.integer :with_highest_role_maintainer, null: false, default: 0 - t.integer :with_highest_role_owner, null: false, default: 0 - t.integer :bots, null: false, default: 0 - t.integer :blocked, null: false, default: 0 - end - end -end diff --git a/db/migrate/20200221105436_update_application_setting_npm_package_requests_forwarding_default.rb b/db/migrate/20200221105436_update_application_setting_npm_package_requests_forwarding_default.rb deleted file mode 100644 index 2479df2737d..00000000000 --- a/db/migrate/20200221105436_update_application_setting_npm_package_requests_forwarding_default.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class UpdateApplicationSettingNpmPackageRequestsForwardingDefault < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column_default :application_settings, :npm_package_requests_forwarding, true - - execute('UPDATE application_settings SET npm_package_requests_forwarding = TRUE') - end - - def down - change_column_default :application_settings, :npm_package_requests_forwarding, false - - execute('UPDATE application_settings SET npm_package_requests_forwarding = FALSE') - end -end diff --git a/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb b/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb deleted file mode 100644 index 4ec514f7fca..00000000000 --- a/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class DropActivatePrometheusServicesBackgroundJobs < ActiveRecord::Migration[6.0] - DOWNTIME = false - DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications' - QUEUE = 'background_migration' - - def up - sidekiq_queues.each do |queue| - queue.each do |job| - klass, project_id, *should_be_empty = job.args - next unless klass == DROPPED_JOB_CLASS && project_id.is_a?(Integer) && should_be_empty.empty? - - job.delete - end - end - end - - def down - # no-op - end - - def sidekiq_queues - [Sidekiq::ScheduledSet.new, Sidekiq::RetrySet.new, Sidekiq::Queue.new(QUEUE)] - end -end diff --git a/db/migrate/20200222055543_add_confidential_to_note.rb b/db/migrate/20200222055543_add_confidential_to_note.rb deleted file mode 100644 index d7bf64dca44..00000000000 --- a/db/migrate/20200222055543_add_confidential_to_note.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true -class AddConfidentialToNote < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :notes, :confidential, :boolean - end - end - - def down - with_lock_retries do - remove_column :notes, :confidential - end - end -end diff --git a/db/migrate/20200224020219_add_status_page_settings.rb b/db/migrate/20200224020219_add_status_page_settings.rb deleted file mode 100644 index b45dfc8ec46..00000000000 --- a/db/migrate/20200224020219_add_status_page_settings.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddStatusPageSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :status_page_settings, id: false do |t| - t.references :project, index: true, primary_key: true, foreign_key: { on_delete: :cascade }, unique: true, null: false - t.timestamps_with_timezone null: false - t.boolean :enabled, default: false, null: false - t.string :aws_s3_bucket_name, limit: 63, null: false - t.string :aws_region, limit: 255, null: false - t.string :aws_access_key, limit: 255, null: false - t.string :encrypted_aws_secret_key, limit: 255, null: false - t.string :encrypted_aws_secret_key_iv, limit: 255, null: false - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200224163804_add_version_to_feature_flags_table.rb b/db/migrate/20200224163804_add_version_to_feature_flags_table.rb deleted file mode 100644 index d300f7c83e1..00000000000 --- a/db/migrate/20200224163804_add_version_to_feature_flags_table.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddVersionToFeatureFlagsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - FEATURE_FLAG_LEGACY_VERSION = 1 - - def up - # The operations_feature_flags table is small enough that we can disable this cop. - # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25552#note_291202882 - # rubocop:disable Migration/AddColumnWithDefault - add_column_with_default(:operations_feature_flags, :version, :smallint, default: FEATURE_FLAG_LEGACY_VERSION, allow_null: false) - # rubocop:enable Migration/AddColumnWithDefault - end - - def down - remove_column(:operations_feature_flags, :version) - end -end diff --git a/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb b/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb deleted file mode 100644 index 789f23501fb..00000000000 --- a/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddProjectSubscriptionsToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :ci_project_subscriptions, :integer, default: 0, null: false) - end -end diff --git a/db/migrate/20200225111018_add_index_for_group_and_iid_search_to_epics.rb b/db/migrate/20200225111018_add_index_for_group_and_iid_search_to_epics.rb deleted file mode 100644 index 98f35d9f1ae..00000000000 --- a/db/migrate/20200225111018_add_index_for_group_and_iid_search_to_epics.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddIndexForGroupAndIidSearchToEpics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_epics_on_group_id_and_iid_varchar_pattern' - - disable_ddl_transaction! - - def up - disable_statement_timeout do - execute "CREATE INDEX CONCURRENTLY \"#{INDEX_NAME}\" ON epics (group_id, CAST(iid AS VARCHAR) varchar_pattern_ops);" - end - end - - def down - disable_statement_timeout do - remove_concurrent_index_by_name :epics, INDEX_NAME - end - end -end diff --git a/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb b/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb deleted file mode 100644 index f04e0c68cf6..00000000000 --- a/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class InsertProjectSubscriptionsPlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - return unless Gitlab.com? - - create_or_update_plan_limit('ci_project_subscriptions', 'free', 2) - create_or_update_plan_limit('ci_project_subscriptions', 'bronze', 2) - create_or_update_plan_limit('ci_project_subscriptions', 'silver', 2) - create_or_update_plan_limit('ci_project_subscriptions', 'gold', 2) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('ci_project_subscriptions', 'free', 0) - create_or_update_plan_limit('ci_project_subscriptions', 'bronze', 0) - create_or_update_plan_limit('ci_project_subscriptions', 'silver', 0) - create_or_update_plan_limit('ci_project_subscriptions', 'gold', 0) - end -end diff --git a/db/migrate/20200226100614_create_requirements.rb b/db/migrate/20200226100614_create_requirements.rb deleted file mode 100644 index f374e1e9581..00000000000 --- a/db/migrate/20200226100614_create_requirements.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CreateRequirements < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :requirements do |t| - t.timestamps_with_timezone null: false - t.integer :project_id, null: false - t.integer :author_id - t.integer :iid, null: false - t.integer :cached_markdown_version - t.integer :state, limit: 2, default: 1, null: false - t.string :title, limit: 255, null: false - t.text :title_html # rubocop:disable Migration/AddLimitToTextColumns - - t.index :project_id - t.index :author_id - t.index :title, name: "index_requirements_on_title_trigram", using: :gin, opclass: :gin_trgm_ops - t.index :state - t.index :created_at - t.index :updated_at - t.index %w(project_id iid), name: 'index_requirements_on_project_id_and_iid', where: 'project_id IS NOT NULL', unique: true, using: :btree - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200226100624_requirements_add_project_fk.rb b/db/migrate/20200226100624_requirements_add_project_fk.rb deleted file mode 100644 index b44ce1d34ec..00000000000 --- a/db/migrate/20200226100624_requirements_add_project_fk.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RequirementsAddProjectFk < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key(:requirements, :projects, column: :project_id, on_delete: :cascade) - end - end - - def down - with_lock_retries do - remove_foreign_key(:requirements, column: :project_id) - end - end -end diff --git a/db/migrate/20200226100634_requirements_add_author_fk.rb b/db/migrate/20200226100634_requirements_add_author_fk.rb deleted file mode 100644 index b458657827f..00000000000 --- a/db/migrate/20200226100634_requirements_add_author_fk.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RequirementsAddAuthorFk < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key(:requirements, :users, column: :author_id, on_delete: :nullify) - end - end - - def down - with_lock_retries do - remove_foreign_key(:requirements, column: :author_id) - end - end -end diff --git a/db/migrate/20200226162156_rename_closed_at_to_dismissed_at_in_vulnerabilities.rb b/db/migrate/20200226162156_rename_closed_at_to_dismissed_at_in_vulnerabilities.rb deleted file mode 100644 index ce7170cb335..00000000000 --- a/db/migrate/20200226162156_rename_closed_at_to_dismissed_at_in_vulnerabilities.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RenameClosedAtToDismissedAtInVulnerabilities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - rename_column_concurrently :vulnerabilities, :closed_at, :dismissed_at - end - - def down - undo_rename_column_concurrently :vulnerabilities, :closed_at, :dismissed_at - end -end diff --git a/db/migrate/20200226162634_rename_closed_by_to_dismissed_by_in_vulnerabilities.rb b/db/migrate/20200226162634_rename_closed_by_to_dismissed_by_in_vulnerabilities.rb deleted file mode 100644 index 04b1f0d7136..00000000000 --- a/db/migrate/20200226162634_rename_closed_by_to_dismissed_by_in_vulnerabilities.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RenameClosedByToDismissedByInVulnerabilities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - rename_column_concurrently :vulnerabilities, :closed_by_id, :dismissed_by_id - end - - def down - undo_rename_column_concurrently :vulnerabilities, :closed_by_id, :dismissed_by_id - end -end diff --git a/db/migrate/20200227164113_create_scim_identities.rb b/db/migrate/20200227164113_create_scim_identities.rb deleted file mode 100644 index 34e119ccfe3..00000000000 --- a/db/migrate/20200227164113_create_scim_identities.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class CreateScimIdentities < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :scim_identities do |t| - t.references :group, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false - t.references :user, index: false, foreign_key: { on_delete: :cascade }, null: false - t.timestamps_with_timezone - t.boolean :active, default: false - t.string :extern_uid, null: false, limit: 255 - - t.index 'LOWER(extern_uid),group_id', name: 'index_scim_identities_on_lower_extern_uid_and_group_id', unique: true - t.index [:user_id, :group_id], unique: true - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200227165129_create_user_details.rb b/db/migrate/20200227165129_create_user_details.rb deleted file mode 100644 index 89258eadb9f..00000000000 --- a/db/migrate/20200227165129_create_user_details.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class CreateUserDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def up - with_lock_retries do - create_table :user_details, id: false do |t| - t.references :user, index: false, foreign_key: { on_delete: :cascade }, null: false, primary_key: true - t.string :job_title, limit: 200, default: "", null: false - end - end - - add_index :user_details, :user_id, unique: true - end - # rubocop:enable Migration/PreventStrings - - def down - with_lock_retries do - drop_table :user_details - end - end -end diff --git a/db/migrate/20200228160542_create_ci_sources_projects.rb b/db/migrate/20200228160542_create_ci_sources_projects.rb deleted file mode 100644 index 36f5167a784..00000000000 --- a/db/migrate/20200228160542_create_ci_sources_projects.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class CreateCiSourcesProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - create_table :ci_sources_projects do |t| - t.bigint :pipeline_id, null: false - t.bigint :source_project_id, null: false - - t.index [:source_project_id, :pipeline_id], unique: true - t.index :pipeline_id - end - end -end diff --git a/db/migrate/20200229171700_create_custom_emojis.rb b/db/migrate/20200229171700_create_custom_emojis.rb deleted file mode 100644 index f0574831f33..00000000000 --- a/db/migrate/20200229171700_create_custom_emojis.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateCustomEmojis < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:custom_emoji) - create_table :custom_emoji do |t| - t.references :namespace, index: false, null: false, foreign_key: { on_delete: :cascade } - t.datetime_with_timezone :created_at, null: false - t.datetime_with_timezone :updated_at, null: false - t.text :name, null: false - t.text :file, null: false - end - end - - unless index_exists?(:custom_emoji, [:namespace_id, :name], unique: true) - add_index :custom_emoji, [:namespace_id, :name], unique: true - end - - add_text_limit(:custom_emoji, :name, 36) - add_text_limit(:custom_emoji, :file, 255) - end - - def down - drop_table :custom_emoji - end -end diff --git a/db/migrate/20200302152516_add_wiki_slug.rb b/db/migrate/20200302152516_add_wiki_slug.rb deleted file mode 100644 index a7891427c10..00000000000 --- a/db/migrate/20200302152516_add_wiki_slug.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddWikiSlug < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :wiki_page_meta, id: :serial do |t| - t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false - t.timestamps_with_timezone null: false - t.string :title, null: false, limit: 255 - end - - create_table :wiki_page_slugs, id: :serial do |t| - t.boolean :canonical, default: false, null: false - t.references :wiki_page_meta, index: true, foreign_key: { on_delete: :cascade }, null: false - t.timestamps_with_timezone null: false - t.string :slug, null: false, limit: 2048 - t.index [:slug, :wiki_page_meta_id], unique: true - t.index [:wiki_page_meta_id], name: 'one_canonical_wiki_page_slug_per_metadata', unique: true, where: "(canonical = true)" - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200303055348_add_expires_at_to_keys.rb b/db/migrate/20200303055348_add_expires_at_to_keys.rb deleted file mode 100644 index ef7b813a2ef..00000000000 --- a/db/migrate/20200303055348_add_expires_at_to_keys.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddExpiresAtToKeys < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :keys, :expires_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20200303074328_add_index_on_snippet_description.rb b/db/migrate/20200303074328_add_index_on_snippet_description.rb deleted file mode 100644 index f23e5f8bf8e..00000000000 --- a/db/migrate/20200303074328_add_index_on_snippet_description.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnSnippetDescription < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_snippets_on_description_trigram' - - disable_ddl_transaction! - - def up - add_concurrent_index :snippets, :description, name: INDEX_NAME, using: :gin, opclass: { description: :gin_trgm_ops } - end - - def down - remove_concurrent_index_by_name :snippets, INDEX_NAME - end -end diff --git a/db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb b/db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb deleted file mode 100644 index 402cdbbdc14..00000000000 --- a/db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddHealthyToClustersApplicationsPrometheus < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # Default is null to indicate that a health check has not run for a project - # For now, health checks will only run on monitor demo projects - add_column :clusters_applications_prometheus, :healthy, :boolean - end - - def down - remove_column :clusters_applications_prometheus, :healthy - end -end diff --git a/db/migrate/20200304023245_add_sprint_to_issues.rb b/db/migrate/20200304023245_add_sprint_to_issues.rb deleted file mode 100644 index c8bc5258ffd..00000000000 --- a/db/migrate/20200304023245_add_sprint_to_issues.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddSprintToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # index will be added in another migration with `add_concurrent_index` - add_column :issues, :sprint_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :issues, :sprint_id - end - end -end diff --git a/db/migrate/20200304023851_add_sprint_to_merge_requests.rb b/db/migrate/20200304023851_add_sprint_to_merge_requests.rb deleted file mode 100644 index e294abe66cd..00000000000 --- a/db/migrate/20200304023851_add_sprint_to_merge_requests.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddSprintToMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # index will be added in another migration with `add_concurrent_index` - add_column :merge_requests, :sprint_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :merge_requests, :sprint_id - end - end -end diff --git a/db/migrate/20200304024025_add_sprint_id_index_to_issues.rb b/db/migrate/20200304024025_add_sprint_id_index_to_issues.rb deleted file mode 100644 index aaece3445db..00000000000 --- a/db/migrate/20200304024025_add_sprint_id_index_to_issues.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSprintIdIndexToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :issues, :sprint_id - add_concurrent_foreign_key :issues, :sprints, column: :sprint_id - end - - def down - with_lock_retries do - remove_foreign_key :issues, column: :sprint_id - end - remove_concurrent_index :issues, :sprint_id - end -end diff --git a/db/migrate/20200304024042_add_sprint_id_index_to_merge_requests.rb b/db/migrate/20200304024042_add_sprint_id_index_to_merge_requests.rb deleted file mode 100644 index 219d10ff47c..00000000000 --- a/db/migrate/20200304024042_add_sprint_id_index_to_merge_requests.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSprintIdIndexToMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :merge_requests, :sprint_id - add_concurrent_foreign_key :merge_requests, :sprints, column: :sprint_id - end - - def down - with_lock_retries do - remove_foreign_key :merge_requests, column: :sprint_id - end - remove_concurrent_index :merge_requests, :sprint_id - end -end diff --git a/db/migrate/20200304085423_add_user_type.rb b/db/migrate/20200304085423_add_user_type.rb deleted file mode 100644 index 3c20f2d26d8..00000000000 --- a/db/migrate/20200304085423_add_user_type.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUserType < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :users, :user_type, :integer, limit: 2 # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :users, :user_type - end - end -end diff --git a/db/migrate/20200304090155_add_user_type_index.rb b/db/migrate/20200304090155_add_user_type_index.rb deleted file mode 100644 index cd3b87d0a45..00000000000 --- a/db/migrate/20200304090155_add_user_type_index.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddUserTypeIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :users, :user_type - end - - def down - remove_concurrent_index :users, :user_type - end -end diff --git a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb deleted file mode 100644 index ed244a7d308..00000000000 --- a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCiSourcesProjectPipelineForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id - end - end -end diff --git a/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb deleted file mode 100644 index 56ae2106644..00000000000 --- a/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCiSourcesProjectSourceProjectForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :ci_sources_projects, :projects, column: :source_project_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :ci_sources_projects, :projects, column: :source_project_id - end - end -end diff --git a/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb b/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb deleted file mode 100644 index 19e6573af9b..00000000000 --- a/db/migrate/20200304124406_add_unlock_membership_to_ldap_of_groups.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUnlockMembershipToLdapOfGroups < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column(:namespaces, :unlock_membership_to_ldap, :boolean) # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :unlock_membership_to_ldap - end - end -end diff --git a/db/migrate/20200304160800_add_index_services_on_template.rb b/db/migrate/20200304160800_add_index_services_on_template.rb deleted file mode 100644 index 731fa04123c..00000000000 --- a/db/migrate/20200304160800_add_index_services_on_template.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexServicesOnTemplate < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - # This migration is a corrective action to add the missing - # index_services_on_template index on staging. - def up - add_concurrent_index(:services, :template) unless index_exists?(:services, :template) - end - - def down - # No reverse action as this is a corrective migration. - end -end diff --git a/db/migrate/20200304160801_delete_template_services_duplicated_by_type.rb b/db/migrate/20200304160801_delete_template_services_duplicated_by_type.rb deleted file mode 100644 index a1c5161aea0..00000000000 --- a/db/migrate/20200304160801_delete_template_services_duplicated_by_type.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class DeleteTemplateServicesDuplicatedByType < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # Delete service templates with duplicated types. Keep the service - # template with the lowest `id` because that is the service template used: - # https://gitlab.com/gitlab-org/gitlab/-/blob/v12.8.1-ee/app/controllers/admin/services_controller.rb#L37 - execute <<~SQL - DELETE - FROM services - WHERE TEMPLATE = TRUE - AND id NOT IN - (SELECT MIN(id) - FROM services - WHERE TEMPLATE = TRUE - GROUP BY TYPE); - SQL - end - - def down - # This migration cannot be reversed. - end -end diff --git a/db/migrate/20200304160823_add_index_to_service_unique_template_per_type.rb b/db/migrate/20200304160823_add_index_to_service_unique_template_per_type.rb deleted file mode 100644 index b81e5acf67f..00000000000 --- a/db/migrate/20200304160823_add_index_to_service_unique_template_per_type.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToServiceUniqueTemplatePerType < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:services, [:type, :template], unique: true, where: 'template IS TRUE') - end - - def down - remove_concurrent_index(:services, [:type, :template]) - end -end diff --git a/db/migrate/20200305020458_add_label_restore_table.rb b/db/migrate/20200305020458_add_label_restore_table.rb deleted file mode 100644 index a5809cfe14b..00000000000 --- a/db/migrate/20200305020458_add_label_restore_table.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class AddLabelRestoreTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # copy table - execute "CREATE TABLE #{backup_labels_table_name} (LIKE #{labels_table_name} INCLUDING ALL);" - - # make the primary key a real functioning one rather than incremental - execute "ALTER TABLE #{backup_labels_table_name} ALTER COLUMN ID DROP DEFAULT;" - - # add some fields that make changes trackable - execute "ALTER TABLE #{backup_labels_table_name} ADD COLUMN restore_action INTEGER;" - execute "ALTER TABLE #{backup_labels_table_name} ADD COLUMN new_title VARCHAR;" - end - - def down - drop_table backup_labels_table_name - end - - private - - def labels_table_name - :labels - end - - def backup_labels_table_name - :backup_labels - end -end diff --git a/db/migrate/20200305020459_add_label_restore_foreign_keys.rb b/db/migrate/20200305020459_add_label_restore_foreign_keys.rb deleted file mode 100644 index 4b7c68cb20b..00000000000 --- a/db/migrate/20200305020459_add_label_restore_foreign_keys.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class AddLabelRestoreForeignKeys < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # create foreign keys - connection.foreign_keys(labels_table_name).each do |fk| - fk_options = fk.options - add_concurrent_foreign_key(backup_labels_table_name, fk.to_table, name: fk.name, column: fk_options[:column]) - end - end - - def down - connection.foreign_keys(backup_labels_table_name).each do |fk| - with_lock_retries do - remove_foreign_key backup_labels_table_name, name: fk.name - end - end - end - - private - - def labels_table_name - :labels - end - - def backup_labels_table_name - :backup_labels - end -end diff --git a/db/migrate/20200305121159_add_merge_request_metrics_first_reassigned_at.rb b/db/migrate/20200305121159_add_merge_request_metrics_first_reassigned_at.rb deleted file mode 100644 index 714adf925ed..00000000000 --- a/db/migrate/20200305121159_add_merge_request_metrics_first_reassigned_at.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMergeRequestMetricsFirstReassignedAt < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :merge_request_metrics, :first_reassigned_at, :datetime_with_timezone - end - end - - def down - with_lock_retries do - remove_column :merge_request_metrics, :first_reassigned_at, :datetime_with_timezone - end - end -end diff --git a/db/migrate/20200305151736_delete_template_project_services.rb b/db/migrate/20200305151736_delete_template_project_services.rb deleted file mode 100644 index 2ab8d46a94e..00000000000 --- a/db/migrate/20200305151736_delete_template_project_services.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class DeleteTemplateProjectServices < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # In 12.9 an ActiveRecord validation for services not being a template and - # attached to a project at the same time is introduced. This migration cleans up invalid data. - execute <<~SQL - DELETE - FROM services - WHERE TEMPLATE = TRUE AND project_id IS NOT NULL - SQL - end - - def down - # This migration cannot be reversed. - end -end diff --git a/db/migrate/20200305200641_create_terraform_states.rb b/db/migrate/20200305200641_create_terraform_states.rb deleted file mode 100644 index 8429d5cfeb3..00000000000 --- a/db/migrate/20200305200641_create_terraform_states.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateTerraformStates < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :terraform_states do |t| - t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false - t.timestamps_with_timezone null: false - t.integer :file_store, limit: 2 - t.string :file, limit: 255 - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200306095654_add_merge_request_assignee_created_at.rb b/db/migrate/20200306095654_add_merge_request_assignee_created_at.rb deleted file mode 100644 index 127a20f127b..00000000000 --- a/db/migrate/20200306095654_add_merge_request_assignee_created_at.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMergeRequestAssigneeCreatedAt < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :merge_request_assignees, :created_at, :datetime_with_timezone - end - end - - def down - with_lock_retries do - remove_column :merge_request_assignees, :created_at - end - end -end diff --git a/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb b/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb deleted file mode 100644 index 2f7c16b3f20..00000000000 --- a/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnAuthorIdAndCreatedAtToEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_events_on_author_id_and_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :events, [:author_id, :created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index :events, INDEX_NAME - end -end diff --git a/db/migrate/20200306170211_add_index_on_author_id_and_id_and_created_at_to_issues.rb b/db/migrate/20200306170211_add_index_on_author_id_and_id_and_created_at_to_issues.rb deleted file mode 100644 index c581ca3874f..00000000000 --- a/db/migrate/20200306170211_add_index_on_author_id_and_id_and_created_at_to_issues.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnAuthorIdAndIdAndCreatedAtToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :issues, [:author_id, :id, :created_at] - end - - def down - remove_concurrent_index :issues, [:author_id, :id, :created_at] - end -end diff --git a/db/migrate/20200306170321_add_index_on_user_id_and_created_at_to_ci_pipelines.rb b/db/migrate/20200306170321_add_index_on_user_id_and_created_at_to_ci_pipelines.rb deleted file mode 100644 index b88f938d1c2..00000000000 --- a/db/migrate/20200306170321_add_index_on_user_id_and_created_at_to_ci_pipelines.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnUserIdAndCreatedAtToCiPipelines < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_pipelines, [:user_id, :created_at] - remove_concurrent_index :ci_pipelines, [:user_id] - end - - def down - add_concurrent_index :ci_pipelines, [:user_id] - remove_concurrent_index :ci_pipelines, [:user_id, :created_at] - end -end diff --git a/db/migrate/20200306170531_add_index_on_author_id_and_created_at_to_todos.rb b/db/migrate/20200306170531_add_index_on_author_id_and_created_at_to_todos.rb deleted file mode 100644 index d0d31ca7c52..00000000000 --- a/db/migrate/20200306170531_add_index_on_author_id_and_created_at_to_todos.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -class AddIndexOnAuthorIdAndCreatedAtToTodos < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :todos, [:author_id, :created_at] - end - - def down - remove_concurrent_index :todos, [:author_id, :created_at] - end -end diff --git a/db/migrate/20200306192548_add_index_on_project_id_and_type_to_services.rb b/db/migrate/20200306192548_add_index_on_project_id_and_type_to_services.rb deleted file mode 100644 index 9deb3c2832d..00000000000 --- a/db/migrate/20200306192548_add_index_on_project_id_and_type_to_services.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnProjectIdAndTypeToServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_services_on_project_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :services, [:project_id, :type] - - remove_concurrent_index_by_name :services, INDEX_NAME - end - - def down - add_concurrent_index :services, :project_id, name: INDEX_NAME - - remove_concurrent_index :services, [:project_id, :type] - end -end diff --git a/db/migrate/20200306193236_add_index_on_creator_id_and_created_at_to_projects.rb b/db/migrate/20200306193236_add_index_on_creator_id_and_created_at_to_projects.rb deleted file mode 100644 index 913383d32f4..00000000000 --- a/db/migrate/20200306193236_add_index_on_creator_id_and_created_at_to_projects.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnCreatorIdAndCreatedAtToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_projects_on_creator_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:creator_id, :created_at] - - remove_concurrent_index_by_name :projects, INDEX_NAME - end - - def down - add_concurrent_index :projects, :creator_id, name: INDEX_NAME - - remove_concurrent_index :projects, [:creator_id, :created_at] - end -end diff --git a/db/migrate/20200309140540_add_index_on_project_id_and_repository_access_level_to_project_features.rb b/db/migrate/20200309140540_add_index_on_project_id_and_repository_access_level_to_project_features.rb deleted file mode 100644 index a2093db0b3b..00000000000 --- a/db/migrate/20200309140540_add_index_on_project_id_and_repository_access_level_to_project_features.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnProjectIdAndRepositoryAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_project_features_on_project_id_ral_20' - - disable_ddl_transaction! - - def up - add_concurrent_index :project_features, :project_id, where: 'repository_access_level = 20', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :project_features, INDEX_NAME - end -end diff --git a/db/migrate/20200309162244_add_open_project_tracker_data.rb b/db/migrate/20200309162244_add_open_project_tracker_data.rb deleted file mode 100644 index 5906eb7ebff..00000000000 --- a/db/migrate/20200309162244_add_open_project_tracker_data.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddOpenProjectTrackerData < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :open_project_tracker_data do |t| - t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false - t.timestamps_with_timezone - t.string :encrypted_url, limit: 255 - t.string :encrypted_url_iv, limit: 255 - t.string :encrypted_api_url, limit: 255 - t.string :encrypted_api_url_iv, limit: 255 - t.string :encrypted_token, limit: 255 - t.string :encrypted_token_iv, limit: 255 - t.string :closed_status_id, limit: 5 - t.string :project_identifier_code, limit: 100 - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200309195209_add_index_on_project_id_and_builds_access_level_to_project_features.rb b/db/migrate/20200309195209_add_index_on_project_id_and_builds_access_level_to_project_features.rb deleted file mode 100644 index 8d6ab60ca48..00000000000 --- a/db/migrate/20200309195209_add_index_on_project_id_and_builds_access_level_to_project_features.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnProjectIdAndBuildsAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_project_features_on_project_id_bal_20' - - disable_ddl_transaction! - - def up - add_concurrent_index :project_features, :project_id, where: 'builds_access_level = 20', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :project_features, INDEX_NAME - end -end diff --git a/db/migrate/20200309195710_add_index_on_mirror_and_creator_id_and_created_at_to_projects.rb b/db/migrate/20200309195710_add_index_on_mirror_and_creator_id_and_created_at_to_projects.rb deleted file mode 100644 index e1bdb5d7a0d..00000000000 --- a/db/migrate/20200309195710_add_index_on_mirror_and_creator_id_and_created_at_to_projects.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnMirrorAndCreatorIdAndCreatedAtToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_projects_on_mirror_creator_id_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:creator_id, :created_at], where: 'mirror = true and mirror_trigger_builds = true', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, INDEX_NAME - end -end diff --git a/db/migrate/20200310123229_add_index_on_enabled_and_provider_type_and_id_to_clusters.rb b/db/migrate/20200310123229_add_index_on_enabled_and_provider_type_and_id_to_clusters.rb deleted file mode 100644 index edd9343e743..00000000000 --- a/db/migrate/20200310123229_add_index_on_enabled_and_provider_type_and_id_to_clusters.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnEnabledAndProviderTypeAndIdToClusters < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :clusters, [:enabled, :provider_type, :id] - remove_concurrent_index :clusters, :enabled - end - - def down - add_concurrent_index :clusters, :enabled - remove_concurrent_index :clusters, [:enabled, :provider_type, :id] - end -end diff --git a/db/migrate/20200310132654_add_instance_to_services.rb b/db/migrate/20200310132654_add_instance_to_services.rb deleted file mode 100644 index 5f3c3e8616b..00000000000 --- a/db/migrate/20200310132654_add_instance_to_services.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddInstanceToServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - # rubocop:disable Migration/AddColumnWithDefault - # rubocop:disable Migration/UpdateLargeTable - def up - add_column_with_default(:services, :instance, :boolean, default: false) - end - # rubocop:enable Migration/AddColumnWithDefault - # rubocop:enable Migration/UpdateLargeTable - - def down - remove_column(:services, :instance) - end -end diff --git a/db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb b/db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb deleted file mode 100644 index 8005da5fbae..00000000000 --- a/db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnAuthorIdAndIdAndCreatedAtToNotes < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :notes, [:author_id, :created_at] - remove_concurrent_index :notes, [:author_id] - end - - def down - add_concurrent_index :notes, [:author_id] - remove_concurrent_index :notes, [:author_id, :created_at] - end -end diff --git a/db/migrate/20200310135823_add_index_to_service_unique_instance_per_type.rb b/db/migrate/20200310135823_add_index_to_service_unique_instance_per_type.rb deleted file mode 100644 index 1a60c521b71..00000000000 --- a/db/migrate/20200310135823_add_index_to_service_unique_instance_per_type.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToServiceUniqueInstancePerType < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:services, [:type, :instance], unique: true, where: 'instance IS TRUE') - end - - def down - remove_concurrent_index(:services, [:type, :instance]) - end -end diff --git a/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb b/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb deleted file mode 100644 index e76136a5c1f..00000000000 --- a/db/migrate/20200310145304_add_runtime_created_to_ci_job_variables.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddRuntimeCreatedToCiJobVariables < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - DEFAULT_SOURCE = 0 # Equvalent to Ci::JobVariable.internal_source - - def up - add_column_with_default(:ci_job_variables, :source, :integer, limit: 2, default: DEFAULT_SOURCE, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column(:ci_job_variables, :source) - end -end diff --git a/db/migrate/20200311074438_migrate_bot_type_to_user_type.rb b/db/migrate/20200311074438_migrate_bot_type_to_user_type.rb deleted file mode 100644 index b13842794d3..00000000000 --- a/db/migrate/20200311074438_migrate_bot_type_to_user_type.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class MigrateBotTypeToUserType < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute('UPDATE users SET user_type = bot_type WHERE bot_type IS NOT NULL AND user_type IS NULL') - end - - def down - execute('UPDATE users SET user_type = NULL WHERE bot_type IS NOT NULL AND bot_type = user_type') - end -end diff --git a/db/migrate/20200311082301_add_user_state_index.rb b/db/migrate/20200311082301_add_user_state_index.rb deleted file mode 100644 index 953941c2a53..00000000000 --- a/db/migrate/20200311082301_add_user_state_index.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddUserStateIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:users, [:state, :user_type], where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_user_type_internal') - remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal_ee') - remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal') - end - - def down - add_concurrent_index(:users, :state, where: 'ghost IS NOT TRUE AND bot_type IS NULL', name: 'index_users_on_state_and_internal_ee') - add_concurrent_index(:users, :state, where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_internal') - remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal_ee') - end -end diff --git a/db/migrate/20200311084025_add_index_on_user_id_status_created_at_to_deployments.rb b/db/migrate/20200311084025_add_index_on_user_id_status_created_at_to_deployments.rb deleted file mode 100644 index 1744b701f0a..00000000000 --- a/db/migrate/20200311084025_add_index_on_user_id_status_created_at_to_deployments.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnUserIdStatusCreatedAtToDeployments < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :deployments, [:user_id, :status, :created_at] - end - - def down - remove_concurrent_index :deployments, [:user_id, :status, :created_at] - end -end diff --git a/db/migrate/20200311093210_create_user_highest_roles.rb b/db/migrate/20200311093210_create_user_highest_roles.rb deleted file mode 100644 index 36007f196d1..00000000000 --- a/db/migrate/20200311093210_create_user_highest_roles.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateUserHighestRoles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :user_highest_roles, id: false do |t| - t.datetime_with_timezone :updated_at, null: false - t.references :user, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade } - t.integer :highest_access_level - - t.index [:user_id, :highest_access_level] - end - end - end - - def down - with_lock_retries do - drop_table :user_highest_roles - end - end -end diff --git a/db/migrate/20200311094020_add_index_on_id_and_status_to_deployments.rb b/db/migrate/20200311094020_add_index_on_id_and_status_to_deployments.rb deleted file mode 100644 index 77c746ed88b..00000000000 --- a/db/migrate/20200311094020_add_index_on_id_and_status_to_deployments.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnIdAndStatusToDeployments < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :deployments, [:id, :status] - end - - def down - remove_concurrent_index :deployments, [:id, :status] - end -end diff --git a/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb b/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb deleted file mode 100644 index e7fe3e63349..00000000000 --- a/db/migrate/20200311141053_add_ci_pipeline_schedules_to_plan_limits.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddCiPipelineSchedulesToPlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - - DOWNTIME = false - - def up - add_column_with_default(:plan_limits, :ci_pipeline_schedules, :integer, default: 0, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column(:plan_limits, :ci_pipeline_schedules) - end -end diff --git a/db/migrate/20200311141943_insert_ci_pipeline_schedules_plan_limits.rb b/db/migrate/20200311141943_insert_ci_pipeline_schedules_plan_limits.rb deleted file mode 100644 index 2a04781c65e..00000000000 --- a/db/migrate/20200311141943_insert_ci_pipeline_schedules_plan_limits.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class InsertCiPipelineSchedulesPlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - return unless Gitlab.com? - - create_or_update_plan_limit('ci_pipeline_schedules', 'free', 10) - create_or_update_plan_limit('ci_pipeline_schedules', 'bronze', 50) - create_or_update_plan_limit('ci_pipeline_schedules', 'silver', 50) - create_or_update_plan_limit('ci_pipeline_schedules', 'gold', 50) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('ci_pipeline_schedules', 'free', 0) - create_or_update_plan_limit('ci_pipeline_schedules', 'bronze', 0) - create_or_update_plan_limit('ci_pipeline_schedules', 'silver', 0) - create_or_update_plan_limit('ci_pipeline_schedules', 'gold', 0) - end -end diff --git a/db/migrate/20200311154110_create_vulnerability_exports.rb b/db/migrate/20200311154110_create_vulnerability_exports.rb deleted file mode 100644 index 5a3355ab5be..00000000000 --- a/db/migrate/20200311154110_create_vulnerability_exports.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityExports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :vulnerability_exports do |t| - t.timestamps_with_timezone null: false - t.datetime_with_timezone :started_at - t.datetime_with_timezone :finished_at - t.string :status, limit: 255, null: false - t.string :file, limit: 255 - t.bigint :project_id, null: false - t.bigint :author_id, null: false - t.integer :file_store - t.integer :format, limit: 2, null: false, default: 0 - - t.index %i[project_id id], unique: true - t.index %i[author_id] - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200311165635_create_project_export_jobs.rb b/db/migrate/20200311165635_create_project_export_jobs.rb deleted file mode 100644 index 21ff5f488f7..00000000000 --- a/db/migrate/20200311165635_create_project_export_jobs.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CreateProjectExportJobs < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :project_export_jobs do |t| - t.references :project, index: false, null: false, foreign_key: { on_delete: :cascade } - t.timestamps_with_timezone null: false - t.integer :status, limit: 2, null: false, default: 0 - t.string :jid, limit: 100, null: false, unique: true - - t.index [:project_id, :jid] - t.index [:jid], unique: true - t.index [:status] - t.index [:project_id, :status] - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb b/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb deleted file mode 100644 index 7f3366a4900..00000000000 --- a/db/migrate/20200311214912_add_modsecurity_mode_to_ingress_application.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddModsecurityModeToIngressApplication < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:clusters_applications_ingress, :modsecurity_mode, :smallint, default: 0, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column :clusters_applications_ingress, :modsecurity_mode - end -end diff --git a/db/migrate/20200312053852_populate_canonical_emails.rb b/db/migrate/20200312053852_populate_canonical_emails.rb deleted file mode 100644 index 10efffab59c..00000000000 --- a/db/migrate/20200312053852_populate_canonical_emails.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class PopulateCanonicalEmails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - class User < ActiveRecord::Base - include EachBatch - - self.table_name = 'users' - - scope :with_gmail, -> { select(:id, :email).where("email ILIKE '%gmail.com'") } - end - - # Limited to *@gmail.com addresses only as a first iteration, because we know - # Gmail ignores `.` appearing in the Agent name, as well as anything after `+` - - def up - # batch size is the default, 1000 - migration = Gitlab::BackgroundMigration::PopulateCanonicalEmails - migration_name = migration.to_s.demodulize - - queue_background_migration_jobs_by_range_at_intervals( - User.with_gmail, - migration_name, - 1.minute) - end - - def down - # no-op - end -end diff --git a/db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb b/db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb deleted file mode 100644 index 76e5860c2f3..00000000000 --- a/db/migrate/20200312125121_add_index_on_active_and_template_and_type_and_id_to_services.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnActiveAndTemplateAndTypeAndIdToServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_services_on_type_and_id_and_template_when_active' - - disable_ddl_transaction! - - def up - add_concurrent_index :services, [:type, :id, :template], where: 'active = TRUE', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :services, INDEX_NAME - end -end diff --git a/db/migrate/20200312160532_add_index_on_mirror_and_id_to_projects.rb b/db/migrate/20200312160532_add_index_on_mirror_and_id_to_projects.rb deleted file mode 100644 index 3a64b915931..00000000000 --- a/db/migrate/20200312160532_add_index_on_mirror_and_id_to_projects.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnMirrorAndIdToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - OLD_INDEX_NAME = 'index_projects_on_mirror_and_mirror_trigger_builds_both_true' - NEW_INDEX_NAME = 'index_projects_on_mirror_id_where_mirror_and_trigger_builds' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, :id, where: 'mirror = TRUE AND mirror_trigger_builds = TRUE', name: NEW_INDEX_NAME - remove_concurrent_index_by_name :projects, OLD_INDEX_NAME - end - - def down - add_concurrent_index :projects, :id, where: 'mirror IS TRUE AND mirror_trigger_builds IS TRUE', name: OLD_INDEX_NAME - remove_concurrent_index_by_name :projects, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20200312163407_add_index_on_id_and_service_desk_enabled_to_projects.rb b/db/migrate/20200312163407_add_index_on_id_and_service_desk_enabled_to_projects.rb deleted file mode 100644 index 903bd12ddf4..00000000000 --- a/db/migrate/20200312163407_add_index_on_id_and_service_desk_enabled_to_projects.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnIdAndServiceDeskEnabledToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_projects_on_id_service_desk_enabled' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, :id, where: 'service_desk_enabled = true', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, INDEX_NAME - end -end diff --git a/db/migrate/20200313101649_fill_ghost_user_type.rb b/db/migrate/20200313101649_fill_ghost_user_type.rb deleted file mode 100644 index fa0c02e5413..00000000000 --- a/db/migrate/20200313101649_fill_ghost_user_type.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class FillGhostUserType < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute('UPDATE users SET user_type = 5 WHERE ghost IS TRUE AND user_type IS NULL') - end - - def down - execute('UPDATE users SET user_type = NULL WHERE ghost IS TRUE AND user_type IS NOT NULL') - end -end diff --git a/db/migrate/20200313123934_add_index_on_user_id_type_source_type_ldap_and_created_at_to_members.rb b/db/migrate/20200313123934_add_index_on_user_id_type_source_type_ldap_and_created_at_to_members.rb deleted file mode 100644 index c4dde7086c2..00000000000 --- a/db/migrate/20200313123934_add_index_on_user_id_type_source_type_ldap_and_created_at_to_members.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnUserIdTypeSourceTypeLdapAndCreatedAtToMembers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_members_on_user_id_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :members, [:user_id, :created_at], where: "ldap = TRUE AND type = 'GroupMember' AND source_type = 'Namespace'", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :members, INDEX_NAME - end -end diff --git a/db/migrate/20200313202430_add_index_chat_name_service_id.rb b/db/migrate/20200313202430_add_index_chat_name_service_id.rb deleted file mode 100644 index f4a88973751..00000000000 --- a/db/migrate/20200313202430_add_index_chat_name_service_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexChatNameServiceId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :chat_names, :service_id - end - - def down - remove_concurrent_index :chat_names, :service_id - end -end diff --git a/db/migrate/20200313203525_add_invalid_foreign_key_from_chat_name_to_service.rb b/db/migrate/20200313203525_add_invalid_foreign_key_from_chat_name_to_service.rb deleted file mode 100644 index c6e340693f8..00000000000 --- a/db/migrate/20200313203525_add_invalid_foreign_key_from_chat_name_to_service.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddInvalidForeignKeyFromChatNameToService < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :chat_names, :services, column: :service_id, on_delete: :cascade, validate: false - end - - def down - remove_foreign_key_if_exists :chat_names, column: :service_id - end -end diff --git a/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb b/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb deleted file mode 100644 index e8f7a693e99..00000000000 --- a/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -class AddScannedResourcesCountToSecurityScan < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column :security_scans, :scanned_resources_count, :integer - end - - def down - remove_column :security_scans, :scanned_resources_count - end -end diff --git a/db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb b/db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb deleted file mode 100644 index 23e7b5ba7b9..00000000000 --- a/db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnIdAndLdapKeyToKeys < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_keys_on_id_and_ldap_key_type' - - disable_ddl_transaction! - - def up - add_concurrent_index :keys, [:id], where: "type = 'LDAPKey'", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :keys, INDEX_NAME - end -end diff --git a/db/migrate/20200316162648_add_index_on_namespace_id_and_id_to_projects.rb b/db/migrate/20200316162648_add_index_on_namespace_id_and_id_to_projects.rb deleted file mode 100644 index 96fbab1e2ea..00000000000 --- a/db/migrate/20200316162648_add_index_on_namespace_id_and_id_to_projects.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnNamespaceIdAndIdToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:namespace_id, :id] - remove_concurrent_index :projects, :namespace_id - end - - def down - add_concurrent_index :projects, :namespace_id - remove_concurrent_index :projects, [:namespace_id, :id] - end -end diff --git a/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb b/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb deleted file mode 100644 index 84b96c64658..00000000000 --- a/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVulnerabilityExportProjectForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :vulnerability_exports, :projects, column: :project_id, on_delete: :cascade, index: false - end - end - - def down - with_lock_retries do - remove_foreign_key :vulnerability_exports, column: :project_id - end - end -end diff --git a/db/migrate/20200317110602_add_migrating_user_highest_roles_table_index_to_users.rb b/db/migrate/20200317110602_add_migrating_user_highest_roles_table_index_to_users.rb deleted file mode 100644 index e67dc323c39..00000000000 --- a/db/migrate/20200317110602_add_migrating_user_highest_roles_table_index_to_users.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddMigratingUserHighestRolesTableIndexToUsers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_for_migrating_user_highest_roles_table' - - disable_ddl_transaction! - - def up - add_concurrent_index :users, - :id, - where: "state = 'active' AND user_type IS NULL AND bot_type IS NULL AND ghost IS NOT TRUE", - name: INDEX_NAME - end - - def down - remove_concurrent_index :users, :id, name: INDEX_NAME - end -end diff --git a/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb b/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb deleted file mode 100644 index c4f685701b9..00000000000 --- a/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVulnerabilityExportUserForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :vulnerability_exports, :users, column: :author_id, on_delete: :cascade, index: false - end - end - - def down - with_lock_retries do - remove_foreign_key :vulnerability_exports, column: :author_id - end - end -end diff --git a/db/migrate/20200318140400_create_vulnerability_user_mentions.rb b/db/migrate/20200318140400_create_vulnerability_user_mentions.rb deleted file mode 100644 index 919bc94cfa6..00000000000 --- a/db/migrate/20200318140400_create_vulnerability_user_mentions.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityUserMentions < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :vulnerability_user_mentions do |t| - t.references :vulnerability, type: :bigint, index: false, null: false, foreign_key: { on_delete: :cascade } - t.references :note, type: :integer, - index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade } - t.integer :mentioned_users_ids, array: true - t.integer :mentioned_projects_ids, array: true - t.integer :mentioned_groups_ids, array: true - end - - add_index :vulnerability_user_mentions, [:vulnerability_id], where: 'note_id is null', unique: true, name: 'index_vulns_user_mentions_on_vulnerability_id' - add_index :vulnerability_user_mentions, [:vulnerability_id, :note_id], unique: true, name: 'index_vulns_user_mentions_on_vulnerability_id_and_note_id' - end -end diff --git a/db/migrate/20200318152134_adds_sha256_to_package_files.rb b/db/migrate/20200318152134_adds_sha256_to_package_files.rb deleted file mode 100644 index 26d2c1b97d4..00000000000 --- a/db/migrate/20200318152134_adds_sha256_to_package_files.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddsSha256ToPackageFiles < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :packages_package_files, :file_sha256, :binary - end -end diff --git a/db/migrate/20200318162148_add_external_key_to_issues_table.rb b/db/migrate/20200318162148_add_external_key_to_issues_table.rb deleted file mode 100644 index b98937861be..00000000000 --- a/db/migrate/20200318162148_add_external_key_to_issues_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :issues, :external_key, :string, limit: 255 # rubocop:disable Migration/PreventStrings - end - end - - def down - with_lock_retries do - remove_column :issues, :external_key - end - end -end diff --git a/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb b/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb deleted file mode 100644 index adca6c3b493..00000000000 --- a/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:issues, [:project_id, :external_key], unique: true, where: 'external_key IS NOT NULL') - end - - def down - remove_concurrent_index(:issues, [:project_id, :external_key]) - end -end diff --git a/db/migrate/20200318164448_add_external_key_to_epics_table.rb b/db/migrate/20200318164448_add_external_key_to_epics_table.rb deleted file mode 100644 index dee2ca98f36..00000000000 --- a/db/migrate/20200318164448_add_external_key_to_epics_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :epics, :external_key, :string, limit: 255 # rubocop:disable Migration/PreventStrings - end - end - - def down - with_lock_retries do - remove_column :epics, :external_key - end - end -end diff --git a/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb deleted file mode 100644 index 0f3b2dbe3ee..00000000000 --- a/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:epics, [:group_id, :external_key], unique: true, where: 'external_key IS NOT NULL') - end - - def down - remove_concurrent_index(:epics, [:group_id, :external_key]) - end -end diff --git a/db/migrate/20200318175008_add_index_on_id_and_archived_and_pending_delete_to_projects.rb b/db/migrate/20200318175008_add_index_on_id_and_archived_and_pending_delete_to_projects.rb deleted file mode 100644 index 9dba8537764..00000000000 --- a/db/migrate/20200318175008_add_index_on_id_and_archived_and_pending_delete_to_projects.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnIdAndArchivedAndPendingDeleteToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_projects_on_id_and_archived_and_pending_delete' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, :id, where: "archived = FALSE AND pending_delete = FALSE", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, INDEX_NAME - end -end diff --git a/db/migrate/20200318183553_create_pypi_package_metadata.rb b/db/migrate/20200318183553_create_pypi_package_metadata.rb deleted file mode 100644 index 6ebe70da643..00000000000 --- a/db/migrate/20200318183553_create_pypi_package_metadata.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class CreatePypiPackageMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - create_table :packages_pypi_metadata, id: false do |t| - t.references :package, primary_key: true, index: false, default: nil, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint - t.string "required_python", null: false, limit: 50 # rubocop:disable Migration/PreventStrings - end - end -end diff --git a/db/migrate/20200319123041_update_plan_limits_defaults.rb b/db/migrate/20200319123041_update_plan_limits_defaults.rb deleted file mode 100644 index 252af26cb7f..00000000000 --- a/db/migrate/20200319123041_update_plan_limits_defaults.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class UpdatePlanLimitsDefaults < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column_default :plan_limits, :project_hooks, 100 - change_column_default :plan_limits, :group_hooks, 50 - change_column_default :plan_limits, :ci_project_subscriptions, 2 - change_column_default :plan_limits, :ci_pipeline_schedules, 10 - end - - def down - change_column_default :plan_limits, :project_hooks, 0 - change_column_default :plan_limits, :group_hooks, 0 - change_column_default :plan_limits, :ci_project_subscriptions, 0 - change_column_default :plan_limits, :ci_pipeline_schedules, 0 - end -end diff --git a/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb b/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb deleted file mode 100644 index 9e10299b4f8..00000000000 --- a/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class CreateMetricsDashboardAnnotations < ActiveRecord::Migration[6.0] - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :metrics_dashboard_annotations do |t| - t.datetime_with_timezone :starting_at, null: false - t.datetime_with_timezone :ending_at - t.references :environment, index: false, foreign_key: { on_delete: :cascade }, null: true - t.references :cluster, index: false, foreign_key: { on_delete: :cascade }, null: true - t.string :dashboard_path, null: false, limit: 255 - t.string :panel_xid, limit: 255 - t.text :description, null: false, limit: 255 # rubocop:disable Migration/AddLimitToTextColumns - - t.index %i(environment_id dashboard_path starting_at ending_at), where: 'environment_id IS NOT NULL', name: "index_metrics_dashboard_annotations_on_environment_id_and_3_col" - t.index %i(cluster_id dashboard_path starting_at ending_at), where: 'cluster_id IS NOT NULL', name: "index_metrics_dashboard_annotations_on_cluster_id_and_3_columns" - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200319203901_add_index_on_users_unlock_token.rb b/db/migrate/20200319203901_add_index_on_users_unlock_token.rb deleted file mode 100644 index 931e685f3fe..00000000000 --- a/db/migrate/20200319203901_add_index_on_users_unlock_token.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnUsersUnlockToken < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_users_on_unlock_token' - - disable_ddl_transaction! - - def up - add_concurrent_index :users, :unlock_token, unique: true, name: INDEX_NAME - end - - def down - remove_concurrent_index :users, :unlock_token, unique: true, name: INDEX_NAME - end -end diff --git a/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb b/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb deleted file mode 100644 index ca92b395b6f..00000000000 --- a/db/migrate/20200320112455_add_cost_factor_fileds_to_ci_runners.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCostFactorFiledsToCiRunners < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:ci_runners, :public_projects_minutes_cost_factor, :float, allow_null: false, default: 0.0) # rubocop:disable Migration/AddColumnWithDefault - add_column_with_default(:ci_runners, :private_projects_minutes_cost_factor, :float, allow_null: false, default: 1.0) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column(:ci_runners, :public_projects_minutes_cost_factor) - remove_column(:ci_runners, :private_projects_minutes_cost_factor) - end -end diff --git a/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb b/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb deleted file mode 100644 index 6e7c37918e1..00000000000 --- a/db/migrate/20200320123839_add_letsencrypt_errors_to_pages_domains.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddLetsencryptErrorsToPagesDomains < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default :pages_domains, :auto_ssl_failed, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column :pages_domains, :auto_ssl_failed - end -end diff --git a/db/migrate/20200320212400_add_project_show_default_award_emojis.rb b/db/migrate/20200320212400_add_project_show_default_award_emojis.rb deleted file mode 100644 index c8238f75455..00000000000 --- a/db/migrate/20200320212400_add_project_show_default_award_emojis.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddProjectShowDefaultAwardEmojis < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - add_column :project_settings, :show_default_award_emojis, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20200323071918_add_bio_to_user_details.rb b/db/migrate/20200323071918_add_bio_to_user_details.rb deleted file mode 100644 index 9ef9d553215..00000000000 --- a/db/migrate/20200323071918_add_bio_to_user_details.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddBioToUserDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - # rubocop:disable Migration/PreventStrings - def up - # rubocop:disable Migration/AddColumnWithDefault - add_column_with_default(:user_details, :bio, :string, default: '', allow_null: false, limit: 255) - # rubocop:enable Migration/AddColumnWithDefault - end - # rubocop:enable Migration/PreventStrings - - def down - remove_column(:user_details, :bio) - end -end diff --git a/db/migrate/20200323074147_add_temp_index_on_users_bio.rb b/db/migrate/20200323074147_add_temp_index_on_users_bio.rb deleted file mode 100644 index 4b26bb971f5..00000000000 --- a/db/migrate/20200323074147_add_temp_index_on_users_bio.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddTempIndexOnUsersBio < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'tmp_idx_on_user_id_where_bio_is_filled' - - disable_ddl_transaction! - - def up - add_concurrent_index :users, :id, where: "(COALESCE(bio, '') IS DISTINCT FROM '')", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :users, INDEX_NAME - end -end diff --git a/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb b/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb deleted file mode 100644 index 7388d6bbc13..00000000000 --- a/db/migrate/20200323075043_add_max_personal_access_token_lifetime_to_namespaces.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMaxPersonalAccessTokenLifetimeToNamespaces < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespaces, :max_personal_access_token_lifetime, :integer # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :max_personal_access_token_lifetime - end - end -end diff --git a/db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb b/db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb deleted file mode 100644 index d0f63034502..00000000000 --- a/db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnUserAndCreatedAtToCiBuilds < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build' - - def up - add_concurrent_index :ci_builds, [:user_id, :created_at], where: "type = 'Ci::Build'", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :ci_builds, INDEX_NAME - end -end diff --git a/db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb b/db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb deleted file mode 100644 index cacf427dbe4..00000000000 --- a/db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class AddApiIndexesForArchivedProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - PUBLIC_AND_ARCHIVED_INDEX_NAME = "index_projects_api_created_at_id_for_archived_vis20" - ARCHIVED_INDEX_NAME = "index_projects_api_created_at_id_for_archived" - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:created_at, :id], - where: "archived = true AND visibility_level = 20 AND pending_delete = false", - name: PUBLIC_AND_ARCHIVED_INDEX_NAME - - add_concurrent_index :projects, [:created_at, :id], where: "archived = true AND pending_delete = false", - name: ARCHIVED_INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, ARCHIVED_INDEX_NAME - - remove_concurrent_index_by_name :projects, PUBLIC_AND_ARCHIVED_INDEX_NAME - end -end diff --git a/db/migrate/20200324093258_add_index_on_id_creator_id_and_created_at_to_projects_table.rb b/db/migrate/20200324093258_add_index_on_id_creator_id_and_created_at_to_projects_table.rb deleted file mode 100644 index 6c4d59af5d6..00000000000 --- a/db/migrate/20200324093258_add_index_on_id_creator_id_and_created_at_to_projects_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnIdCreatorIdAndCreatedAtToProjectsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_service_desk_enabled_projects_on_id_creator_id_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:id, :creator_id, :created_at], where: '"projects"."service_desk_enabled" = TRUE', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, INDEX_NAME - end -end diff --git a/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb b/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb deleted file mode 100644 index 793dc4678c6..00000000000 --- a/db/migrate/20200324115359_add_namespace_storage_size_limit_to_application_settings.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddNamespaceStorageSizeLimitToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_column_with_default :application_settings, :namespace_storage_size_limit, :bigint, default: 0 # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column :application_settings, :namespace_storage_size_limit - end -end diff --git a/db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb b/db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb deleted file mode 100644 index 8575dd2f080..00000000000 --- a/db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddAllowMergeOnSkippedPipelineToProjectSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_settings, :allow_merge_on_skipped_pipeline, :boolean - end -end diff --git a/db/migrate/20200325104755_add_push_rules_id_to_project_settings.rb b/db/migrate/20200325104755_add_push_rules_id_to_project_settings.rb deleted file mode 100644 index 93de736436b..00000000000 --- a/db/migrate/20200325104755_add_push_rules_id_to_project_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPushRulesIdToProjectSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_settings, :push_rule_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :project_settings, :push_rule_id - end - end -end diff --git a/db/migrate/20200325104756_add_push_rules_foreign_key_to_project_settings.rb b/db/migrate/20200325104756_add_push_rules_foreign_key_to_project_settings.rb deleted file mode 100644 index 41ad8d73b4c..00000000000 --- a/db/migrate/20200325104756_add_push_rules_foreign_key_to_project_settings.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddPushRulesForeignKeyToProjectSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_index :project_settings, :push_rule_id, unique: true - add_concurrent_foreign_key :project_settings, :push_rules, column: :push_rule_id, on_delete: :cascade - end - - def down - remove_foreign_key_if_exists :project_settings, column: :push_rule_id - remove_concurrent_index :project_settings, :push_rule_id - end -end diff --git a/db/migrate/20200325104833_add_push_rules_id_to_application_settings.rb b/db/migrate/20200325104833_add_push_rules_id_to_application_settings.rb deleted file mode 100644 index 4650f1734c0..00000000000 --- a/db/migrate/20200325104833_add_push_rules_id_to_application_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPushRulesIdToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :application_settings, :push_rule_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :application_settings, :push_rule_id - end - end -end diff --git a/db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb b/db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb deleted file mode 100644 index 5263250833d..00000000000 --- a/db/migrate/20200325104834_add_push_rules_foreign_key_to_application_settings.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddPushRulesForeignKeyToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_index :application_settings, :push_rule_id, unique: true - add_concurrent_foreign_key :application_settings, :push_rules, column: :push_rule_id, on_delete: :nullify - end - - def down - remove_concurrent_index :application_settings, :push_rule_id - remove_foreign_key_if_exists :application_settings, column: :push_rule_id - end -end diff --git a/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb b/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb deleted file mode 100644 index 60da96ccf33..00000000000 --- a/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddIssuesCreateLimitToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :issues_create_limit, :integer, default: 300, null: false - end -end diff --git a/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb b/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb deleted file mode 100644 index fbea3ad1227..00000000000 --- a/db/migrate/20200325152327_add_seat_link_enabled_to_application_settings.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddSeatLinkEnabledToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:application_settings, :seat_link_enabled, # rubocop:disable Migration/AddColumnWithDefault - :boolean, - default: true, - allow_null: false) - end - - def down - remove_column(:application_settings, :seat_link_enabled) - end -end diff --git a/db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb b/db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb deleted file mode 100644 index 7e15c3ad11d..00000000000 --- a/db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnNameTypeEqCiBuildToCiBuilds < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_ci_builds_on_name_and_security_type_eq_ci_build' - - def up - add_concurrent_index :ci_builds, [:name, :id], - name: INDEX_NAME, - where: "((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)" - end - - def down - remove_concurrent_index_by_name :ci_builds, INDEX_NAME - end -end diff --git a/db/migrate/20200325183636_add_api_index_for_internal_projects.rb b/db/migrate/20200325183636_add_api_index_for_internal_projects.rb deleted file mode 100644 index ce47f1f3ded..00000000000 --- a/db/migrate/20200325183636_add_api_index_for_internal_projects.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddApiIndexForInternalProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INTERNAL_PROJECTS_INDEX_NAME = "index_projects_api_created_at_id_for_vis10" - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:created_at, :id], - where: "visibility_level = 10 AND pending_delete = false", - name: INTERNAL_PROJECTS_INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, INTERNAL_PROJECTS_INDEX_NAME - end -end diff --git a/db/migrate/20200326114443_create_jira_imports_table.rb b/db/migrate/20200326114443_create_jira_imports_table.rb deleted file mode 100644 index d53ccb166b0..00000000000 --- a/db/migrate/20200326114443_create_jira_imports_table.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateJiraImportsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - # rubocop:disable Migration/PreventStrings - def change - create_table :jira_imports do |t| - t.integer :project_id, null: false, limit: 8 - t.integer :user_id, limit: 8 - t.integer :label_id, limit: 8 - t.timestamps_with_timezone - t.datetime_with_timezone :finished_at - t.integer :jira_project_xid, null: false, limit: 8 - t.integer :total_issue_count, null: false, default: 0, limit: 4 - t.integer :imported_issues_count, null: false, default: 0, limit: 4 - t.integer :failed_to_import_count, null: false, default: 0, limit: 4 - t.integer :status, limit: 2, null: false, default: 0 - t.string :jid, limit: 255 - t.string :jira_project_key, null: false, limit: 255 - t.string :jira_project_name, null: false, limit: 255 - end - - add_index :jira_imports, [:project_id, :jira_project_key], name: 'index_jira_imports_on_project_id_and_jira_project_key' - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200326122700_create_diff_note_positions.rb b/db/migrate/20200326122700_create_diff_note_positions.rb deleted file mode 100644 index d37f7fef078..00000000000 --- a/db/migrate/20200326122700_create_diff_note_positions.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class CreateDiffNotePositions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # rubocop:disable Migration/PreventStrings - def up - with_lock_retries do - create_table :diff_note_positions do |t| - t.references :note, foreign_key: { on_delete: :cascade }, null: false, index: false - t.integer :old_line - t.integer :new_line - t.integer :diff_content_type, limit: 2, null: false - t.integer :diff_type, limit: 2, null: false - t.string :line_code, limit: 255, null: false - t.binary :base_sha, null: false - t.binary :start_sha, null: false - t.binary :head_sha, null: false - t.text :old_path, null: false - t.text :new_path, null: false - - t.index [:note_id, :diff_type], unique: true - end - end - end - # rubocop:enable Migration/PreventStrings - # rubocop:enable Migration/AddLimitToTextColumns - - def down - drop_table :diff_note_positions - end -end diff --git a/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb deleted file mode 100644 index 654d35619e3..00000000000 --- a/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddProjectsFkToJiraImportsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :jira_imports, :projects, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :jira_imports, :projects - end - end -end diff --git a/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb deleted file mode 100644 index 429f72628e2..00000000000 --- a/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUsersFkToJiraImportsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :jira_imports, :users, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :jira_imports, :users - end - end -end diff --git a/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb b/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb deleted file mode 100644 index 5a26672f305..00000000000 --- a/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddUsersFkIndexOnJiraImportsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :jira_imports, :user_id - end - - def down - remove_concurrent_index :jira_imports, :user_id - end -end diff --git a/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb deleted file mode 100644 index 9bcadcb61c1..00000000000 --- a/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddLabelsFkToJiraImportsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :jira_imports, :labels, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :jira_imports, :labels - end - end -end diff --git a/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb b/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb deleted file mode 100644 index d71c6f07989..00000000000 --- a/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddLabelsFkIndexOnJiraImportsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :jira_imports, :label_id - end - - def down - remove_concurrent_index :jira_imports, :label_id - end -end diff --git a/db/migrate/20200330074719_add_index_for_group_vsm_usage_ping.rb b/db/migrate/20200330074719_add_index_for_group_vsm_usage_ping.rb deleted file mode 100644 index 55ae2383d71..00000000000 --- a/db/migrate/20200330074719_add_index_for_group_vsm_usage_ping.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexForGroupVsmUsagePing < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_analytics_cycle_analytics_group_stages_custom_only' - - disable_ddl_transaction! - - def up - add_concurrent_index :analytics_cycle_analytics_group_stages, :id, where: 'custom = true', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :analytics_cycle_analytics_group_stages, INDEX_NAME - end -end diff --git a/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb b/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb deleted file mode 100644 index 4db227728c8..00000000000 --- a/db/migrate/20200330121000_add_confidential_attribute_to_epics.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddConfidentialAttributeToEpics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:epics, :confidential, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column(:epics, :confidential) - end -end diff --git a/db/migrate/20200330123739_remove_index_ci_builds_on_name_for_security_reports_values.rb b/db/migrate/20200330123739_remove_index_ci_builds_on_name_for_security_reports_values.rb deleted file mode 100644 index 7ab57183e18..00000000000 --- a/db/migrate/20200330123739_remove_index_ci_builds_on_name_for_security_reports_values.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexCiBuildsOnNameForSecurityReportsValues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_ci_builds_on_name_for_security_reports_values' - - def up - remove_concurrent_index_by_name :ci_builds, INDEX_NAME - end - - def down - add_concurrent_index :ci_builds, - :name, - name: INDEX_NAME, - where: "((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('license_scanning'::character varying)::text]))" - end -end diff --git a/db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb b/db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb deleted file mode 100644 index 3b0a63ee565..00000000000 --- a/db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnAuthorIdAndCreatedAtAndIdToNotes < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :notes, [:author_id, :created_at, :id] - remove_concurrent_index :notes, [:author_id, :created_at] - end - - def down - add_concurrent_index :notes, [:author_id, :created_at] - remove_concurrent_index :notes, [:author_id, :created_at, :id] - end -end diff --git a/db/migrate/20200330203826_drop_fk_in_ci_ref.rb b/db/migrate/20200330203826_drop_fk_in_ci_ref.rb deleted file mode 100644 index 08cb4aaddab..00000000000 --- a/db/migrate/20200330203826_drop_fk_in_ci_ref.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class DropFkInCiRef < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - remove_foreign_key_if_exists :ci_refs, column: :project_id - end - with_lock_retries do - remove_foreign_key_if_exists :ci_refs, column: :last_updated_by_pipeline_id - end - end - - def down - add_foreign_key_if_not_exists :ci_refs, :projects, column: :project_id, on_delete: :cascade - add_foreign_key_if_not_exists :ci_refs, :ci_pipelines, column: :last_updated_by_pipeline_id, on_delete: :nullify - end - - private - - def add_foreign_key_if_not_exists(source, target, column:, on_delete:) - return unless table_exists?(source) - return if foreign_key_exists?(source, target, column: column) - - add_concurrent_foreign_key(source, target, column: column, on_delete: on_delete) - end -end diff --git a/db/migrate/20200330203837_recreate_ci_ref.rb b/db/migrate/20200330203837_recreate_ci_ref.rb deleted file mode 100644 index 734795f594f..00000000000 --- a/db/migrate/20200330203837_recreate_ci_ref.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -class RecreateCiRef < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - UNKNOWN_STATUS = 0 - - def up - with_lock_retries do - # rubocop:disable Migration/DropTable - drop_table :ci_refs - # rubocop:enable Migration/DropTable - - create_table :ci_refs do |t| - t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }, type: :bigint - t.integer :lock_version, null: false, default: 0 - t.integer :status, null: false, limit: 2, default: UNKNOWN_STATUS - t.text :ref_path, null: false # rubocop: disable Migration/AddLimitToTextColumns - t.index [:project_id, :ref_path], unique: true - end - end - end - - def down - with_lock_retries do - drop_table :ci_refs - - create_table :ci_refs do |t| - t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }, type: :integer - t.integer :lock_version, default: 0 - t.integer :last_updated_by_pipeline_id - t.boolean :tag, default: false, null: false - t.string :ref, null: false, limit: 255 - t.string :status, null: false, limit: 255 - t.foreign_key :ci_pipelines, column: :last_updated_by_pipeline_id, on_delete: :nullify - t.index [:project_id, :ref, :tag], unique: true - t.index [:last_updated_by_pipeline_id] - end - end - end -end diff --git a/db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb b/db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb deleted file mode 100644 index 9f2780670dc..00000000000 --- a/db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCiRefIdToCiPipelines < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :ci_pipelines, :ci_ref_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :ci_pipelines, :ci_ref_id, :bigint - end - end -end diff --git a/db/migrate/20200331113728_add_index_to_ci_ref_id.rb b/db/migrate/20200331113728_add_index_to_ci_ref_id.rb deleted file mode 100644 index d3495fd4fa1..00000000000 --- a/db/migrate/20200331113728_add_index_to_ci_ref_id.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToCiRefId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_index :ci_pipelines, [:ci_ref_id], where: 'ci_ref_id IS NOT NULL' - end - - def down - remove_concurrent_index :ci_pipelines, [:ci_ref_id], where: 'ci_ref_id IS NOT NULL' - end -end diff --git a/db/migrate/20200331113738_add_fk_to_ci_ref_id.rb b/db/migrate/20200331113738_add_fk_to_ci_ref_id.rb deleted file mode 100644 index 1a7a76904b1..00000000000 --- a/db/migrate/20200331113738_add_fk_to_ci_ref_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddFkToCiRefId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :ci_pipelines, :ci_refs, column: :ci_ref_id, on_delete: :nullify - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :ci_pipelines, column: :ci_ref_id - end - end -end diff --git a/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb b/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb deleted file mode 100644 index 6af8c6db939..00000000000 --- a/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddProjectComplianceFrameworkSettingsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :project_compliance_framework_settings, id: false do |t| - t.references :project, primary_key: true, null: false, index: true, foreign_key: { on_delete: :cascade } - t.integer :framework, null: false, limit: 2 - end - end - end - - def down - with_lock_retries do - drop_table :project_compliance_framework_settings - end - end -end diff --git a/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb b/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb deleted file mode 100644 index b4cbb04b93a..00000000000 --- a/db/migrate/20200331195952_add_container_expiration_policies_enable_historic_entries_to_application_settings.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddContainerExpirationPoliciesEnableHistoricEntriesToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault - :container_expiration_policies_enable_historic_entries, - :boolean, - default: false, - allow_null: false) - end - - def down - remove_column(:application_settings, - :container_expiration_policies_enable_historic_entries) - end -end diff --git a/db/migrate/20200331220930_enable_container_expiration_policies_by_default.rb b/db/migrate/20200331220930_enable_container_expiration_policies_by_default.rb deleted file mode 100644 index 46393416eb7..00000000000 --- a/db/migrate/20200331220930_enable_container_expiration_policies_by_default.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class EnableContainerExpirationPoliciesByDefault < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :container_expiration_policies, :enabled, true - end - end - - def down - with_lock_retries do - change_column_default :container_expiration_policies, :enabled, false - end - end -end diff --git a/db/migrate/20200401095430_add_jsonb_to_geo_node_status_table.rb b/db/migrate/20200401095430_add_jsonb_to_geo_node_status_table.rb deleted file mode 100644 index 46eb826341c..00000000000 --- a/db/migrate/20200401095430_add_jsonb_to_geo_node_status_table.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddJsonbToGeoNodeStatusTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_table :geo_node_statuses do |t| - t.jsonb :status, null: false, default: {} - end - end -end diff --git a/db/migrate/20200401211005_create_operations_user_lists.rb b/db/migrate/20200401211005_create_operations_user_lists.rb deleted file mode 100644 index b0b02ca8886..00000000000 --- a/db/migrate/20200401211005_create_operations_user_lists.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreateOperationsUserLists < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :operations_user_lists do |t| - t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false - t.timestamps_with_timezone - t.integer :iid, null: false - t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings - t.text :user_xids, null: false, default: '' # rubocop:disable Migration/AddLimitToTextColumns - - t.index [:project_id, :iid], unique: true - t.index [:project_id, :name], unique: true - end - end -end diff --git a/db/migrate/20200402001106_add_cluster_type_index_to_clusters.rb b/db/migrate/20200402001106_add_cluster_type_index_to_clusters.rb deleted file mode 100644 index b328b8681c1..00000000000 --- a/db/migrate/20200402001106_add_cluster_type_index_to_clusters.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddClusterTypeIndexToClusters < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - INDEX_NAME = 'index_clusters_on_enabled_cluster_type_id_and_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :clusters, [:enabled, :cluster_type, :id, :created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :clusters, INDEX_NAME - end -end diff --git a/db/migrate/20200402115013_add_index_on_modsecurity_to_ingress.rb b/db/migrate/20200402115013_add_index_on_modsecurity_to_ingress.rb deleted file mode 100644 index 8bd2d957092..00000000000 --- a/db/migrate/20200402115013_add_index_on_modsecurity_to_ingress.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnModsecurityToIngress < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_clusters_applications_ingress_on_modsecurity' - - disable_ddl_transaction! - - def up - add_concurrent_index :clusters_applications_ingress, [:modsecurity_enabled, :modsecurity_mode, :cluster_id], name: INDEX_NAME - end - - def down - remove_concurrent_index :clusters_applications_ingress, [:modsecurity_enabled, :modsecurity_mode, :cluster_id], name: INDEX_NAME - end -end diff --git a/db/migrate/20200402115623_add_index_on_successful_deployment_and_environment_id_to_deployments.rb b/db/migrate/20200402115623_add_index_on_successful_deployment_and_environment_id_to_deployments.rb deleted file mode 100644 index c86f7ad63f0..00000000000 --- a/db/migrate/20200402115623_add_index_on_successful_deployment_and_environment_id_to_deployments.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnSuccessfulDeploymentAndEnvironmentIdToDeployments < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_successful_deployments_on_cluster_id_and_environment_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :deployments, [:cluster_id, :environment_id], where: 'status = 2', name: INDEX_NAME - end - - def down - remove_concurrent_index :deployments, [:cluster_id, :environment_id], where: 'status = 2', name: INDEX_NAME - end -end diff --git a/db/migrate/20200402123926_add_line_metrics_to_mr_metrics.rb b/db/migrate/20200402123926_add_line_metrics_to_mr_metrics.rb deleted file mode 100644 index 1ca106e1614..00000000000 --- a/db/migrate/20200402123926_add_line_metrics_to_mr_metrics.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddLineMetricsToMrMetrics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :merge_request_metrics, :added_lines, :integer - add_column :merge_request_metrics, :removed_lines, :integer - end - end - - def down - with_lock_retries do - remove_column :merge_request_metrics, :added_lines, :integer - remove_column :merge_request_metrics, :removed_lines, :integer - end - end -end diff --git a/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb b/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb deleted file mode 100644 index 97eb01529cc..00000000000 --- a/db/migrate/20200402124802_add_correlation_id_to_project_import_state.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddCorrelationIdToProjectImportState < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def up - with_lock_retries do - add_column :project_mirror_data, :correlation_id_value, :string, limit: 128 - end - end - # rubocop:enable Migration/PreventStrings - - def down - with_lock_retries do - remove_column :project_mirror_data, :correlation_id_value - end - end -end diff --git a/db/migrate/20200402135250_add_delete_status_to_container_repository.rb b/db/migrate/20200402135250_add_delete_status_to_container_repository.rb deleted file mode 100644 index a0dbb307bfc..00000000000 --- a/db/migrate/20200402135250_add_delete_status_to_container_repository.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddDeleteStatusToContainerRepository < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column(:container_repositories, :status, :integer, limit: 2) - end - - def down - remove_column(:container_repositories, :status) - end -end diff --git a/db/migrate/20200402185044_create_clusters_applications_fluentd.rb b/db/migrate/20200402185044_create_clusters_applications_fluentd.rb deleted file mode 100644 index 2116b2ffe01..00000000000 --- a/db/migrate/20200402185044_create_clusters_applications_fluentd.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class CreateClustersApplicationsFluentd < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - create_table :clusters_applications_fluentd do |t| - t.integer :protocol, null: false, limit: 2 - t.integer :status, null: false - t.integer :port, null: false - t.references :cluster, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } - t.timestamps_with_timezone null: false - t.string :version, null: false, limit: 255 - t.string :host, null: false, limit: 255 - t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns - end - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200403184110_add_partial_index_on_id_to_ci_job_artifacts.rb b/db/migrate/20200403184110_add_partial_index_on_id_to_ci_job_artifacts.rb deleted file mode 100644 index f5f9f167df3..00000000000 --- a/db/migrate/20200403184110_add_partial_index_on_id_to_ci_job_artifacts.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddPartialIndexOnIdToCiJobArtifacts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_job_artifacts_file_store_is_null' - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_job_artifacts, :id, where: 'file_store IS NULL', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME - end -end diff --git a/db/migrate/20200403185127_add_partial_index_on_id_to_lfs_objects.rb b/db/migrate/20200403185127_add_partial_index_on_id_to_lfs_objects.rb deleted file mode 100644 index e72bb37eb0e..00000000000 --- a/db/migrate/20200403185127_add_partial_index_on_id_to_lfs_objects.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddPartialIndexOnIdToLfsObjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_lfs_objects_file_store_is_null' - - disable_ddl_transaction! - - def up - add_concurrent_index :lfs_objects, :id, where: 'file_store IS NULL', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :lfs_objects, INDEX_NAME - end -end diff --git a/db/migrate/20200403185422_add_partial_index_on_id_to_uploads.rb b/db/migrate/20200403185422_add_partial_index_on_id_to_uploads.rb deleted file mode 100644 index e5b532bad61..00000000000 --- a/db/migrate/20200403185422_add_partial_index_on_id_to_uploads.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddPartialIndexOnIdToUploads < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_uploads_store_is_null' - - disable_ddl_transaction! - - def up - add_concurrent_index :uploads, :id, where: 'store IS NULL', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :uploads, INDEX_NAME - end -end diff --git a/db/migrate/20200406095930_add_needs_ssl_renewal_user_provided_pages_domains_index.rb b/db/migrate/20200406095930_add_needs_ssl_renewal_user_provided_pages_domains_index.rb deleted file mode 100644 index 73db5e71b94..00000000000 --- a/db/migrate/20200406095930_add_needs_ssl_renewal_user_provided_pages_domains_index.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddNeedsSslRenewalUserProvidedPagesDomainsIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal_user_provided' - INDEX_SCOPE = "auto_ssl_enabled = true AND auto_ssl_failed = false AND certificate_source = 0" - - disable_ddl_transaction! - - def up - add_concurrent_index(:pages_domains, :id, where: INDEX_SCOPE, name: INDEX_NAME) - end - - def down - remove_concurrent_index(:pages_domains, :id, where: INDEX_SCOPE, name: INDEX_NAME) - end -end diff --git a/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb b/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb deleted file mode 100644 index 3c5db9ec082..00000000000 --- a/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddNeedsSslRenewalValidNotAfterPagesDomainsIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal_valid_not_after' - INDEX_SCOPE = "auto_ssl_enabled = true AND auto_ssl_failed = false" - - disable_ddl_transaction! - - def up - add_concurrent_index(:pages_domains, :certificate_valid_not_after, where: INDEX_SCOPE, name: INDEX_NAME) - end - - def down - remove_concurrent_index(:pages_domains, :certificate_valid_not_after, where: INDEX_SCOPE, name: INDEX_NAME) - end -end diff --git a/db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb b/db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb deleted file mode 100644 index 67ffba6af5e..00000000000 --- a/db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToDeploymentsWhereClusterIdIsNotNull < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :deployments, :id, where: 'cluster_id IS NOT NULL', name: 'index_deployments_on_id_where_cluster_id_present' - end - - def down - remove_concurrent_index :deployments, :id, where: 'cluster_id IS NOT NULL', name: 'index_deployments_on_id_where_cluster_id_present' - end -end diff --git a/db/migrate/20200406132529_add_resource_state_events_table.rb b/db/migrate/20200406132529_add_resource_state_events_table.rb deleted file mode 100644 index ce241dff4dd..00000000000 --- a/db/migrate/20200406132529_add_resource_state_events_table.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddResourceStateEventsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :resource_state_events, id: :bigserial do |t| - t.bigint :user_id, null: false - t.bigint :issue_id, null: true - t.bigint :merge_request_id, null: true - - t.datetime_with_timezone :created_at, null: false - t.integer :state, limit: 2, null: false - - t.index [:issue_id, :created_at], name: 'index_resource_state_events_on_issue_id_and_created_at' - t.index [:user_id], name: 'index_resource_state_events_on_user_id' - t.index [:merge_request_id], name: 'index_resource_state_events_on_merge_request_id' - end - end -end diff --git a/db/migrate/20200406135648_add_index_to_created_at_on_resource_milestone_events.rb b/db/migrate/20200406135648_add_index_to_created_at_on_resource_milestone_events.rb deleted file mode 100644 index 6b8b981990d..00000000000 --- a/db/migrate/20200406135648_add_index_to_created_at_on_resource_milestone_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToCreatedAtOnResourceMilestoneEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - INDEX_NAME = 'index_resource_milestone_events_created_at' - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :resource_milestone_events, :created_at, name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :resource_milestone_events, INDEX_NAME - end -end diff --git a/db/migrate/20200406141452_add_index_to_issue_id_and_created_at_on_resource_weight_events.rb b/db/migrate/20200406141452_add_index_to_issue_id_and_created_at_on_resource_weight_events.rb deleted file mode 100644 index 94a1b589ff9..00000000000 --- a/db/migrate/20200406141452_add_index_to_issue_id_and_created_at_on_resource_weight_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToIssueIdAndCreatedAtOnResourceWeightEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - INDEX_NAME = 'index_resource_weight_events_on_issue_id_and_created_at' - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :resource_weight_events, [:issue_id, :created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :resource_weight_events, INDEX_NAME - end -end diff --git a/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb b/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb deleted file mode 100644 index 9d1628bc42a..00000000000 --- a/db/migrate/20200406192059_add_write_registry_to_deploy_tokens.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddWriteRegistryToDeployTokens < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:deploy_tokens, :write_registry, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column(:deploy_tokens, :write_registry) - end -end diff --git a/db/migrate/20200407120000_add_push_rule_id_to_groups.rb b/db/migrate/20200407120000_add_push_rule_id_to_groups.rb deleted file mode 100644 index 738f0a4c605..00000000000 --- a/db/migrate/20200407120000_add_push_rule_id_to_groups.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPushRuleIdToGroups < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespaces, :push_rule_id, :bigint # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :push_rule_id - end - end -end diff --git a/db/migrate/20200407121321_add_push_rule_foreign_key_to_groups.rb b/db/migrate/20200407121321_add_push_rule_foreign_key_to_groups.rb deleted file mode 100644 index acc74b43659..00000000000 --- a/db/migrate/20200407121321_add_push_rule_foreign_key_to_groups.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddPushRuleForeignKeyToGroups < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_index :namespaces, :push_rule_id, unique: true - add_concurrent_foreign_key :namespaces, :push_rules, column: :push_rule_id, on_delete: :nullify - end - - def down - remove_foreign_key_if_exists :namespaces, column: :push_rule_id - remove_concurrent_index :namespaces, :push_rule_id - end -end diff --git a/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb b/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb deleted file mode 100644 index 79532b8179c..00000000000 --- a/db/migrate/20200407171133_add_protected_tag_create_access_levels_user_id_foreign_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddProtectedTagCreateAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_protected_tag_create_access_levels_user_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - add_foreign_key(:protected_tag_create_access_levels, :users, on_delete: :cascade, validate: false, name: CONSTRAINT_NAME) - remove_foreign_key_if_exists(:protected_tag_create_access_levels, column: :user_id, on_delete: nil) - end - end - - def down - fk_exists = foreign_key_exists?(:protected_tag_create_access_levels, :users, column: :user_id, on_delete: nil) - - unless fk_exists - with_lock_retries do - add_foreign_key(:protected_tag_create_access_levels, :users, column: :user_id, validate: false) - end - end - - remove_foreign_key_if_exists(:protected_tag_create_access_levels, column: :user_id, name: CONSTRAINT_NAME) - - fk_name = concurrent_foreign_key_name(:protected_tag_create_access_levels, :user_id, prefix: 'fk_rails_') - validate_foreign_key(:protected_tag_create_access_levels, :user_id, name: fk_name) - end -end diff --git a/db/migrate/20200407171417_validate_protected_tag_create_access_levels_user_id_foreign_key.rb b/db/migrate/20200407171417_validate_protected_tag_create_access_levels_user_id_foreign_key.rb deleted file mode 100644 index baba65e0b7d..00000000000 --- a/db/migrate/20200407171417_validate_protected_tag_create_access_levels_user_id_foreign_key.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class ValidateProtectedTagCreateAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_protected_tag_create_access_levels_user_id' - - def up - validate_foreign_key :protected_tag_create_access_levels, :user_id, name: CONSTRAINT_NAME - end - - def down - # no op - end -end diff --git a/db/migrate/20200407182205_create_partitioned_foreign_keys.rb b/db/migrate/20200407182205_create_partitioned_foreign_keys.rb deleted file mode 100644 index aca8116d2dd..00000000000 --- a/db/migrate/20200407182205_create_partitioned_foreign_keys.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreatePartitionedForeignKeys < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :partitioned_foreign_keys do |t| - t.boolean :cascade_delete, null: false, default: true - t.text :from_table, null: false - t.text :from_column, null: false - t.text :to_table, null: false - t.text :to_column, null: false - end - - add_text_limit :partitioned_foreign_keys, :from_table, 63 - add_text_limit :partitioned_foreign_keys, :from_column, 63 - add_text_limit :partitioned_foreign_keys, :to_table, 63 - add_text_limit :partitioned_foreign_keys, :to_column, 63 - - add_index :partitioned_foreign_keys, [:to_table, :from_table, :from_column], unique: true, - name: "index_partitioned_foreign_keys_unique_index" - end - - def down - drop_table :partitioned_foreign_keys - end -end diff --git a/db/migrate/20200407222647_create_project_repository_storage_moves.rb b/db/migrate/20200407222647_create_project_repository_storage_moves.rb deleted file mode 100644 index 402a1cdd4a6..00000000000 --- a/db/migrate/20200407222647_create_project_repository_storage_moves.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateProjectRepositoryStorageMoves < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :project_repository_storage_moves do |t| - t.timestamps_with_timezone - t.integer :project_id, limit: 8, null: false - t.integer :state, limit: 2, default: 1, null: false - t.text :source_storage_name, null: false - t.text :destination_storage_name, null: false - end - - add_index :project_repository_storage_moves, :project_id - - add_text_limit(:project_repository_storage_moves, :source_storage_name, 255, constraint_name: 'project_repository_storage_moves_source_storage_name') - add_text_limit(:project_repository_storage_moves, :destination_storage_name, 255, constraint_name: 'project_repository_storage_moves_destination_storage_name') - end - - def down - remove_check_constraint(:project_repository_storage_moves, 'project_repository_storage_moves_source_storage_name') - remove_check_constraint(:project_repository_storage_moves, 'project_repository_storage_moves_destination_storage_name') - - drop_table :project_repository_storage_moves - end -end diff --git a/db/migrate/20200408125046_create_ci_freeze_periods.rb b/db/migrate/20200408125046_create_ci_freeze_periods.rb deleted file mode 100644 index 42a385150b8..00000000000 --- a/db/migrate/20200408125046_create_ci_freeze_periods.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CreateCiFreezePeriods < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:ci_freeze_periods) - create_table :ci_freeze_periods do |t| - t.references :project, foreign_key: true, null: false - t.text :freeze_start, null: false - t.text :freeze_end, null: false - t.text :cron_timezone, null: false - - t.timestamps_with_timezone null: false - end - end - - add_text_limit :ci_freeze_periods, :freeze_start, 998 - add_text_limit :ci_freeze_periods, :freeze_end, 998 - add_text_limit :ci_freeze_periods, :cron_timezone, 255 - end - - def down - drop_table :ci_freeze_periods - end -end diff --git a/db/migrate/20200408133211_add_index_on_route_path_trigram.rb b/db/migrate/20200408133211_add_index_on_route_path_trigram.rb deleted file mode 100644 index 3329252bbd3..00000000000 --- a/db/migrate/20200408133211_add_index_on_route_path_trigram.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnRoutePathTrigram < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_routes_on_path_trigram' - - disable_ddl_transaction! - - def up - add_concurrent_index :routes, :path, name: INDEX_NAME, using: :gin, opclass: { path: :gin_trgm_ops } - end - - def down - remove_concurrent_index_by_name(:routes, INDEX_NAME) - end -end diff --git a/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb b/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb deleted file mode 100644 index 2cc91efcc36..00000000000 --- a/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnCreatorIdAndIdOnProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:creator_id, :id] - end - - def down - remove_concurrent_index :projects, [:creator_id, :id] - end -end diff --git a/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb b/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb deleted file mode 100644 index 0c5118c162b..00000000000 --- a/db/migrate/20200408154331_add_protected_branch_merge_access_levels_user_id_foreign_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddProtectedBranchMergeAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_protected_branch_merge_access_levels_user_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - add_foreign_key(:protected_branch_merge_access_levels, :users, on_delete: :cascade, validate: false, name: CONSTRAINT_NAME) - remove_foreign_key_if_exists(:protected_branch_merge_access_levels, column: :user_id, on_delete: nil) - end - end - - def down - fk_exists = foreign_key_exists?(:protected_branch_merge_access_levels, :users, column: :user_id, on_delete: nil) - - unless fk_exists - with_lock_retries do - add_foreign_key(:protected_branch_merge_access_levels, :users, column: :user_id, validate: false) - end - end - - remove_foreign_key_if_exists(:protected_branch_merge_access_levels, column: :user_id, name: CONSTRAINT_NAME) - - fk_name = concurrent_foreign_key_name(:protected_branch_merge_access_levels, :user_id, prefix: 'fk_rails_') - validate_foreign_key(:protected_branch_merge_access_levels, :user_id, name: fk_name) - end -end diff --git a/db/migrate/20200408154349_validate_protected_branch_merge_access_levels_user_id_foreign_key.rb b/db/migrate/20200408154349_validate_protected_branch_merge_access_levels_user_id_foreign_key.rb deleted file mode 100644 index c4ec957d607..00000000000 --- a/db/migrate/20200408154349_validate_protected_branch_merge_access_levels_user_id_foreign_key.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class ValidateProtectedBranchMergeAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_protected_branch_merge_access_levels_user_id' - - def up - validate_foreign_key :protected_branch_merge_access_levels, :user_id, name: CONSTRAINT_NAME - end - - def down - # no op - end -end diff --git a/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb b/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb deleted file mode 100644 index aae79c175bc..00000000000 --- a/db/migrate/20200408154411_add_path_locks_user_id_foreign_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddPathLocksUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_path_locks_user_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - add_foreign_key(:path_locks, :users, on_delete: :cascade, validate: false, name: CONSTRAINT_NAME) - remove_foreign_key_if_exists(:path_locks, column: :user_id, on_delete: nil) - end - end - - def down - fk_exists = foreign_key_exists?(:path_locks, :users, column: :user_id, on_delete: nil) - - unless fk_exists - with_lock_retries do - add_foreign_key(:path_locks, :users, column: :user_id, validate: false) - end - end - - remove_foreign_key_if_exists(:path_locks, column: :user_id, name: CONSTRAINT_NAME) - - fk_name = concurrent_foreign_key_name(:path_locks, :user_id, prefix: 'fk_rails_') - validate_foreign_key(:path_locks, :user_id, name: fk_name) - end -end diff --git a/db/migrate/20200408154428_validate_path_locks_user_id_foreign_key.rb b/db/migrate/20200408154428_validate_path_locks_user_id_foreign_key.rb deleted file mode 100644 index 500409ee44a..00000000000 --- a/db/migrate/20200408154428_validate_path_locks_user_id_foreign_key.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class ValidatePathLocksUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_path_locks_user_id' - - def up - validate_foreign_key :path_locks, :user_id, name: CONSTRAINT_NAME - end - - def down - # no op - end -end diff --git a/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb b/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb deleted file mode 100644 index 1cfe240df05..00000000000 --- a/db/migrate/20200408154455_add_protected_branch_push_access_levels_user_id_foreign_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddProtectedBranchPushAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_protected_branch_push_access_levels_user_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - add_foreign_key(:protected_branch_push_access_levels, :users, on_delete: :cascade, validate: false, name: CONSTRAINT_NAME) - remove_foreign_key_if_exists(:protected_branch_push_access_levels, column: :user_id, on_delete: nil) - end - end - - def down - fk_exists = foreign_key_exists?(:protected_branch_push_access_levels, :users, column: :user_id, on_delete: nil) - - unless fk_exists - with_lock_retries do - add_foreign_key(:protected_branch_push_access_levels, :users, column: :user_id, validate: false) - end - end - - remove_foreign_key_if_exists(:protected_branch_push_access_levels, column: :user_id, name: CONSTRAINT_NAME) - - fk_name = concurrent_foreign_key_name(:protected_branch_push_access_levels, :user_id, prefix: 'fk_rails_') - validate_foreign_key(:protected_branch_push_access_levels, :user_id, name: fk_name) - end -end diff --git a/db/migrate/20200408154533_validate_protected_branch_push_access_levels_user_id_foreign_key.rb b/db/migrate/20200408154533_validate_protected_branch_push_access_levels_user_id_foreign_key.rb deleted file mode 100644 index d6f9cab6d7e..00000000000 --- a/db/migrate/20200408154533_validate_protected_branch_push_access_levels_user_id_foreign_key.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class ValidateProtectedBranchPushAccessLevelsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_protected_branch_push_access_levels_user_id' - - def up - validate_foreign_key :protected_branch_push_access_levels, :user_id, name: CONSTRAINT_NAME - end - - def down - # no op - end -end diff --git a/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb b/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb deleted file mode 100644 index cdb81d73c99..00000000000 --- a/db/migrate/20200408154604_add_u2f_registrations_user_id_foreign_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddU2fRegistrationsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_u2f_registrations_user_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - add_foreign_key(:u2f_registrations, :users, on_delete: :cascade, validate: false, name: CONSTRAINT_NAME) - remove_foreign_key_if_exists(:u2f_registrations, column: :user_id, on_delete: nil) - end - end - - def down - fk_exists = foreign_key_exists?(:u2f_registrations, :users, column: :user_id, on_delete: nil) - - unless fk_exists - with_lock_retries do - add_foreign_key(:u2f_registrations, :users, column: :user_id, validate: false) - end - end - - remove_foreign_key_if_exists(:u2f_registrations, column: :user_id, name: CONSTRAINT_NAME) - - fk_name = concurrent_foreign_key_name(:u2f_registrations, :user_id, prefix: 'fk_rails_') - validate_foreign_key(:u2f_registrations, :user_id, name: fk_name) - end -end diff --git a/db/migrate/20200408154624_validate_u2f_registrations_user_id_foreign_key.rb b/db/migrate/20200408154624_validate_u2f_registrations_user_id_foreign_key.rb deleted file mode 100644 index ff723a4793f..00000000000 --- a/db/migrate/20200408154624_validate_u2f_registrations_user_id_foreign_key.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -# -class ValidateU2fRegistrationsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_u2f_registrations_user_id' - - def up - validate_foreign_key :u2f_registrations, :user_id, name: CONSTRAINT_NAME - end - - def down - # no op - end -end diff --git a/db/migrate/20200408175424_add_index_on_creator_id_created_at_id_to_projects_table.rb b/db/migrate/20200408175424_add_index_on_creator_id_created_at_id_to_projects_table.rb deleted file mode 100644 index 70df38aea17..00000000000 --- a/db/migrate/20200408175424_add_index_on_creator_id_created_at_id_to_projects_table.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnCreatorIdCreatedAtIdToProjectsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:creator_id, :created_at, :id] - end - - def down - remove_concurrent_index :projects, [:creator_id, :created_at, :id] - end -end diff --git a/db/migrate/20200408212219_add_status_page_url_to_status_page_settings.rb b/db/migrate/20200408212219_add_status_page_url_to_status_page_settings.rb deleted file mode 100644 index 3b3849c109c..00000000000 --- a/db/migrate/20200408212219_add_status_page_url_to_status_page_settings.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddStatusPageUrlToStatusPageSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column :status_page_settings, :status_page_url, :text - add_text_limit :status_page_settings, :status_page_url, 1024 - end - - def down - remove_column :status_page_settings, :status_page_url - end -end diff --git a/db/migrate/20200409085956_add_partial_index_on_import_failures_retry_count.rb b/db/migrate/20200409085956_add_partial_index_on_import_failures_retry_count.rb deleted file mode 100644 index 0999f7b4c95..00000000000 --- a/db/migrate/20200409085956_add_partial_index_on_import_failures_retry_count.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddPartialIndexOnImportFailuresRetryCount < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :import_failures, [:project_id, :correlation_id_value], where: 'retry_count = 0' - end - - def down - remove_concurrent_index :import_failures, [:project_id, :correlation_id_value] - end -end diff --git a/db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb b/db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb deleted file mode 100644 index 187ab0aa20b..00000000000 --- a/db/migrate/20200409105455_change_verification_checksum_field_type_in_package_file.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class ChangeVerificationChecksumFieldTypeInPackageFile < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # The use of this column is behind a feature flag that never got enabled, - # so it's safe to remove it in a normal migration - remove_column :packages_package_files, :verification_checksum, :string # rubocop:disable Migration/RemoveColumn - add_column :packages_package_files, :verification_checksum, :binary - end - - def down - remove_column :packages_package_files, :verification_checksum, :binary - add_column :packages_package_files, :verification_checksum, :string - end -end diff --git a/db/migrate/20200409105456_add_checksum_index_to_package_file.rb b/db/migrate/20200409105456_add_checksum_index_to_package_file.rb deleted file mode 100644 index 07762109895..00000000000 --- a/db/migrate/20200409105456_add_checksum_index_to_package_file.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddChecksumIndexToPackageFile < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_package_files, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "packages_packages_verification_checksum_partial" - end - - def down - remove_concurrent_index :packages_package_files, :verification_checksum - end -end diff --git a/db/migrate/20200410104828_add_comment_detail_to_services.rb b/db/migrate/20200410104828_add_comment_detail_to_services.rb deleted file mode 100644 index 61d993cce32..00000000000 --- a/db/migrate/20200410104828_add_comment_detail_to_services.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddCommentDetailToServices < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :services, :comment_detail, :smallint - end - - def down - remove_column :services, :comment_detail - end -end diff --git a/db/migrate/20200410232012_add_metrics_dashboard_access_level_to_project_feature.rb b/db/migrate/20200410232012_add_metrics_dashboard_access_level_to_project_feature.rb deleted file mode 100644 index 2953cdf3429..00000000000 --- a/db/migrate/20200410232012_add_metrics_dashboard_access_level_to_project_feature.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMetricsDashboardAccessLevelToProjectFeature < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_features, :metrics_dashboard_access_level, :integer - end - end - - def down - with_lock_retries do - remove_column :project_features, :metrics_dashboard_access_level, :integer - end - end -end diff --git a/db/migrate/20200411125656_add_package_scopes_to_deploy_tokens.rb b/db/migrate/20200411125656_add_package_scopes_to_deploy_tokens.rb deleted file mode 100644 index e7e2f91d4d1..00000000000 --- a/db/migrate/20200411125656_add_package_scopes_to_deploy_tokens.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPackageScopesToDeployTokens < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:deploy_tokens, :read_package_registry, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault - add_column_with_default(:deploy_tokens, :write_package_registry, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault - end - - def down - remove_column(:deploy_tokens, :read_package_registry) - remove_column(:deploy_tokens, :write_package_registry) - end -end diff --git a/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb b/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb deleted file mode 100644 index 2918aaea93e..00000000000 --- a/db/migrate/20200413072059_add_group_owners_can_manage_default_branch_protection_to_application_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddGroupOwnersCanManageDefaultBranchProtectionToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault - :group_owners_can_manage_default_branch_protection, - :boolean, - default: true) - end - - def down - remove_column :application_settings, :group_owners_can_manage_default_branch_protection - end -end diff --git a/db/migrate/20200413230056_add_waf_and_cilium_logs_to_applications_fluentd.rb b/db/migrate/20200413230056_add_waf_and_cilium_logs_to_applications_fluentd.rb deleted file mode 100644 index 99f6aa0e4a8..00000000000 --- a/db/migrate/20200413230056_add_waf_and_cilium_logs_to_applications_fluentd.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddWafAndCiliumLogsToApplicationsFluentd < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column_with_default(:clusters_applications_fluentd, # rubocop:disable Migration/AddColumnWithDefault - :waf_log_enabled, - :boolean, - default: true, - allow_null: false) - add_column_with_default(:clusters_applications_fluentd, # rubocop:disable Migration/AddColumnWithDefault - :cilium_log_enabled, - :boolean, - default: true, - allow_null: false) - end - - def down - remove_column(:clusters_applications_fluentd, - :waf_log_enabled) - remove_column(:clusters_applications_fluentd, - :cilium_log_enabled) - end -end diff --git a/db/migrate/20200414112444_add_group_id_to_vulnerability_exports.rb b/db/migrate/20200414112444_add_group_id_to_vulnerability_exports.rb deleted file mode 100644 index fad63d53a81..00000000000 --- a/db/migrate/20200414112444_add_group_id_to_vulnerability_exports.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddGroupIdToVulnerabilityExports < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :vulnerability_exports, :group_id, :integer - change_column_null :vulnerability_exports, :project_id, true - end -end diff --git a/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb b/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb deleted file mode 100644 index a3e60b87857..00000000000 --- a/db/migrate/20200414114611_add_group_id_index_and_fk_to_vulnerability_exports.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddGroupIdIndexAndFkToVulnerabilityExports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - GROUP_ID_INDEX_NAME = 'index_vulnerability_exports_on_group_id_not_null' - - disable_ddl_transaction! - - def up - add_concurrent_index(:vulnerability_exports, :group_id, where: 'group_id IS NOT NULL', name: GROUP_ID_INDEX_NAME) - add_concurrent_foreign_key(:vulnerability_exports, :namespaces, column: :group_id) - end - - def down - remove_foreign_key(:vulnerability_exports, column: :group_id) - remove_concurrent_index_by_name(:vulnerability_exports, GROUP_ID_INDEX_NAME) - end -end diff --git a/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb b/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb deleted file mode 100644 index e669faa7fca..00000000000 --- a/db/migrate/20200414115801_change_project_index_on_vulnerability_exports.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class ChangeProjectIndexOnVulnerabilityExports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - OLD_INDEX_NAME = 'index_vulnerability_exports_on_project_id_and_id' - NEW_INDEX_NAME = 'index_vulnerability_exports_on_project_id_not_null' - - disable_ddl_transaction! - - def up - add_concurrent_index(:vulnerability_exports, :project_id, where: 'project_id IS NOT NULL', name: NEW_INDEX_NAME) - remove_concurrent_index_by_name(:vulnerability_exports, OLD_INDEX_NAME) - end - - def down - add_concurrent_index(:vulnerability_exports, [:project_id, :id], unique: true, name: OLD_INDEX_NAME) - remove_concurrent_index_by_name(:vulnerability_exports, NEW_INDEX_NAME) - end -end diff --git a/db/migrate/20200414144547_remove_index_projects_on_creator_id_and_created_at_from_projects.rb b/db/migrate/20200414144547_remove_index_projects_on_creator_id_and_created_at_from_projects.rb deleted file mode 100644 index c4409fcc55d..00000000000 --- a/db/migrate/20200414144547_remove_index_projects_on_creator_id_and_created_at_from_projects.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexProjectsOnCreatorIdAndCreatedAtFromProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_projects_on_creator_id_and_created_at' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :projects, INDEX_NAME - end - - def down - add_concurrent_index :projects, [:creator_id, :created_at], name: INDEX_NAME - end -end diff --git a/db/migrate/20200415153154_add_unique_index_on_plan_name.rb b/db/migrate/20200415153154_add_unique_index_on_plan_name.rb deleted file mode 100644 index d959d1315b4..00000000000 --- a/db/migrate/20200415153154_add_unique_index_on_plan_name.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUniqueIndexOnPlanName < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :plans, :name - add_concurrent_index :plans, :name, unique: true - end - - def down - remove_concurrent_index :plans, :name, unique: true - add_concurrent_index :plans, :name - end -end diff --git a/db/migrate/20200415160722_remove_not_null_lfs_objects_constraint.rb b/db/migrate/20200415160722_remove_not_null_lfs_objects_constraint.rb deleted file mode 100644 index 58cfa8e8969..00000000000 --- a/db/migrate/20200415160722_remove_not_null_lfs_objects_constraint.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullLfsObjectsConstraint < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - execute <<~SQL - ALTER TABLE lfs_objects DROP CONSTRAINT IF EXISTS lfs_objects_file_store_not_null; - SQL - end - end - - def down - # No-op - end -end diff --git a/db/migrate/20200415161021_remove_not_null_ci_job_artifacts_constraint.rb b/db/migrate/20200415161021_remove_not_null_ci_job_artifacts_constraint.rb deleted file mode 100644 index 65430c180ce..00000000000 --- a/db/migrate/20200415161021_remove_not_null_ci_job_artifacts_constraint.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullCiJobArtifactsConstraint < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - execute <<~SQL - ALTER TABLE ci_job_artifacts DROP CONSTRAINT IF EXISTS ci_job_artifacts_file_store_not_null; - SQL - end - end - - def down - # No-op - end -end diff --git a/db/migrate/20200415161206_remove_not_null_uploads_constraint.rb b/db/migrate/20200415161206_remove_not_null_uploads_constraint.rb deleted file mode 100644 index 23f202bac7e..00000000000 --- a/db/migrate/20200415161206_remove_not_null_uploads_constraint.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullUploadsConstraint < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - execute <<~SQL - ALTER TABLE uploads DROP CONSTRAINT IF EXISTS uploads_store_not_null; - SQL - end - end - - def down - # No-op - end -end diff --git a/db/migrate/20200415192656_add_name_regex_keep_to_container_expiration_policies.rb b/db/migrate/20200415192656_add_name_regex_keep_to_container_expiration_policies.rb deleted file mode 100644 index e223d94caf7..00000000000 --- a/db/migrate/20200415192656_add_name_regex_keep_to_container_expiration_policies.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddNameRegexKeepToContainerExpirationPolicies < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'container_expiration_policies_name_regex_keep' - - def up - add_column(:container_expiration_policies, :name_regex_keep, :text) - add_text_limit(:container_expiration_policies, :name_regex_keep, 255, constraint_name: CONSTRAINT_NAME) - end - - def down - remove_check_constraint(:container_expiration_policies, CONSTRAINT_NAME) - remove_column(:container_expiration_policies, :name_regex_keep) - end -end diff --git a/db/migrate/20200415203024_add_offset_pagination_plan_limit.rb b/db/migrate/20200415203024_add_offset_pagination_plan_limit.rb deleted file mode 100644 index b4d4be894f6..00000000000 --- a/db/migrate/20200415203024_add_offset_pagination_plan_limit.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddOffsetPaginationPlanLimit < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :offset_pagination_limit, :integer, default: 50000, null: false - end -end diff --git a/db/migrate/20200416005331_create_status_page_published_incidents.rb b/db/migrate/20200416005331_create_status_page_published_incidents.rb deleted file mode 100644 index 75889cd5bb6..00000000000 --- a/db/migrate/20200416005331_create_status_page_published_incidents.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class CreateStatusPagePublishedIncidents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :status_page_published_incidents do |t| - t.timestamps_with_timezone null: false - t.references :issue, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } - end - end - end - - def down - drop_table :status_page_published_incidents - end -end diff --git a/db/migrate/20200416120128_add_columns_to_terraform_state.rb b/db/migrate/20200416120128_add_columns_to_terraform_state.rb deleted file mode 100644 index 65d25d842e5..00000000000 --- a/db/migrate/20200416120128_add_columns_to_terraform_state.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddColumnsToTerraformState < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/PreventStrings - def change - add_column :terraform_states, :lock_xid, :string, limit: 255 - add_column :terraform_states, :locked_at, :datetime_with_timezone - add_column :terraform_states, :locked_by_user_id, :bigint - add_column :terraform_states, :uuid, :string, limit: 32, null: false # rubocop:disable Rails/NotNullColumn (table not used yet) - add_column :terraform_states, :name, :string, limit: 255 - add_index :terraform_states, :locked_by_user_id # rubocop:disable Migration/AddIndex (table not used yet) - add_index :terraform_states, :uuid, unique: true # rubocop:disable Migration/AddIndex (table not used yet) - add_index :terraform_states, [:project_id, :name], unique: true # rubocop:disable Migration/AddIndex (table not used yet) - remove_index :terraform_states, :project_id # rubocop:disable Migration/RemoveIndex (table not used yet) - end - # rubocop:enable Migration/PreventStrings -end diff --git a/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb b/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb deleted file mode 100644 index 144291d94be..00000000000 --- a/db/migrate/20200416120354_add_locked_by_user_id_foreign_key_to_terraform_state.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddLockedByUserIdForeignKeyToTerraformState < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :terraform_states, :users, column: :locked_by_user_id - end - end - - def down - with_lock_retries do - remove_foreign_key :terraform_states, column: :locked_by_user_id - end - end -end diff --git a/db/migrate/20200417044453_create_alert_management_alerts.rb b/db/migrate/20200417044453_create_alert_management_alerts.rb deleted file mode 100644 index 6221eeeb24b..00000000000 --- a/db/migrate/20200417044453_create_alert_management_alerts.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -class CreateAlertManagementAlerts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:alert_management_alerts) - create_table :alert_management_alerts do |t| - t.timestamps_with_timezone - t.datetime_with_timezone :started_at, null: false - t.datetime_with_timezone :ended_at - t.integer :events, default: 1, null: false - t.integer :iid, null: false - t.integer :severity, default: 0, null: false, limit: 2 - t.integer :status, default: 0, null: false, limit: 2 - t.binary :fingerprint - t.bigint :issue_id, index: true - t.bigint :project_id, null: false - t.text :title, null: false - t.text :description - t.text :service - t.text :monitoring_tool - t.text :hosts, array: true, null: false, default: [] # rubocop:disable Migration/AddLimitToTextColumns - t.jsonb :payload, null: false, default: {} - - t.index %w(project_id iid), name: 'index_alert_management_alerts_on_project_id_and_iid', unique: true, using: :btree - t.index %w(project_id fingerprint), name: 'index_alert_management_alerts_on_project_id_and_fingerprint', unique: true, using: :btree - end - end - - add_text_limit :alert_management_alerts, :title, 200 - add_text_limit :alert_management_alerts, :description, 1000 - add_text_limit :alert_management_alerts, :service, 100 - add_text_limit :alert_management_alerts, :monitoring_tool, 100 - end - - def down - drop_table :alert_management_alerts - end -end diff --git a/db/migrate/20200417075843_remove_and_add_foreign_key_to_project_settings.rb b/db/migrate/20200417075843_remove_and_add_foreign_key_to_project_settings.rb deleted file mode 100644 index 695bd3381c8..00000000000 --- a/db/migrate/20200417075843_remove_and_add_foreign_key_to_project_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RemoveAndAddForeignKeyToProjectSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_project_settings_push_rule_id' - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :project_settings, :push_rules, column: :push_rule_id, name: CONSTRAINT_NAME, on_delete: :nullify - remove_foreign_key_if_exists :project_settings, column: :push_rule_id, on_delete: :cascade - end - - def down - add_concurrent_foreign_key :project_settings, :push_rules, column: :push_rule_id, on_delete: :cascade - remove_foreign_key_if_exists :project_settings, column: :push_rule_id, name: CONSTRAINT_NAME, on_delete: :nullify - end -end diff --git a/db/migrate/20200417145946_add_locked_to_ci_job_artifact.rb b/db/migrate/20200417145946_add_locked_to_ci_job_artifact.rb deleted file mode 100644 index 3bcc733f3b0..00000000000 --- a/db/migrate/20200417145946_add_locked_to_ci_job_artifact.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddLockedToCiJobArtifact < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :ci_job_artifacts, :locked, :boolean - end - end - - def down - with_lock_retries do - remove_column :ci_job_artifacts, :locked - end - end -end diff --git a/db/migrate/20200420092011_add_profile_image_guidelines_to_appearances.rb b/db/migrate/20200420092011_add_profile_image_guidelines_to_appearances.rb deleted file mode 100644 index bab3e21e285..00000000000 --- a/db/migrate/20200420092011_add_profile_image_guidelines_to_appearances.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddProfileImageGuidelinesToAppearances < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column :appearances, :profile_image_guidelines, :text, null: true - add_column :appearances, :profile_image_guidelines_html, :text, null: true # rubocop:disable Migration/AddLimitToTextColumns - - add_text_limit :appearances, :profile_image_guidelines, 4096, constraint_name: 'appearances_profile_image_guidelines' - end - - def down - remove_column :appearances, :profile_image_guidelines - remove_column :appearances, :profile_image_guidelines_html - end -end diff --git a/db/migrate/20200420104303_add_group_import_states_table.rb b/db/migrate/20200420104303_add_group_import_states_table.rb deleted file mode 100644 index a44a2ea75f3..00000000000 --- a/db/migrate/20200420104303_add_group_import_states_table.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class AddGroupImportStatesTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - def up - with_lock_retries do - create_table :group_import_states, id: false do |t| - t.references :group, primary_key: true, foreign_key: { to_table: :namespaces, on_delete: :cascade } - t.timestamps_with_timezone null: false - t.integer :status, limit: 2, null: false, default: 0 - t.text :jid, null: false, unique: true - t.text :last_error - end - end - end - # rubocop:enable Migration/AddLimitToTextColumns - - def down - drop_table :group_import_states - end -end diff --git a/db/migrate/20200420104323_add_text_limit_to_group_import_states.rb b/db/migrate/20200420104323_add_text_limit_to_group_import_states.rb deleted file mode 100644 index c21b18d7b0e..00000000000 --- a/db/migrate/20200420104323_add_text_limit_to_group_import_states.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToGroupImportStates < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :group_import_states, :jid, 100 - add_text_limit :group_import_states, :last_error, 255 - end - - def down - remove_text_limit :group_import_states, :jid - remove_text_limit :group_import_states, :last_error - end -end diff --git a/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb b/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb deleted file mode 100644 index 27130136e9d..00000000000 --- a/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateMetricsUsersStarredDashboard < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # limit added in following migration db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb - # to allow this migration to be run inside the transaction - # rubocop: disable Migration/AddLimitToTextColumns - def up - create_table :metrics_users_starred_dashboards do |t| - t.timestamps_with_timezone - t.bigint :project_id, null: false - t.bigint :user_id, null: false - t.text :dashboard_path, null: false - - t.index :project_id - t.index %i(user_id project_id dashboard_path), name: "idx_metrics_users_starred_dashboard_on_user_project_dashboard", unique: true - end - end - # rubocop: enable Migration/AddLimitToTextColumns - - def down - drop_table :metrics_users_starred_dashboards - end -end diff --git a/db/migrate/20200420141733_add_index_on_enabled_clusters.rb b/db/migrate/20200420141733_add_index_on_enabled_clusters.rb deleted file mode 100644 index 43f4b072c82..00000000000 --- a/db/migrate/20200420141733_add_index_on_enabled_clusters.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnEnabledClusters < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_enabled_clusters_on_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :clusters, [:id], where: 'enabled = true', name: INDEX_NAME - end - - def down - remove_concurrent_index :clusters, [:id], where: 'enabled = true', name: INDEX_NAME - end -end diff --git a/db/migrate/20200420172113_add_text_limit_to_sprints_title.rb b/db/migrate/20200420172113_add_text_limit_to_sprints_title.rb deleted file mode 100644 index 17707cc9dd1..00000000000 --- a/db/migrate/20200420172113_add_text_limit_to_sprints_title.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToSprintsTitle < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'sprints_title' - - def up - add_text_limit :sprints, :title, 255, constraint_name: CONSTRAINT_NAME - end - - def down - remove_check_constraint :sprints, CONSTRAINT_NAME - end -end diff --git a/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb b/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb deleted file mode 100644 index 46b5c9c2ac2..00000000000 --- a/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddSprintsForeignKeyToProjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :sprints, :projects, column: :project_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :sprints, column: :project_id - end - end -end diff --git a/db/migrate/20200420172927_add_sprints_foreign_key_to_groups.rb b/db/migrate/20200420172927_add_sprints_foreign_key_to_groups.rb deleted file mode 100644 index cd90fe50cde..00000000000 --- a/db/migrate/20200420172927_add_sprints_foreign_key_to_groups.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddSprintsForeignKeyToGroups < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :sprints, :namespaces, column: :group_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :sprints, column: :group_id - end - end -end diff --git a/db/migrate/20200420201933_add_check_constraint_to_sprint_must_belong_to_project_or_group.rb b/db/migrate/20200420201933_add_check_constraint_to_sprint_must_belong_to_project_or_group.rb deleted file mode 100644 index 9962eab95e3..00000000000 --- a/db/migrate/20200420201933_add_check_constraint_to_sprint_must_belong_to_project_or_group.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCheckConstraintToSprintMustBelongToProjectOrGroup < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'sprints_must_belong_to_project_or_group' - - def up - add_check_constraint :sprints, '(project_id != NULL AND group_id IS NULL) OR (group_id != NULL AND project_id IS NULL)', CONSTRAINT_NAME - end - - def down - remove_check_constraint :sprints, CONSTRAINT_NAME - end -end diff --git a/db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb b/db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb deleted file mode 100644 index 1a904188fc6..00000000000 --- a/db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexOnPipelineIdFromCiPipelineVariables < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_pipeline_variables_on_pipeline_id' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :ci_pipeline_variables, INDEX_NAME - end - - def down - add_concurrent_index :ci_pipeline_variables, :pipeline_id, name: INDEX_NAME, where: "key = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'" - end -end diff --git a/db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb b/db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb deleted file mode 100644 index f7e6d10e8a3..00000000000 --- a/db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexOnPipelineIdFromCiVariables < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_variables_on_project_id' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :ci_variables, INDEX_NAME - end - - def down - add_concurrent_index :ci_variables, :project_id, name: INDEX_NAME, where: "key = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'" - end -end diff --git a/db/migrate/20200421092907_add_index_container_repository_on_name_trigram_to_container_repository.rb b/db/migrate/20200421092907_add_index_container_repository_on_name_trigram_to_container_repository.rb deleted file mode 100644 index debca8c6008..00000000000 --- a/db/migrate/20200421092907_add_index_container_repository_on_name_trigram_to_container_repository.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexContainerRepositoryOnNameTrigramToContainerRepository < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_container_repository_on_name_trigram' - - disable_ddl_transaction! - - def up - add_concurrent_index :container_repositories, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops } - end - - def down - remove_concurrent_index_by_name(:container_repositories, INDEX_NAME) - end -end diff --git a/db/migrate/20200421111005_create_daily_build_group_report_results.rb b/db/migrate/20200421111005_create_daily_build_group_report_results.rb deleted file mode 100644 index 12d1c7531d5..00000000000 --- a/db/migrate/20200421111005_create_daily_build_group_report_results.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CreateDailyBuildGroupReportResults < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :ci_daily_build_group_report_results do |t| - t.date :date, null: false - t.bigint :project_id, null: false - t.bigint :last_pipeline_id, null: false - t.text :ref_path, null: false # rubocop:disable Migration/AddLimitToTextColumns - t.text :group_name, null: false # rubocop:disable Migration/AddLimitToTextColumns - t.jsonb :data, null: false - - t.index :last_pipeline_id - t.index [:project_id, :ref_path, :date, :group_name], name: 'index_daily_build_group_report_results_unique_columns', unique: true - t.foreign_key :projects, on_delete: :cascade - t.foreign_key :ci_pipelines, column: :last_pipeline_id, on_delete: :cascade - end - end -end diff --git a/db/migrate/20200421233150_add_foreign_keys_for_alert_management_alerts.rb b/db/migrate/20200421233150_add_foreign_keys_for_alert_management_alerts.rb deleted file mode 100644 index b16bdf9830c..00000000000 --- a/db/migrate/20200421233150_add_foreign_keys_for_alert_management_alerts.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeysForAlertManagementAlerts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :alert_management_alerts, :projects, column: :project_id, on_delete: :cascade - add_concurrent_foreign_key :alert_management_alerts, :issues, column: :issue_id, on_delete: :nullify - end - - def down - remove_foreign_key_if_exists :alert_management_alerts, column: :project_id - remove_foreign_key_if_exists :alert_management_alerts, column: :issue_id - end -end diff --git a/db/migrate/20200422091541_create_ci_instance_variables.rb b/db/migrate/20200422091541_create_ci_instance_variables.rb deleted file mode 100644 index ab2a4722f89..00000000000 --- a/db/migrate/20200422091541_create_ci_instance_variables.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateCiInstanceVariables < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:ci_instance_variables) - create_table :ci_instance_variables do |t| - t.integer :variable_type, null: false, limit: 2, default: 1 - t.boolean :masked, default: false, allow_null: false - t.boolean :protected, default: false, allow_null: false - t.text :key, null: false - t.text :encrypted_value - t.text :encrypted_value_iv - - t.index [:key], name: 'index_ci_instance_variables_on_key', unique: true, using: :btree - end - end - - add_text_limit(:ci_instance_variables, :key, 255) - add_text_limit(:ci_instance_variables, :encrypted_value, 1024) - add_text_limit(:ci_instance_variables, :encrypted_value_iv, 255) - end - - def down - drop_table :ci_instance_variables - end -end diff --git a/db/migrate/20200422213749_create_operations_strategies_user_lists.rb b/db/migrate/20200422213749_create_operations_strategies_user_lists.rb deleted file mode 100644 index 113f2f2f54a..00000000000 --- a/db/migrate/20200422213749_create_operations_strategies_user_lists.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class CreateOperationsStrategiesUserLists < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :operations_strategies_user_lists do |t| - t.references :strategy, index: false, foreign_key: { on_delete: :cascade, to_table: :operations_strategies }, null: false - t.references :user_list, index: true, foreign_key: { on_delete: :cascade, to_table: :operations_user_lists }, null: false - - t.index [:strategy_id, :user_list_id], unique: true, name: :index_ops_strategies_user_lists_on_strategy_id_and_user_list_id - end - end -end diff --git a/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb deleted file mode 100644 index 91a6dbe4214..00000000000 --- a/db/migrate/20200423075720_add_user_id_foreign_key_to_resource_state_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUserIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_state_events, :users, column: :user_id, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_state_events, column: :user_id - end - end -end diff --git a/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb deleted file mode 100644 index b9f0fdeaa16..00000000000 --- a/db/migrate/20200423080334_add_issue_id_foreign_key_to_resource_state_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIssueIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_state_events, :issues, column: :issue_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_state_events, column: :issue_id - end - end -end diff --git a/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb b/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb deleted file mode 100644 index 3c070984f9e..00000000000 --- a/db/migrate/20200423080607_add_merge_request_id_foreign_key_to_resource_state_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMergeRequestIdForeignKeyToResourceStateEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_state_events, :merge_requests, column: :merge_request_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_state_events, column: :merge_request_id - end - end -end diff --git a/db/migrate/20200423081409_add_constraint_to_resource_state_events_must_belong_to_issue_or_merge_request.rb b/db/migrate/20200423081409_add_constraint_to_resource_state_events_must_belong_to_issue_or_merge_request.rb deleted file mode 100644 index 57df1045e2c..00000000000 --- a/db/migrate/20200423081409_add_constraint_to_resource_state_events_must_belong_to_issue_or_merge_request.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddConstraintToResourceStateEventsMustBelongToIssueOrMergeRequest < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request' - - def up - add_check_constraint :resource_state_events, '(issue_id != NULL AND merge_request_id IS NULL) OR (merge_request_id != NULL AND issue_id IS NULL)', CONSTRAINT_NAME - end - - def down - remove_check_constraint :resource_state_events, CONSTRAINT_NAME - end -end diff --git a/db/migrate/20200423081441_add_foreign_key_from_users_to_metrics_users_starred_dashboars.rb b/db/migrate/20200423081441_add_foreign_key_from_users_to_metrics_users_starred_dashboars.rb deleted file mode 100644 index c3a7635193c..00000000000 --- a/db/migrate/20200423081441_add_foreign_key_from_users_to_metrics_users_starred_dashboars.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyFromUsersToMetricsUsersStarredDashboars < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :metrics_users_starred_dashboards, :users, column: :user_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :metrics_users_starred_dashboards, column: :user_id - end - end -end diff --git a/db/migrate/20200423081519_add_foreign_key_from_projects_to_metrics_users_starred_dashboars.rb b/db/migrate/20200423081519_add_foreign_key_from_projects_to_metrics_users_starred_dashboars.rb deleted file mode 100644 index 88565c24eca..00000000000 --- a/db/migrate/20200423081519_add_foreign_key_from_projects_to_metrics_users_starred_dashboars.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyFromProjectsToMetricsUsersStarredDashboars < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :metrics_users_starred_dashboards, :projects, column: :project_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :metrics_users_starred_dashboards, column: :project_id - end - end -end diff --git a/db/migrate/20200423101529_add_scheduled_at_to_jira_imports.rb b/db/migrate/20200423101529_add_scheduled_at_to_jira_imports.rb deleted file mode 100644 index f0d9393b6f9..00000000000 --- a/db/migrate/20200423101529_add_scheduled_at_to_jira_imports.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddScheduledAtToJiraImports < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :jira_imports, :scheduled_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20200424050250_remove_orphaned_invited_members.rb b/db/migrate/20200424050250_remove_orphaned_invited_members.rb deleted file mode 100644 index 0fb2f7d9c39..00000000000 --- a/db/migrate/20200424050250_remove_orphaned_invited_members.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class RemoveOrphanedInvitedMembers < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # As of 2020-04-23, there are 19 entries on GitLab.com that match this criteria. - execute "DELETE FROM members WHERE user_id IS NULL AND invite_token IS NULL AND invite_accepted_at IS NOT NULL" - end - - def down - end -end diff --git a/db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb b/db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb deleted file mode 100644 index a5620fd8e29..00000000000 --- a/db/migrate/20200424101920_add_text_limit_to_metrics_users_starred_dashboards_dashboard_path.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToMetricsUsersStarredDashboardsDashboardPath < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_text_limit :metrics_users_starred_dashboards, :dashboard_path, 255 - end - - def down - remove_text_limit :metrics_users_starred_dashboards, :dashboard_path - end -end diff --git a/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb b/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb deleted file mode 100644 index 1adc421b9af..00000000000 --- a/db/migrate/20200424102023_add_shared_runners_enabled_and_override_to_namespaces.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSharedRunnersEnabledAndOverrideToNamespaces < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespaces, :shared_runners_enabled, :boolean, default: true, null: false # rubocop:disable Migration/AddColumnsToWideTables - add_column :namespaces, :allow_descendants_override_disabled_shared_runners, :boolean, default: false, null: false # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :shared_runners_enabled, :boolean - remove_column :namespaces, :allow_descendants_override_disabled_shared_runners, :boolean - end - end -end diff --git a/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb b/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb deleted file mode 100644 index 1043616a1c7..00000000000 --- a/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class CreateNugetDependencyLinkMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'packages_nuget_dependency_link_metadata_target_framework_constr' - - def up - unless table_exists?(:packages_nuget_dependency_link_metadata) - create_table :packages_nuget_dependency_link_metadata, id: false do |t| - t.references :dependency_link, primary_key: true, default: nil, foreign_key: { to_table: :packages_dependency_links, on_delete: :cascade }, index: { name: 'index_packages_nuget_dl_metadata_on_dependency_link_id' }, type: :bigint - t.text :target_framework, null: false - end - end - - add_text_limit :packages_nuget_dependency_link_metadata, :target_framework, 255, constraint_name: CONSTRAINT_NAME - end - - def down - drop_table :packages_nuget_dependency_link_metadata - end -end diff --git a/db/migrate/20200429001827_sprint_rename_state_to_state_enum.rb b/db/migrate/20200429001827_sprint_rename_state_to_state_enum.rb deleted file mode 100644 index 721b9b7c64f..00000000000 --- a/db/migrate/20200429001827_sprint_rename_state_to_state_enum.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class SprintRenameStateToStateEnum < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - rename_column_concurrently :sprints, :state, :state_enum - end - - def down - undo_rename_column_concurrently :sprints, :state, :state_enum - end -end diff --git a/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb b/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb deleted file mode 100644 index 166ce320a23..00000000000 --- a/db/migrate/20200429015603_add_fk_to_project_repository_storage_moves.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddFkToProjectRepositoryStorageMoves < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :project_repository_storage_moves, :projects, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :project_repository_storage_moves, :projects - end - end -end diff --git a/db/migrate/20200429023324_add_composer_metadata.rb b/db/migrate/20200429023324_add_composer_metadata.rb deleted file mode 100644 index 738b630bec1..00000000000 --- a/db/migrate/20200429023324_add_composer_metadata.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddComposerMetadata < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :packages_composer_metadata, id: false do |t| - t.references :package, primary_key: true, index: false, default: nil, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint - t.binary :target_sha, null: false - end - end -end diff --git a/db/migrate/20200429181335_add_default_value_for_file_store_to_lfs_objects.rb b/db/migrate/20200429181335_add_default_value_for_file_store_to_lfs_objects.rb deleted file mode 100644 index f316a092bfc..00000000000 --- a/db/migrate/20200429181335_add_default_value_for_file_store_to_lfs_objects.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultValueForFileStoreToLfsObjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :lfs_objects, :file_store, 1 - end - end - - def down - with_lock_retries do - change_column_default :lfs_objects, :file_store, nil - end - end -end diff --git a/db/migrate/20200429181955_add_default_value_for_file_store_to_ci_job_artifacts.rb b/db/migrate/20200429181955_add_default_value_for_file_store_to_ci_job_artifacts.rb deleted file mode 100644 index ac3d5e41e3e..00000000000 --- a/db/migrate/20200429181955_add_default_value_for_file_store_to_ci_job_artifacts.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultValueForFileStoreToCiJobArtifacts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :ci_job_artifacts, :file_store, 1 - end - end - - def down - with_lock_retries do - change_column_default :ci_job_artifacts, :file_store, nil - end - end -end diff --git a/db/migrate/20200429182245_add_default_value_for_store_to_uploads.rb b/db/migrate/20200429182245_add_default_value_for_store_to_uploads.rb deleted file mode 100644 index f28fcce8f2f..00000000000 --- a/db/migrate/20200429182245_add_default_value_for_store_to_uploads.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultValueForStoreToUploads < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :uploads, :store, 1 - end - end - - def down - with_lock_retries do - change_column_default :uploads, :store, nil - end - end -end diff --git a/db/migrate/20200430103158_create_group_wiki_repositories.rb b/db/migrate/20200430103158_create_group_wiki_repositories.rb deleted file mode 100644 index b84a8a55def..00000000000 --- a/db/migrate/20200430103158_create_group_wiki_repositories.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class CreateGroupWikiRepositories < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :group_wiki_repositories, id: false do |t| - t.bigint :shard_id, null: false, index: true - t.bigint :group_id, null: false, index: false, primary_key: true, default: nil - - # The limit is added in db/migrate/20200511120430_add_group_wiki_repositories_disk_path_limit.rb - t.text :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/AddLimitToTextColumns - end - end -end diff --git a/db/migrate/20200430123614_create_project_access_tokens.rb b/db/migrate/20200430123614_create_project_access_tokens.rb deleted file mode 100644 index f07b1875ce0..00000000000 --- a/db/migrate/20200430123614_create_project_access_tokens.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class CreateProjectAccessTokens < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :project_access_tokens, primary_key: [:personal_access_token_id, :project_id] do |t| - t.column :personal_access_token_id, :bigint, null: false - t.column :project_id, :bigint, null: false - end - - add_index :project_access_tokens, :project_id - end -end diff --git a/db/migrate/20200430130048_create_packages_nuget_metadata.rb b/db/migrate/20200430130048_create_packages_nuget_metadata.rb deleted file mode 100644 index 0f0d490c93d..00000000000 --- a/db/migrate/20200430130048_create_packages_nuget_metadata.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesNugetMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - LICENSE_URL_CONSTRAINT_NAME = 'packages_nuget_metadata_license_url_constraint' - PROJECT_URL_CONSTRAINT_NAME = 'packages_nuget_metadata_project_url_constraint' - ICON_URL_CONSTRAINT_NAME = 'packages_nuget_metadata_icon_url_constraint' - - def up - unless table_exists?(:packages_nuget_metadata) - with_lock_retries do - create_table :packages_nuget_metadata, id: false do |t| - t.references :package, primary_key: true, default: nil, index: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint - t.text :license_url - t.text :project_url - t.text :icon_url - end - end - end - - add_text_limit :packages_nuget_metadata, :license_url, 255, constraint_name: LICENSE_URL_CONSTRAINT_NAME - add_text_limit :packages_nuget_metadata, :project_url, 255, constraint_name: PROJECT_URL_CONSTRAINT_NAME - add_text_limit :packages_nuget_metadata, :icon_url, 255, constraint_name: ICON_URL_CONSTRAINT_NAME - end - - def down - drop_table :packages_nuget_metadata - end -end diff --git a/db/migrate/20200430174637_create_group_deploy_keys.rb b/db/migrate/20200430174637_create_group_deploy_keys.rb deleted file mode 100644 index 9771ae013ea..00000000000 --- a/db/migrate/20200430174637_create_group_deploy_keys.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class CreateGroupDeployKeys < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:group_deploy_keys) - with_lock_retries do - create_table :group_deploy_keys do |t| - t.references :user, foreign_key: { on_delete: :restrict }, index: true - t.timestamps_with_timezone - t.datetime_with_timezone :last_used_at - t.datetime_with_timezone :expires_at - t.text :key, null: false, unique: true - t.text :title - t.text :fingerprint, null: false, unique: true - t.binary :fingerprint_sha256 - - t.index :fingerprint, unique: true - t.index :fingerprint_sha256 - end - end - end - - add_text_limit(:group_deploy_keys, :key, 4096) - add_text_limit(:group_deploy_keys, :title, 255) - add_text_limit(:group_deploy_keys, :fingerprint, 255) - end - - def down - drop_table :group_deploy_keys - end -end diff --git a/db/migrate/20200504191813_add_fingerprint_to_events.rb b/db/migrate/20200504191813_add_fingerprint_to_events.rb deleted file mode 100644 index 1171d548f10..00000000000 --- a/db/migrate/20200504191813_add_fingerprint_to_events.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class AddFingerprintToEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:events, :fingerprint) - with_lock_retries { add_column :events, :fingerprint, :binary } - end - - unless check_constraint_exists?(:events, constraint_name) - add_check_constraint( - :events, - "octet_length(fingerprint) <= 128", - constraint_name, - validate: true - ) - end - end - - def down - remove_check_constraint(:events, constraint_name) - - if column_exists?(:events, :fingerprint) - with_lock_retries { remove_column :events, :fingerprint } - end - end - - def constraint_name - check_constraint_name(:events, :fingerprint, 'max_length') - end -end diff --git a/db/migrate/20200504200709_add_index_on_fingerprint_and_target_type_to_events.rb b/db/migrate/20200504200709_add_index_on_fingerprint_and_target_type_to_events.rb deleted file mode 100644 index 9b06d593300..00000000000 --- a/db/migrate/20200504200709_add_index_on_fingerprint_and_target_type_to_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnFingerprintAndTargetTypeToEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - KEYS = [:target_type, :target_id, :fingerprint] - - def up - add_concurrent_index :events, KEYS, using: :btree, unique: true - end - - def down - remove_concurrent_index :events, KEYS - end -end diff --git a/db/migrate/20200505164958_add_registry_settings_to_application_settings.rb b/db/migrate/20200505164958_add_registry_settings_to_application_settings.rb deleted file mode 100644 index 4c307dbe845..00000000000 --- a/db/migrate/20200505164958_add_registry_settings_to_application_settings.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class AddRegistrySettingsToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - # rubocop:disable Migration/AddLimitToTextColumns - def up - add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault - :container_registry_vendor, - :text, - default: '', - allow_null: false) - - add_column_with_default(:application_settings, # rubocop:disable Migration/AddColumnWithDefault - :container_registry_version, - :text, - default: '', - allow_null: false) - end - # rubocop:enable Migration/AddLimitToTextColumns - - def down - remove_column :application_settings, :container_registry_vendor - remove_column :application_settings, :container_registry_version - end -end diff --git a/db/migrate/20200505171834_add_text_limit_to_container_registry_vendor.rb b/db/migrate/20200505171834_add_text_limit_to_container_registry_vendor.rb deleted file mode 100644 index 242dcc9a837..00000000000 --- a/db/migrate/20200505171834_add_text_limit_to_container_registry_vendor.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToContainerRegistryVendor < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :container_registry_vendor, 255 - end - - def down - remove_text_limit :application_settings, :container_registry_vendor - end -end diff --git a/db/migrate/20200505172405_add_text_limit_to_container_registry_version.rb b/db/migrate/20200505172405_add_text_limit_to_container_registry_version.rb deleted file mode 100644 index 36589c9cc75..00000000000 --- a/db/migrate/20200505172405_add_text_limit_to_container_registry_version.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToContainerRegistryVersion < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :container_registry_version, 255 - end - - def down - remove_text_limit :application_settings, :container_registry_version - end -end diff --git a/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb b/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb deleted file mode 100644 index fbbf2306f81..00000000000 --- a/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddContainerRegistryFeaturesToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :application_settings, :container_registry_features, :text, array: true, default: [], null: false - end - - def down - remove_column :application_settings, :container_registry_features - end -end diff --git a/db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb b/db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb deleted file mode 100644 index dd3f1dbcc0e..00000000000 --- a/db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveUltraauthProviderFromIdentities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :identities, :provider - execute "DELETE FROM identities WHERE provider = 'ultraauth'" - remove_concurrent_index :identities, :provider - end - - def down - end -end diff --git a/db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb b/db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb deleted file mode 100644 index d30b8abbbc3..00000000000 --- a/db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -class AddSpamCheckEndpointToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:application_settings, :spam_check_endpoint_url) - add_column :application_settings, :spam_check_endpoint_url, :text - end - - add_text_limit :application_settings, :spam_check_endpoint_url, 255 - - unless column_exists?(:application_settings, :spam_check_endpoint_enabled) - add_column :application_settings, :spam_check_endpoint_enabled, :boolean, null: false, default: false - end - end - - def down - remove_column_if_exists :spam_check_endpoint_url - remove_column_if_exists :spam_check_endpoint_enabled - end - - private - - def remove_column_if_exists(column) - return unless column_exists?(:application_settings, column) - - remove_column :application_settings, column - end -end diff --git a/db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb b/db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb deleted file mode 100644 index 5828db973ed..00000000000 --- a/db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddElasticsearchPauseIndexingToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - add_column :application_settings, :elasticsearch_pause_indexing, :boolean, default: false, null: false - end - end - - def down - remove_column :application_settings, :elasticsearch_pause_indexing - end -end diff --git a/db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb b/db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb deleted file mode 100644 index fecaed9a7a0..00000000000 --- a/db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class AddRepositoryStoragesWeightedToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - class ApplicationSetting < ActiveRecord::Base - serialize :repository_storages - self.table_name = 'application_settings' - end - - def up - add_column :application_settings, :repository_storages_weighted, :jsonb, default: {}, null: false - - seed_repository_storages_weighted - end - - def down - remove_column :application_settings, :repository_storages_weighted - end - - private - - def seed_repository_storages_weighted - # We need to flush the cache to ensure the newly-added column is loaded - ApplicationSetting.reset_column_information - - # There should only be one row here due to - # 20200420162730_remove_additional_application_settings_rows.rb - ApplicationSetting.all.each do |settings| - storages = Gitlab.config.repositories.storages.keys.collect do |storage| - weight = settings.repository_storages.include?(storage) ? 100 : 0 - [storage.to_sym, weight] - end - - settings.repository_storages_weighted = Hash[storages] - settings.save! - end - end -end diff --git a/db/migrate/20200509203901_reseed_repository_storages_weighted.rb b/db/migrate/20200509203901_reseed_repository_storages_weighted.rb deleted file mode 100644 index 7a751b77c1c..00000000000 --- a/db/migrate/20200509203901_reseed_repository_storages_weighted.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -class ReseedRepositoryStoragesWeighted < ActiveRecord::Migration[6.0] - DOWNTIME = false - - class ApplicationSetting < ActiveRecord::Base - serialize :repository_storages - self.table_name = 'application_settings' - end - - def up - reseed_repository_storages_weighted - end - - private - - def reseed_repository_storages_weighted - # We need to flush the cache to ensure the newly-added column is loaded - ApplicationSetting.reset_column_information - - # There should only be one row here due to - # 20200420162730_remove_additional_application_settings_rows.rb - ApplicationSetting.all.each do |settings| - # Admins may have already tweaked these values, so don't do anything - # if there is data already. - next if settings.repository_storages_weighted.present? - - storages = Gitlab.config.repositories.storages.keys.collect do |storage| - weight = settings.repository_storages.include?(storage) ? 100 : 0 - [storage.to_sym, weight] - end - - settings.repository_storages_weighted = Hash[storages] - settings.save! - end - end -end diff --git a/db/migrate/20200510181937_add_web_authn_xid_to_user_details.rb b/db/migrate/20200510181937_add_web_authn_xid_to_user_details.rb deleted file mode 100644 index d41e6611c45..00000000000 --- a/db/migrate/20200510181937_add_web_authn_xid_to_user_details.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddWebAuthnXidToUserDetails < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in subsequent migration - def change - add_column :user_details, :webauthn_xid, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200510182218_add_text_limit_to_user_details_webauthn_xid.rb b/db/migrate/20200510182218_add_text_limit_to_user_details_webauthn_xid.rb deleted file mode 100644 index 715cfd771f5..00000000000 --- a/db/migrate/20200510182218_add_text_limit_to_user_details_webauthn_xid.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToUserDetailsWebauthnXid < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :user_details, :webauthn_xid, 100 - end - - def down - remove_text_limit :user_details, :webauthn_xid - end -end diff --git a/db/migrate/20200510182556_add_text_limit_to_webauthn_registrations_name.rb b/db/migrate/20200510182556_add_text_limit_to_webauthn_registrations_name.rb deleted file mode 100644 index 28805505ba6..00000000000 --- a/db/migrate/20200510182556_add_text_limit_to_webauthn_registrations_name.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToWebauthnRegistrationsName < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :webauthn_registrations, :name, 255 - end - - def down - remove_text_limit :webauthn_registrations, :name - end -end diff --git a/db/migrate/20200510182824_add_text_limit_to_webauthn_registrations_credential_xid.rb b/db/migrate/20200510182824_add_text_limit_to_webauthn_registrations_credential_xid.rb deleted file mode 100644 index 51155f370ef..00000000000 --- a/db/migrate/20200510182824_add_text_limit_to_webauthn_registrations_credential_xid.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToWebauthnRegistrationsCredentialXid < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :webauthn_registrations, :credential_xid, 255 - end - - def down - remove_text_limit :webauthn_registrations, :credential_xid - end -end diff --git a/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb b/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb deleted file mode 100644 index 9071e3e17e3..00000000000 --- a/db/migrate/20200510183128_add_foreign_key_from_webauthn_registrations_to_users.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyFromWebauthnRegistrationsToUsers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # disable_ddl_transaction! - - def up - with_lock_retries do - add_foreign_key :webauthn_registrations, :users, column: :user_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :webauthn_registrations, column: :user_id - end - end -end diff --git a/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb b/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb deleted file mode 100644 index 85d965972aa..00000000000 --- a/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddEpicIdToResourceStateEvents < ActiveRecord::Migration[6.0] - DOWNTIME = false - - INDEX_NAME = 'index_resource_state_events_on_epic_id' - - def up - add_column :resource_state_events, :epic_id, :integer - add_index :resource_state_events, :epic_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex - end - - def down - remove_index :resource_state_events, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex - remove_column :resource_state_events, :epic_id, :integer - end -end diff --git a/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb deleted file mode 100644 index 1daa620501a..00000000000 --- a/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToEpicIdOnResourceStateEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_state_events, :epics, column: :epic_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_state_events, column: :epic_id - end - end -end diff --git a/db/migrate/20200511115430_add_inherit_from_to_services.rb b/db/migrate/20200511115430_add_inherit_from_to_services.rb deleted file mode 100644 index c409b543dbf..00000000000 --- a/db/migrate/20200511115430_add_inherit_from_to_services.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddInheritFromToServices < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :services, :inherit_from_id, :bigint - end -end diff --git a/db/migrate/20200511115431_add_index_inherit_from_id_to_services.rb b/db/migrate/20200511115431_add_index_inherit_from_id_to_services.rb deleted file mode 100644 index a0a5f361edf..00000000000 --- a/db/migrate/20200511115431_add_index_inherit_from_id_to_services.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexInheritFromIdToServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :services, :inherit_from_id - - add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify - end - - def down - remove_foreign_key_if_exists :services, column: :inherit_from_id - - remove_concurrent_index :services, :inherit_from_id - end -end diff --git a/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb b/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb deleted file mode 100644 index d1bb3fcc6ea..00000000000 --- a/db/migrate/20200511121549_add_group_wiki_repositories_shard_id_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddGroupWikiRepositoriesShardIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :group_wiki_repositories, :shards, on_delete: :restrict - end - end - - def down - with_lock_retries do - remove_foreign_key :group_wiki_repositories, :shards - end - end -end diff --git a/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb b/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb deleted file mode 100644 index 40f272cc0e7..00000000000 --- a/db/migrate/20200511121610_add_group_wiki_repositories_group_id_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddGroupWikiRepositoriesGroupIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :group_wiki_repositories, :namespaces, column: :group_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :group_wiki_repositories, :namespaces, column: :group_id - end - end -end diff --git a/db/migrate/20200511121620_add_group_wiki_repositories_disk_path_limit.rb b/db/migrate/20200511121620_add_group_wiki_repositories_disk_path_limit.rb deleted file mode 100644 index db4b9d8a6e4..00000000000 --- a/db/migrate/20200511121620_add_group_wiki_repositories_disk_path_limit.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddGroupWikiRepositoriesDiskPathLimit < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :group_wiki_repositories, :disk_path, 80 - end - - def down - remove_text_limit :group_wiki_repositories, :disk_path - end -end diff --git a/db/migrate/20200511130129_remove_deprecated_jenkins_service_records.rb b/db/migrate/20200511130129_remove_deprecated_jenkins_service_records.rb deleted file mode 100644 index 258142f950e..00000000000 --- a/db/migrate/20200511130129_remove_deprecated_jenkins_service_records.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveDeprecatedJenkinsServiceRecords < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute <<~SQL.strip - DELETE FROM services WHERE type = 'JenkinsDeprecatedService'; - SQL - end - - def down - # no-op - - # The records were removed by `up` - end -end diff --git a/db/migrate/20200511181027_create_test_reports.rb b/db/migrate/20200511181027_create_test_reports.rb deleted file mode 100644 index a08e208441d..00000000000 --- a/db/migrate/20200511181027_create_test_reports.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreateTestReports < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :requirements_management_test_reports do |t| - t.datetime_with_timezone :created_at, null: false - t.references :requirement, null: false, foreign_key: { on_delete: :cascade } - t.bigint :pipeline_id - t.bigint :author_id - t.integer :state, null: false, limit: 2 - - t.index :pipeline_id - t.index :author_id - end - end -end diff --git a/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb b/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb deleted file mode 100644 index 532133fe7f9..00000000000 --- a/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddAuthorForeignKeyToTestReports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :requirements_management_test_reports, :users, column: :author_id, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :requirements_management_test_reports, column: :author_id - end - end -end diff --git a/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb b/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb deleted file mode 100644 index 46657f9af6d..00000000000 --- a/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPipelineForeignKeyToTestReports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :requirements_management_test_reports, :ci_pipelines, column: :pipeline_id, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :requirements_management_test_reports, column: :pipeline_id - end - end -end diff --git a/db/migrate/20200512085150_change_default_value_of_protected_ci_variables_of_application_settings_to_true.rb b/db/migrate/20200512085150_change_default_value_of_protected_ci_variables_of_application_settings_to_true.rb deleted file mode 100644 index ca623ccf8b4..00000000000 --- a/db/migrate/20200512085150_change_default_value_of_protected_ci_variables_of_application_settings_to_true.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class ChangeDefaultValueOfProtectedCiVariablesOfApplicationSettingsToTrue < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_default :application_settings, :protected_ci_variables, from: false, to: true - end -end diff --git a/db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb b/db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb deleted file mode 100644 index 20eaa549ee5..00000000000 --- a/db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToCiJobArtifactsForTerraformReports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_job_artifacts_for_terraform_reports' - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_job_artifacts, [:project_id, :id], where: 'file_type = 18', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME - end -end diff --git a/db/migrate/20200512164334_sprint_make_state_enum_not_null_and_default.rb b/db/migrate/20200512164334_sprint_make_state_enum_not_null_and_default.rb deleted file mode 100644 index f0db228e249..00000000000 --- a/db/migrate/20200512164334_sprint_make_state_enum_not_null_and_default.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class SprintMakeStateEnumNotNullAndDefault < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column_default :sprints, :state_enum, from: 0, to: 1 - change_column_null :sprints, :state_enum, false, 1 - end - - def down - change_column_null :sprints, :state_enum, true - change_column_default :sprints, :state_enum, from: 1, to: nil - end -end diff --git a/db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb b/db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb deleted file mode 100644 index f1334afb89d..00000000000 --- a/db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class UpdateIndexOnNameTypeEqCiBuildToCiBuilds < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - OLD_INDEX_NAME = 'index_ci_builds_on_name_and_security_type_eq_ci_build' - NEW_INDEX_NAME = 'index_security_ci_builds_on_name_and_id' - - OLD_CLAUSE = "((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, - ('dast'::character varying)::text, - ('dependency_scanning'::character varying)::text, - ('license_management'::character varying)::text, - ('sast'::character varying)::text, - ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)" - - NEW_CLAUSE = "((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, - ('dast'::character varying)::text, - ('dependency_scanning'::character varying)::text, - ('license_management'::character varying)::text, - ('sast'::character varying)::text, - ('secret_detection'::character varying)::text, - ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)" - - def up - add_concurrent_index :ci_builds, [:name, :id], name: NEW_INDEX_NAME, where: NEW_CLAUSE - remove_concurrent_index_by_name :ci_builds, OLD_INDEX_NAME - end - - def down - add_concurrent_index :ci_builds, [:name, :id], name: OLD_INDEX_NAME, where: OLD_CLAUSE - remove_concurrent_index_by_name :ci_builds, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb b/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb deleted file mode 100644 index a8bb91cf6cf..00000000000 --- a/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class FixNotNullCheckConstraintInconsistency < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - table = :application_settings - - %i(container_registry_vendor container_registry_version).each do |column| - change_column_null table, column, false - remove_not_null_constraint(table, column) if check_not_null_constraint_exists?(table, column) - end - end - - def down - # No-op: for regular systems without the inconsistency, #up is a no-op, too - end -end diff --git a/db/migrate/20200513224143_add_section_to_approval_merge_request_rule.rb b/db/migrate/20200513224143_add_section_to_approval_merge_request_rule.rb deleted file mode 100644 index 98424e9b735..00000000000 --- a/db/migrate/20200513224143_add_section_to_approval_merge_request_rule.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSectionToApprovalMergeRequestRule < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:approval_merge_request_rules, :section) - add_column :approval_merge_request_rules, :section, :text - end - - add_text_limit :approval_merge_request_rules, :section, 255 - end - - def down - remove_column :approval_merge_request_rules, :section - end -end diff --git a/db/migrate/20200513234502_fill_file_store_lfs_objects.rb b/db/migrate/20200513234502_fill_file_store_lfs_objects.rb deleted file mode 100644 index 74066afbd83..00000000000 --- a/db/migrate/20200513234502_fill_file_store_lfs_objects.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class FillFileStoreLfsObjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - update_column_in_batches(:lfs_objects, :file_store, 1) do |table, query| - query.where(table[:file_store].eq(nil)) - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20200513235347_fill_store_uploads.rb b/db/migrate/20200513235347_fill_store_uploads.rb deleted file mode 100644 index 42db5e4cc08..00000000000 --- a/db/migrate/20200513235347_fill_store_uploads.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class FillStoreUploads < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - update_column_in_batches(:uploads, :store, 1) do |table, query| - query.where(table[:store].eq(nil)) - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20200513235532_fill_file_store_ci_job_artifacts.rb b/db/migrate/20200513235532_fill_file_store_ci_job_artifacts.rb deleted file mode 100644 index d4c25167535..00000000000 --- a/db/migrate/20200513235532_fill_file_store_ci_job_artifacts.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class FillFileStoreCiJobArtifacts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # rubocop:disable Migration/UpdateLargeTable - update_column_in_batches(:ci_job_artifacts, :file_store, 1) do |table, query| - query.where(table[:file_store].eq(nil)) - end - # rubocop:enable Migration/UpdateLargeTable - end - - def down - # no-op - end -end diff --git a/db/migrate/20200515152649_enable_btree_gist_extension.rb b/db/migrate/20200515152649_enable_btree_gist_extension.rb deleted file mode 100644 index bd81c921a87..00000000000 --- a/db/migrate/20200515152649_enable_btree_gist_extension.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class EnableBtreeGistExtension < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - create_extension :btree_gist - end - - def down - drop_extension :btree_gist - end -end diff --git a/db/migrate/20200515153633_iteration_date_range_constraint.rb b/db/migrate/20200515153633_iteration_date_range_constraint.rb deleted file mode 100644 index ab197ff8ae7..00000000000 --- a/db/migrate/20200515153633_iteration_date_range_constraint.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class IterationDateRangeConstraint < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute <<~SQL - ALTER TABLE sprints - ADD CONSTRAINT iteration_start_and_due_daterange_project_id_constraint - EXCLUDE USING gist - ( project_id WITH =, - daterange(start_date, due_date, '[]') WITH && - ) - WHERE (project_id IS NOT NULL) - SQL - - execute <<~SQL - ALTER TABLE sprints - ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint - EXCLUDE USING gist - ( group_id WITH =, - daterange(start_date, due_date, '[]') WITH && - ) - WHERE (group_id IS NOT NULL) - SQL - end - - def down - execute <<~SQL - ALTER TABLE sprints - DROP CONSTRAINT IF EXISTS iteration_start_and_due_daterange_project_id_constraint - SQL - - execute <<~SQL - ALTER TABLE sprints - DROP CONSTRAINT IF EXISTS iteration_start_and_due_daterange_group_id_constraint - SQL - end -end diff --git a/db/migrate/20200515155620_add_index_non_requested_project_members_on_source_id_source_type.rb b/db/migrate/20200515155620_add_index_non_requested_project_members_on_source_id_source_type.rb deleted file mode 100644 index 333f4e93e95..00000000000 --- a/db/migrate/20200515155620_add_index_non_requested_project_members_on_source_id_source_type.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexNonRequestedProjectMembersOnSourceIdSourceType < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:members, [:source_id, :source_type], where: "requested_at IS NULL and type = 'ProjectMember'", name: 'index_non_requested_project_members_on_source_id_and_type') - end - - def down - remove_concurrent_index_by_name(:members, 'index_non_requested_project_members_on_source_id_and_type') - end -end diff --git a/db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb b/db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb deleted file mode 100644 index f9681f1a976..00000000000 --- a/db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToPersonalAccessTokenImpersonation < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_expired_and_not_notified_personal_access_tokens' - - disable_ddl_transaction! - - def up - add_concurrent_index( - :personal_access_tokens, - [:id, :expires_at], - where: "impersonation = FALSE AND revoked = FALSE AND expire_notification_delivered = FALSE", - name: INDEX_NAME - ) - end - - def down - remove_concurrent_index_by_name( - :personal_access_tokens, - name: INDEX_NAME - ) - end -end diff --git a/db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb b/db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb deleted file mode 100644 index ff60e3bdac1..00000000000 --- a/db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class UpdateResourceStateEventsConstraintToSupportEpicId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - OLD_CONSTRAINT = 'resource_state_events_must_belong_to_issue_or_merge_request' - CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request_or_' - - def up - remove_check_constraint :resource_state_events, OLD_CONSTRAINT - add_check_constraint :resource_state_events, "(issue_id != NULL AND merge_request_id IS NULL AND epic_id IS NULL) OR " \ - "(issue_id IS NULL AND merge_request_id != NULL AND epic_id IS NULL) OR" \ - "(issue_id IS NULL AND merge_request_id IS NULL AND epic_id != NULL)", CONSTRAINT_NAME - end - - def down - remove_check_constraint :resource_state_events, CONSTRAINT_NAME - add_check_constraint :resource_state_events, '(issue_id != NULL AND merge_request_id IS NULL) OR (merge_request_id != NULL AND issue_id IS NULL)', OLD_CONSTRAINT - end -end diff --git a/db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb b/db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb deleted file mode 100644 index 478b5358056..00000000000 --- a/db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddErrorMessageColumnToJiraImports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - unless column_exists?(:jira_imports, :error_message) - add_column :jira_imports, :error_message, :text - end - - add_text_limit :jira_imports, :error_message, 1000 - end - - def down - return unless column_exists?(:jira_imports, :error_message) - - remove_column :jira_imports, :error_message - end -end diff --git a/db/migrate/20200519115908_add_epics_confidential_index.rb b/db/migrate/20200519115908_add_epics_confidential_index.rb deleted file mode 100644 index 68a1715acb4..00000000000 --- a/db/migrate/20200519115908_add_epics_confidential_index.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddEpicsConfidentialIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :epics, :confidential - end - - def down - remove_concurrent_index :epics, :confidential - end -end diff --git a/db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb b/db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb deleted file mode 100644 index bf36e74a746..00000000000 --- a/db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddInstanceLevelVariablesColumnToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :ci_instance_level_variables, :integer, default: 25, null: false - end -end diff --git a/db/migrate/20200519194042_update_container_expiration_policies_defaults.rb b/db/migrate/20200519194042_update_container_expiration_policies_defaults.rb deleted file mode 100644 index 071f50d16a0..00000000000 --- a/db/migrate/20200519194042_update_container_expiration_policies_defaults.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class UpdateContainerExpirationPoliciesDefaults < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :container_expiration_policies, :cadence, '1d' - change_column_default :container_expiration_policies, :keep_n, 10 - change_column_default :container_expiration_policies, :older_than, '90d' - end - end - - def down - with_lock_retries do - change_column_default :container_expiration_policies, :cadence, '7d' - change_column_default :container_expiration_policies, :keep_n, nil - change_column_default :container_expiration_policies, :older_than, nil - end - end -end diff --git a/db/migrate/20200520103514_add_todo_resolved_by_action.rb b/db/migrate/20200520103514_add_todo_resolved_by_action.rb deleted file mode 100644 index 0aa91091451..00000000000 --- a/db/migrate/20200520103514_add_todo_resolved_by_action.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTodoResolvedByAction < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :todos, :resolved_by_action, :integer, limit: 2 - end - end - - def down - with_lock_retries do - remove_column :todos, :resolved_by_action - end - end -end diff --git a/db/migrate/20200521022725_add_experience_level_to_user_preferences.rb b/db/migrate/20200521022725_add_experience_level_to_user_preferences.rb deleted file mode 100644 index e70a13599c3..00000000000 --- a/db/migrate/20200521022725_add_experience_level_to_user_preferences.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddExperienceLevelToUserPreferences < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :user_preferences, :experience_level, :integer, limit: 2 - end -end diff --git a/db/migrate/20200521225327_create_alert_management_alert_assignees.rb b/db/migrate/20200521225327_create_alert_management_alert_assignees.rb deleted file mode 100644 index 99de2646b3d..00000000000 --- a/db/migrate/20200521225327_create_alert_management_alert_assignees.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class CreateAlertManagementAlertAssignees < ActiveRecord::Migration[6.0] - DOWNTIME = false - - ALERT_INDEX_NAME = 'index_alert_assignees_on_alert_id' - UNIQUE_INDEX_NAME = 'index_alert_assignees_on_user_id_and_alert_id' - - def up - create_table :alert_management_alert_assignees do |t| - t.bigint :user_id, null: false - t.bigint :alert_id, null: false - - t.index :alert_id, name: ALERT_INDEX_NAME - t.index [:user_id, :alert_id], unique: true, name: UNIQUE_INDEX_NAME - end - end - - def down - drop_table :alert_management_alert_assignees - end -end diff --git a/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb b/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb deleted file mode 100644 index 4a6a25a8472..00000000000 --- a/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToUserIdOnAlertManagementAlertAssignees < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :alert_management_alert_assignees, :users, column: :user_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :alert_management_alert_assignees, column: :user_id - end - end -end diff --git a/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb b/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb deleted file mode 100644 index 77d374f08fa..00000000000 --- a/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToAlertIdOnAlertMangagementAlertAssignees < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :alert_management_alert_assignees, :alert_management_alerts, column: :alert_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :alert_management_alert_assignees, column: :alert_id - end - end -end diff --git a/db/migrate/20200522205606_create_group_deploy_keys_group.rb b/db/migrate/20200522205606_create_group_deploy_keys_group.rb deleted file mode 100644 index 85dbc14b0f5..00000000000 --- a/db/migrate/20200522205606_create_group_deploy_keys_group.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateGroupDeployKeysGroup < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - def up - with_lock_retries do - create_table :group_deploy_keys_groups do |t| - t.timestamps_with_timezone - - t.references :group, index: false, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade } - t.references :group_deploy_key, null: false, foreign_key: { on_delete: :cascade } - - t.index [:group_id, :group_deploy_key_id], unique: true, name: 'index_group_deploy_keys_group_on_group_deploy_key_and_group_ids' - end - end - end - - def down - with_lock_retries do - drop_table :group_deploy_keys_groups - end - end -end diff --git a/db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb b/db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb deleted file mode 100644 index 0949e8049d1..00000000000 --- a/db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnSnippetTypeAndId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :snippets, [:id, :type] - end - - def down - remove_concurrent_index :snippets, [:id, :type] - end -end diff --git a/db/migrate/20200524104346_add_source_to_resource_state_event.rb b/db/migrate/20200524104346_add_source_to_resource_state_event.rb deleted file mode 100644 index a1d1575bb02..00000000000 --- a/db/migrate/20200524104346_add_source_to_resource_state_event.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSourceToResourceStateEvent < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:resource_state_events, :source_commit) - add_column :resource_state_events, :source_commit, :text - end - - add_text_limit :resource_state_events, :source_commit, 40 - end - - def down - remove_column :resource_state_events, :source_commit - end -end diff --git a/db/migrate/20200525114553_rename_user_type_index.rb b/db/migrate/20200525114553_rename_user_type_index.rb deleted file mode 100644 index 44ce142ffcb..00000000000 --- a/db/migrate/20200525114553_rename_user_type_index.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RenameUserTypeIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :users, [:state, :user_type], name: 'index_users_on_state_and_user_type' - remove_concurrent_index_by_name :users, 'index_users_on_state_and_user_type_internal' - end - - def down - add_concurrent_index :users, [:state, :user_type], where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_user_type_internal' - remove_concurrent_index_by_name :users, 'index_users_on_state_and_user_type' - end -end diff --git a/db/migrate/20200526013844_add_alert_events_to_services.rb b/db/migrate/20200526013844_add_alert_events_to_services.rb deleted file mode 100644 index 1dba7fcaad4..00000000000 --- a/db/migrate/20200526013844_add_alert_events_to_services.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddAlertEventsToServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :services, :alert_events, :boolean - end - end - - def down - with_lock_retries do - remove_column :services, :alert_events - end - end -end diff --git a/db/migrate/20200526120714_change_partial_indexes_on_services.rb b/db/migrate/20200526120714_change_partial_indexes_on_services.rb deleted file mode 100644 index a4d58cda105..00000000000 --- a/db/migrate/20200526120714_change_partial_indexes_on_services.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class ChangePartialIndexesOnServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :services, [:type, :instance], unique: true, where: 'instance = true', name: 'index_services_on_type_and_instance_partial' - remove_concurrent_index_by_name :services, 'index_services_on_type_and_instance' - - add_concurrent_index :services, [:type, :template], unique: true, where: 'template = true', name: 'index_services_on_type_and_template_partial' - remove_concurrent_index_by_name :services, 'index_services_on_type_and_template' - end - - def down - add_concurrent_index :services, [:type, :instance], unique: true, where: 'instance IS TRUE', name: 'index_services_on_type_and_instance' - remove_concurrent_index_by_name :services, 'index_services_on_type_and_instance_partial' - - add_concurrent_index :services, [:type, :template], unique: true, where: 'template IS TRUE', name: 'index_services_on_type_and_template' - remove_concurrent_index_by_name :services, 'index_services_on_type_and_template_partial' - end -end diff --git a/db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb b/db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb deleted file mode 100644 index d0dfa126455..00000000000 --- a/db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class DropNullConstraintOnGroupImportStateJid < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column_null :group_import_states, :jid, true - end - - def down - # No-op -- null values could have been added after this this constraint was removed. - end -end diff --git a/db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb b/db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb deleted file mode 100644 index 85f121a4c02..00000000000 --- a/db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIssuesLastEditedByIdIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :issues, :last_edited_by_id - add_concurrent_index :epics, :last_edited_by_id - end - - def down - remove_concurrent_index :issues, :last_edited_by_id - remove_concurrent_index :epics, :last_edited_by_id - end -end diff --git a/db/migrate/20200526164946_create_operations_feature_flags_issues.rb b/db/migrate/20200526164946_create_operations_feature_flags_issues.rb deleted file mode 100644 index 24876997cfd..00000000000 --- a/db/migrate/20200526164946_create_operations_feature_flags_issues.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class CreateOperationsFeatureFlagsIssues < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :operations_feature_flags_issues do |t| - t.references :feature_flag, index: false, foreign_key: { on_delete: :cascade, to_table: :operations_feature_flags }, null: false - t.bigint :issue_id, null: false - - t.index [:feature_flag_id, :issue_id], unique: true, name: :index_ops_feature_flags_issues_on_feature_flag_id_and_issue_id - t.index :issue_id - end - end -end diff --git a/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb b/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb deleted file mode 100644 index a11a8094823..00000000000 --- a/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToOpsFeatureFlagsIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :operations_feature_flags_issues, :issues, column: :issue_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :operations_feature_flags_issues, column: :issue_id - end - end -end diff --git a/db/migrate/20200526193555_add_squash_option_to_project.rb b/db/migrate/20200526193555_add_squash_option_to_project.rb deleted file mode 100644 index 6dd4e1c7c8e..00000000000 --- a/db/migrate/20200526193555_add_squash_option_to_project.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddSquashOptionToProject < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_settings, :squash_option, :integer, default: 3, limit: 2 - end -end diff --git a/db/migrate/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type.rb b/db/migrate/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type.rb deleted file mode 100644 index 2483ff7f8fa..00000000000 --- a/db/migrate/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -class UpdateIndexApprovalRuleNameForCodeOwnersRuleType < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - LEGACY_INDEX_NAME_RULE_TYPE = "index_approval_rule_name_for_code_owners_rule_type" - LEGACY_INDEX_NAME_CODE_OWNERS = "approval_rule_name_index_for_code_owners" - - SECTIONAL_INDEX_NAME = "index_approval_rule_name_for_sectional_code_owners_rule_type" - - CODE_OWNER_RULE_TYPE = 2 - - def up - unless index_exists_by_name?(:approval_merge_request_rules, SECTIONAL_INDEX_NAME) - # Ensure only 1 code_owner rule with the same name and section per merge_request - # - add_concurrent_index( - :approval_merge_request_rules, - [:merge_request_id, :name, :section], - unique: true, - where: "rule_type = #{CODE_OWNER_RULE_TYPE}", - name: SECTIONAL_INDEX_NAME - ) - end - - remove_concurrent_index_by_name :approval_merge_request_rules, LEGACY_INDEX_NAME_RULE_TYPE - remove_concurrent_index_by_name :approval_merge_request_rules, LEGACY_INDEX_NAME_CODE_OWNERS - - add_concurrent_index( - :approval_merge_request_rules, - [:merge_request_id, :name], - unique: true, - where: "rule_type = #{CODE_OWNER_RULE_TYPE} AND section IS NULL", - name: LEGACY_INDEX_NAME_RULE_TYPE - ) - - add_concurrent_index( - :approval_merge_request_rules, - [:merge_request_id, :code_owner, :name], - unique: true, - where: "code_owner = true AND section IS NULL", - name: LEGACY_INDEX_NAME_CODE_OWNERS - ) - end - - def down - # In a rollback situation, we can't guarantee that there will not be - # records that were allowed under the more specific SECTIONAL_INDEX_NAME - # index but would cause uniqueness violations under both the - # LEGACY_INDEX_NAME_RULE_TYPE and LEGACY_INDEX_NAME_CODE_OWNERS indices. - # Therefore, we need to first find all the MergeRequests with - # ApprovalMergeRequestRules that would violate these "new" indices and - # delete those approval rules, then create the new index, then finally - # recreate the approval rules for those merge requests. - # - - # First, find all MergeRequests with ApprovalMergeRequestRules that will - # violate the new index. - # - if Gitlab.ee? - merge_request_ids = ApprovalMergeRequestRule - .select(:merge_request_id) - .where(rule_type: CODE_OWNER_RULE_TYPE) - .group(:merge_request_id, :rule_type, :name) - .includes(:merge_request) - .having("count(*) > 1") - .collect(&:merge_request_id) - - # Delete ALL their code_owner approval rules - # - merge_request_ids.each_slice(10) do |ids| - ApprovalMergeRequestRule.where(merge_request_id: ids).code_owner.delete_all - end - end - - # Remove legacy partial indices that only apply to `section IS NULL` records - # - remove_concurrent_index_by_name :approval_merge_request_rules, LEGACY_INDEX_NAME_RULE_TYPE - remove_concurrent_index_by_name :approval_merge_request_rules, LEGACY_INDEX_NAME_CODE_OWNERS - - # Reconstruct original "legacy" indices - # - add_concurrent_index( - :approval_merge_request_rules, - [:merge_request_id, :name], - unique: true, - where: "rule_type = #{CODE_OWNER_RULE_TYPE}", - name: LEGACY_INDEX_NAME_RULE_TYPE - ) - - add_concurrent_index( - :approval_merge_request_rules, - [:merge_request_id, :code_owner, :name], - unique: true, - where: "code_owner = true", - name: LEGACY_INDEX_NAME_CODE_OWNERS - ) - - # MergeRequest::SyncCodeOwnerApprovalRules recreates the code_owner rules - # from scratch, adding them to the index. Duplicates will be rejected. - # - if Gitlab.ee? - merge_request_ids.each_slice(10) do |ids| - MergeRequest.where(id: ids).each do |merge_request| - MergeRequests::SyncCodeOwnerApprovalRules.new(merge_request).execute - end - end - end - - remove_concurrent_index_by_name :approval_merge_request_rules, SECTIONAL_INDEX_NAME - end -end diff --git a/db/migrate/20200527092027_add_link_type_to_release_links.rb b/db/migrate/20200527092027_add_link_type_to_release_links.rb deleted file mode 100644 index 5088775f665..00000000000 --- a/db/migrate/20200527092027_add_link_type_to_release_links.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddLinkTypeToReleaseLinks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :release_links, :link_type, :integer, limit: 2, default: 0 - end - end - - def down - with_lock_retries do - remove_column :release_links, :link_type - end - end -end diff --git a/db/migrate/20200527135313_add_requirements_build_reference.rb b/db/migrate/20200527135313_add_requirements_build_reference.rb deleted file mode 100644 index b492871a19b..00000000000 --- a/db/migrate/20200527135313_add_requirements_build_reference.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddRequirementsBuildReference < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_requirements_management_test_reports_on_build_id' - - def up - add_column :requirements_management_test_reports, :build_id, :bigint - add_index :requirements_management_test_reports, :build_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex - - with_lock_retries do - add_foreign_key :requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_column :requirements_management_test_reports, :build_id - end - end -end diff --git a/db/migrate/20200527151413_create_ci_build_report_results_table.rb b/db/migrate/20200527151413_create_ci_build_report_results_table.rb deleted file mode 100644 index 7f854dd4891..00000000000 --- a/db/migrate/20200527151413_create_ci_build_report_results_table.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class CreateCiBuildReportResultsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :ci_build_report_results, id: false do |t| - t.bigint :build_id, null: false, index: false, primary_key: true - t.bigint :project_id, null: false, index: true - t.jsonb :data, null: false, default: {} - end - end -end diff --git a/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb b/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb deleted file mode 100644 index 1809fed551a..00000000000 --- a/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToBuildIdOnBuildReportResults < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :ci_build_report_results, :ci_builds, column: :build_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :ci_build_report_results, column: :build_id - end - end -end diff --git a/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb b/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb deleted file mode 100644 index 1857cb07b06..00000000000 --- a/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToProjectIdOnBuildReportResults < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :ci_build_report_results, :projects, column: :project_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :ci_build_report_results, column: :project_id - end - end -end diff --git a/db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb b/db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb deleted file mode 100644 index 15e4ab2a357..00000000000 --- a/db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class CreateAlertManagementAlertUserMentions < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :alert_management_alert_user_mentions do |t| - t.references :alert_management_alert, type: :bigint, index: false, null: false, foreign_key: { on_delete: :cascade } - t.bigint :note_id, null: true - - t.integer :mentioned_users_ids, array: true - t.integer :mentioned_projects_ids, array: true - t.integer :mentioned_groups_ids, array: true - end - - add_index :alert_management_alert_user_mentions, [:note_id], where: 'note_id IS NOT NULL', unique: true, name: 'index_alert_user_mentions_on_note_id' - add_index :alert_management_alert_user_mentions, [:alert_management_alert_id], where: 'note_id IS NULL', unique: true, name: 'index_alert_user_mentions_on_alert_id' - add_index :alert_management_alert_user_mentions, [:alert_management_alert_id, :note_id], unique: true, name: 'index_alert_user_mentions_on_alert_id_and_note_id' - end -end diff --git a/db/migrate/20200527211000_add_max_import_size.rb b/db/migrate/20200527211000_add_max_import_size.rb deleted file mode 100644 index 2779997dbb2..00000000000 --- a/db/migrate/20200527211000_add_max_import_size.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddMaxImportSize < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - add_column(:application_settings, :max_import_size, :integer, default: 50, null: false) - end - - def down - remove_column(:application_settings, :max_import_size) - end -end diff --git a/db/migrate/20200527211605_add_locked_to_ci_pipelines.rb b/db/migrate/20200527211605_add_locked_to_ci_pipelines.rb deleted file mode 100644 index 3587e6c4a08..00000000000 --- a/db/migrate/20200527211605_add_locked_to_ci_pipelines.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddLockedToCiPipelines < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :ci_pipelines, :locked, :integer, limit: 2, null: false, default: 0 - end - end - - def down - with_lock_retries do - remove_column :ci_pipelines, :locked - end - end -end diff --git a/db/migrate/20200528054112_add_index_to_package_name.rb b/db/migrate/20200528054112_add_index_to_package_name.rb deleted file mode 100644 index fa12088741d..00000000000 --- a/db/migrate/20200528054112_add_index_to_package_name.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToPackageName < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'package_name_index' - - def up - add_concurrent_index(:packages_packages, :name, name: INDEX_NAME) - end - - def down - remove_concurrent_index(:packages_packages, :name, name: INDEX_NAME) - end -end diff --git a/db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb b/db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb deleted file mode 100644 index 7211490e337..00000000000 --- a/db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class AddProjectIdUserIdStatusRefIndexToCiPipelines < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - SOURCE_PARENT_PIPELINE = 12 - - def up - add_concurrent_index( - :ci_pipelines, - [:project_id, :user_id, :status, :ref], - where: "source != #{SOURCE_PARENT_PIPELINE}" - ) - end - - def down - remove_concurrent_index( - :ci_pipelines, - [:project_id, :user_id, :status, :ref], - where: "source != #{SOURCE_PARENT_PIPELINE}" - ) - end -end diff --git a/db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb b/db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb deleted file mode 100644 index d146c8b487b..00000000000 --- a/db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class RemoveNotNullFromExternalDashboardUrl < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_null :project_metrics_settings, :external_dashboard_url, true - end -end diff --git a/db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb b/db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb deleted file mode 100644 index 3f74ef28621..00000000000 --- a/db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddDashboardTimezoneToProjectMetricsSetting < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_metrics_settings, :dashboard_timezone, :integer, limit: 2, null: false, default: 0 - end -end diff --git a/db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb b/db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb deleted file mode 100644 index d37027bf2fb..00000000000 --- a/db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class ChangeConstraintNameOnResourceStateEvents < ActiveRecord::Migration[6.0] - DOWNTIME = false - - NEW_CONSTRAINT_NAME = 'state_events_must_belong_to_issue_or_merge_request_or_epic' - OLD_CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request_or_' - - def up - execute "ALTER TABLE resource_state_events RENAME CONSTRAINT #{OLD_CONSTRAINT_NAME} TO #{NEW_CONSTRAINT_NAME};" - end - - def down - execute "ALTER TABLE resource_state_events RENAME CONSTRAINT #{NEW_CONSTRAINT_NAME} TO #{OLD_CONSTRAINT_NAME};" - end -end diff --git a/db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb b/db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb deleted file mode 100644 index ca0abc70b64..00000000000 --- a/db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddEnforcePatExpirationToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :enforce_pat_expiration, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20200604001128_add_secrets_to_ci_builds_metadata.rb b/db/migrate/20200604001128_add_secrets_to_ci_builds_metadata.rb deleted file mode 100644 index 9a67993cf5c..00000000000 --- a/db/migrate/20200604001128_add_secrets_to_ci_builds_metadata.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddSecretsToCiBuildsMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :ci_builds_metadata, :secrets, :jsonb, default: {}, null: false - end - end - - def down - with_lock_retries do - remove_column :ci_builds_metadata, :secrets - end - end -end diff --git a/db/migrate/20200604143628_create_project_security_settings.rb b/db/migrate/20200604143628_create_project_security_settings.rb deleted file mode 100644 index f972cb509a7..00000000000 --- a/db/migrate/20200604143628_create_project_security_settings.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateProjectSecuritySettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :project_security_settings, id: false do |t| - t.references :project, primary_key: true, index: false, foreign_key: { on_delete: :cascade } - t.timestamps_with_timezone - - t.boolean :auto_fix_container_scanning, default: true, null: false - t.boolean :auto_fix_dast, default: true, null: false - t.boolean :auto_fix_dependency_scanning, default: true, null: false - t.boolean :auto_fix_sast, default: true, null: false - end - end - end - - def down - with_lock_retries do - drop_table :project_security_settings - end - end -end diff --git a/db/migrate/20200604145731_create_board_user_preferences.rb b/db/migrate/20200604145731_create_board_user_preferences.rb deleted file mode 100644 index e83f467d690..00000000000 --- a/db/migrate/20200604145731_create_board_user_preferences.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class CreateBoardUserPreferences < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - create_table :board_user_preferences do |t| - t.bigint :user_id, null: false, index: true - t.bigint :board_id, null: false, index: true - t.boolean :hide_labels - t.timestamps_with_timezone null: false - end - - add_index :board_user_preferences, [:user_id, :board_id], unique: true - end - - def down - drop_table :board_user_preferences - end -end diff --git a/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb b/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb deleted file mode 100644 index cc613e0261e..00000000000 --- a/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUsersForeignKeyToBoardUserPreferences < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :board_user_preferences, :users, column: :user_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :board_user_preferences, column: :user_id - end - end -end diff --git a/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb b/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb deleted file mode 100644 index 4ac978d3741..00000000000 --- a/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddBoardsForeignKeyToBoardUserPreferences < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :board_user_preferences, :boards, column: :board_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :board_user_preferences, column: :board_id - end - end -end diff --git a/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb b/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb deleted file mode 100644 index 3198544d3a9..00000000000 --- a/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToAlertManagementAlertUserMentions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :alert_management_alert_user_mentions, :notes, column: :note_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :alert_management_alert_user_mentions, column: :note_id - end - end -end diff --git a/db/migrate/20200605093113_add_ip_address_to_audit_events.rb b/db/migrate/20200605093113_add_ip_address_to_audit_events.rb deleted file mode 100644 index 9f5694ddce2..00000000000 --- a/db/migrate/20200605093113_add_ip_address_to_audit_events.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddIpAddressToAuditEvents < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :audit_events, :ip_address, :inet - end -end diff --git a/db/migrate/20200605160806_add_index_on_repository_size_and_project_id_to_project_statistics.rb b/db/migrate/20200605160806_add_index_on_repository_size_and_project_id_to_project_statistics.rb deleted file mode 100644 index 2e7b75bcd17..00000000000 --- a/db/migrate/20200605160806_add_index_on_repository_size_and_project_id_to_project_statistics.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnRepositorySizeAndProjectIdToProjectStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :project_statistics, [:repository_size, :project_id] - end - - def down - remove_concurrent_index :project_statistics, [:repository_size, :project_id] - end -end diff --git a/db/migrate/20200605160836_add_index_on_storage_size_and_project_id_to_project_statistics.rb b/db/migrate/20200605160836_add_index_on_storage_size_and_project_id_to_project_statistics.rb deleted file mode 100644 index 22f9dab634b..00000000000 --- a/db/migrate/20200605160836_add_index_on_storage_size_and_project_id_to_project_statistics.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnStorageSizeAndProjectIdToProjectStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :project_statistics, [:storage_size, :project_id] - end - - def down - remove_concurrent_index :project_statistics, [:storage_size, :project_id] - end -end diff --git a/db/migrate/20200605160851_add_index_on_wiki_size_and_project_id_to_project_statistics.rb b/db/migrate/20200605160851_add_index_on_wiki_size_and_project_id_to_project_statistics.rb deleted file mode 100644 index d32994afbfc..00000000000 --- a/db/migrate/20200605160851_add_index_on_wiki_size_and_project_id_to_project_statistics.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnWikiSizeAndProjectIdToProjectStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :project_statistics, [:wiki_size, :project_id] - end - - def down - remove_concurrent_index :project_statistics, [:wiki_size, :project_id] - end -end diff --git a/db/migrate/20200607223047_create_cluster_agents.rb b/db/migrate/20200607223047_create_cluster_agents.rb deleted file mode 100644 index 50dd28562e4..00000000000 --- a/db/migrate/20200607223047_create_cluster_agents.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateClusterAgents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:cluster_agents) - with_lock_retries do - create_table :cluster_agents do |t| - t.timestamps_with_timezone null: false - t.belongs_to(:project, null: false, index: true, foreign_key: { on_delete: :cascade }) - t.text :name, null: false - - t.index [:project_id, :name], unique: true - end - end - end - - add_text_limit :cluster_agents, :name, 255 - end - - def down - with_lock_retries do - drop_table :cluster_agents - end - end -end diff --git a/db/migrate/20200607235435_create_cluster_agent_tokens.rb b/db/migrate/20200607235435_create_cluster_agent_tokens.rb deleted file mode 100644 index 30c3ad30fa5..00000000000 --- a/db/migrate/20200607235435_create_cluster_agent_tokens.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateClusterAgentTokens < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:cluster_agent_tokens) - create_table :cluster_agent_tokens do |t| - t.timestamps_with_timezone null: false - t.belongs_to :agent, null: false, index: true, foreign_key: { to_table: :cluster_agents, on_delete: :cascade } - t.text :token_encrypted, null: false - - t.index :token_encrypted, unique: true - end - end - - add_text_limit :cluster_agent_tokens, :token_encrypted, 255 - end - - def down - drop_table :cluster_agent_tokens - end -end diff --git a/db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb b/db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb deleted file mode 100644 index 1bfafb410c0..00000000000 --- a/db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class ChangeColumnDefaultProjectIncidentManagementSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column_default(:project_incident_management_settings, :create_issue, from: true, to: false) - end - - def down - change_column_default(:project_incident_management_settings, :create_issue, from: false, to: true) - end -end diff --git a/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb b/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb deleted file mode 100644 index 3041d7a8e58..00000000000 --- a/db/migrate/20200609012539_add_traversal_ids_to_namespaces.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTraversalIdsToNamespaces < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespaces, :traversal_ids, :integer, array: true, default: [], null: false # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :traversal_ids - end - end -end diff --git a/db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb b/db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb deleted file mode 100644 index af4d4dbbf42..00000000000 --- a/db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullConstraintFromWeightEventsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_null :resource_weight_events, :user_id, true - end -end diff --git a/db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb b/db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb deleted file mode 100644 index 41204afb014..00000000000 --- a/db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullConstraintFromMilestoneEventsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_null :resource_milestone_events, :user_id, true - end -end diff --git a/db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb b/db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb deleted file mode 100644 index ffa047a78f9..00000000000 --- a/db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullConstraintFromStateEventsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_null :resource_state_events, :user_id, true - end -end diff --git a/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb b/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb deleted file mode 100644 index a2931824ef5..00000000000 --- a/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -class AddIncidentSettingsToAllExistingProjects < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # Add records to projects project_incident_management_settings - # to preserve behavior for existing projects that - # are using the create issue functionality with the default setting of true - query = <<-SQL - WITH project_ids AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported}( - SELECT DISTINCT issues.project_id AS id - FROM issues - LEFT OUTER JOIN project_incident_management_settings - ON project_incident_management_settings.project_id = issues.project_id - INNER JOIN label_links - ON label_links.target_type = 'Issue' - AND label_links.target_id = issues.id - INNER JOIN labels - ON labels.id = label_links.label_id - WHERE ( project_incident_management_settings.project_id IS NULL ) - -- Use incident labels even though they could be manually added by users who - -- are not using alert funtionality. - AND labels.title = 'incident' - AND labels.color = '#CC0033' - AND labels.description = 'Denotes a disruption to IT services and the associated issues require immediate attention' - ) - INSERT INTO project_incident_management_settings (project_id, create_issue, send_email, issue_template_key) - SELECT project_ids.id, TRUE, FALSE, NULL - FROM project_ids - ON CONFLICT (project_id) DO NOTHING; - SQL - - execute(query) - end - - def down - # no-op - end -end diff --git a/db/migrate/20200610033228_create_terraform_state_versions.rb b/db/migrate/20200610033228_create_terraform_state_versions.rb deleted file mode 100644 index 10e9faa56ab..00000000000 --- a/db/migrate/20200610033228_create_terraform_state_versions.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -class CreateTerraformStateVersions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :terraform_state_versions, if_not_exists: true do |t| - t.references :terraform_state, index: false, null: false, foreign_key: { on_delete: :cascade } - t.references :created_by_user, foreign_key: false - t.timestamps_with_timezone null: false - t.integer :version, null: false - t.integer :file_store, limit: 2, null: false - t.text :file, null: false - - t.index [:terraform_state_id, :version], unique: true, name: 'index_terraform_state_versions_on_state_id_and_version' - end - - add_text_limit :terraform_state_versions, :file, 255 - end - - def down - drop_table :terraform_state_versions - end -end diff --git a/db/migrate/20200610040615_add_versioning_enabled_to_terraform_states.rb b/db/migrate/20200610040615_add_versioning_enabled_to_terraform_states.rb deleted file mode 100644 index 51a9fd3908b..00000000000 --- a/db/migrate/20200610040615_add_versioning_enabled_to_terraform_states.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddVersioningEnabledToTerraformStates < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :terraform_states, :versioning_enabled, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20200610130002_create_vulnerability_statistics.rb b/db/migrate/20200610130002_create_vulnerability_statistics.rb deleted file mode 100644 index 77fd116230e..00000000000 --- a/db/migrate/20200610130002_create_vulnerability_statistics.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :vulnerability_statistics do |t| - t.timestamps_with_timezone null: false - t.references :project, null: false, foreign_key: { on_delete: :cascade } - t.integer :total, default: 0, null: false - t.integer :critical, default: 0, null: false - t.integer :high, default: 0, null: false - t.integer :medium, default: 0, null: false - t.integer :low, default: 0, null: false - t.integer :unknown, default: 0, null: false - t.integer :info, default: 0, null: false - t.integer :letter_grade, limit: 1, index: true, null: false - end - end - end - - def down - with_lock_retries do - drop_table :vulnerability_statistics - end - end -end diff --git a/db/migrate/20200611013227_add_users_foreign_key_to_terraform_state_versions.rb b/db/migrate/20200611013227_add_users_foreign_key_to_terraform_state_versions.rb deleted file mode 100644 index b599622c776..00000000000 --- a/db/migrate/20200611013227_add_users_foreign_key_to_terraform_state_versions.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUsersForeignKeyToTerraformStateVersions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :terraform_state_versions, :users, column: :created_by_user_id, on_delete: :nullify - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :terraform_state_versions, :users, column: :created_by_user_id - end - end -end diff --git a/db/migrate/20200613104045_add_compliance_frameworks_to_application_settings.rb b/db/migrate/20200613104045_add_compliance_frameworks_to_application_settings.rb deleted file mode 100644 index be6f14692e7..00000000000 --- a/db/migrate/20200613104045_add_compliance_frameworks_to_application_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddComplianceFrameworksToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :application_settings, :compliance_frameworks, :integer, limit: 2, array: true, default: [], null: false - end - end - - def down - with_lock_retries do - remove_column :application_settings, :compliance_frameworks - end - end -end diff --git a/db/migrate/20200615083635_add_composer_json_to_metadata.rb b/db/migrate/20200615083635_add_composer_json_to_metadata.rb deleted file mode 100644 index 0240d298d34..00000000000 --- a/db/migrate/20200615083635_add_composer_json_to_metadata.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddComposerJsonToMetadata < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :packages_composer_metadata, :composer_json, :jsonb, default: {}, null: false - end -end diff --git a/db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb b/db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb deleted file mode 100644 index bc8956ff6df..00000000000 --- a/db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddProjectsForeignKeyToProjectAccessTokens < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :project_access_tokens, :projects, column: :project_id - end - - def down - remove_foreign_key_if_exists :project_access_tokens, column: :project_id - end -end diff --git a/db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb b/db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb deleted file mode 100644 index efe3fe13bab..00000000000 --- a/db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddPersonalAccessTokenForeignKeyToProjectAccessTokens < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :project_access_tokens, :personal_access_tokens, column: :personal_access_token_id - end - - def down - remove_foreign_key_if_exists :project_access_tokens, column: :personal_access_token_id - end -end diff --git a/db/migrate/20200615141554_add_closed_by_fields_to_resource_state_events.rb b/db/migrate/20200615141554_add_closed_by_fields_to_resource_state_events.rb deleted file mode 100644 index ba11e64e667..00000000000 --- a/db/migrate/20200615141554_add_closed_by_fields_to_resource_state_events.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddClosedByFieldsToResourceStateEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - add_column :resource_state_events, :close_after_error_tracking_resolve, :boolean, default: false, null: false - add_column :resource_state_events, :close_auto_resolve_prometheus_alert, :boolean, default: false, null: false - end - - def down - remove_column :resource_state_events, :close_auto_resolve_prometheus_alert, :boolean - remove_column :resource_state_events, :close_after_error_tracking_resolve, :boolean - end -end diff --git a/db/migrate/20200615193524_add_verify_known_sign_in_to_application_settings.rb b/db/migrate/20200615193524_add_verify_known_sign_in_to_application_settings.rb deleted file mode 100644 index c50a17968a9..00000000000 --- a/db/migrate/20200615193524_add_verify_known_sign_in_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddVerifyKnownSignInToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :notify_on_unknown_sign_in, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20200615232735_add_index_to_composer_metadata.rb b/db/migrate/20200615232735_add_index_to_composer_metadata.rb deleted file mode 100644 index 72a490c55d8..00000000000 --- a/db/migrate/20200615232735_add_index_to_composer_metadata.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToComposerMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:packages_composer_metadata, [:package_id, :target_sha], unique: true) - end - - def down - remove_concurrent_index(:packages_composer_metadata, [:package_id, :target_sha]) - end -end diff --git a/db/migrate/20200615234047_create_clusters_applications_cilium.rb b/db/migrate/20200615234047_create_clusters_applications_cilium.rb deleted file mode 100644 index 9f77ee71164..00000000000 --- a/db/migrate/20200615234047_create_clusters_applications_cilium.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class CreateClustersApplicationsCilium < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :clusters_applications_cilium do |t| - t.references :cluster, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } - t.timestamps_with_timezone null: false - t.integer :status, null: false - t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns - end - end -end diff --git a/db/migrate/20200616124338_add_plan_limits_for_max_size_per_artifact_type.rb b/db/migrate/20200616124338_add_plan_limits_for_max_size_per_artifact_type.rb deleted file mode 100644 index 28fadb495dd..00000000000 --- a/db/migrate/20200616124338_add_plan_limits_for_max_size_per_artifact_type.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -class AddPlanLimitsForMaxSizePerArtifactType < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - # We need to set the 20mb default for lsif for backward compatibility - # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34767#note_371619075 - add_column :plan_limits, "ci_max_artifact_size_lsif", :integer, default: 20, null: false - - artifact_types.each do |type| - add_column :plan_limits, "ci_max_artifact_size_#{type}", :integer, default: 0, null: false - end - end - - private - - def artifact_types - # The list of artifact types (except lsif) from Ci::JobArtifact file_type enum as of this writing. - # Intentionally duplicated so that the migration won't change behavior - # if ever we remove or add more to the list later on. - %w[ - archive - metadata - trace - junit - sast - dependency_scanning - container_scanning - dast - codequality - license_management - license_scanning - performance - metrics - metrics_referee - network_referee - dotenv - cobertura - terraform - accessibility - cluster_applications - secret_detection - requirements - coverage_fuzzing - ] - end -end diff --git a/db/migrate/20200616145031_add_author_id_index_to_audit_events.rb b/db/migrate/20200616145031_add_author_id_index_to_audit_events.rb deleted file mode 100644 index cb06fbe2b11..00000000000 --- a/db/migrate/20200616145031_add_author_id_index_to_audit_events.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddAuthorIdIndexToAuditEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_audit_events_on_entity_id_entity_type_id_desc_author_id' - OLD_INDEX_NAME = 'index_audit_events_on_entity_id_and_entity_type_and_id_desc' - - def up - add_concurrent_index(:audit_events, [:entity_id, :entity_type, :id, :author_id], order: { id: :desc }, name: INDEX_NAME) - remove_concurrent_index_by_name(:audit_events, OLD_INDEX_NAME) - end - - def down - add_concurrent_index(:audit_events, [:entity_id, :entity_type, :id], order: { id: :desc }, name: OLD_INDEX_NAME) - remove_concurrent_index_by_name(:audit_events, INDEX_NAME) - end -end diff --git a/db/migrate/20200617000757_clean_up_file_store_lfs_objects.rb b/db/migrate/20200617000757_clean_up_file_store_lfs_objects.rb deleted file mode 100644 index a1a86355d02..00000000000 --- a/db/migrate/20200617000757_clean_up_file_store_lfs_objects.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CleanUpFileStoreLfsObjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # rubocop:disable Migration/UpdateColumnInBatches - update_column_in_batches(:lfs_objects, :file_store, 1) do |table, query| - query.where(table[:file_store].eq(nil)) - end - # rubocop:enable Migration/UpdateColumnInBatches - end - - def down - # no-op - end -end diff --git a/db/migrate/20200617001001_clean_up_store_uploads.rb b/db/migrate/20200617001001_clean_up_store_uploads.rb deleted file mode 100644 index 970d0485b0d..00000000000 --- a/db/migrate/20200617001001_clean_up_store_uploads.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CleanUpStoreUploads < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # rubocop:disable Migration/UpdateColumnInBatches - update_column_in_batches(:uploads, :store, 1) do |table, query| - query.where(table[:store].eq(nil)) - end - # rubocop:enable Migration/UpdateColumnInBatches - end - - def down - # no-op - end -end diff --git a/db/migrate/20200617001118_clean_up_file_store_ci_job_artifacts.rb b/db/migrate/20200617001118_clean_up_file_store_ci_job_artifacts.rb deleted file mode 100644 index e30f7e342e5..00000000000 --- a/db/migrate/20200617001118_clean_up_file_store_ci_job_artifacts.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class CleanUpFileStoreCiJobArtifacts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - # rubocop:disable Migration/UpdateColumnInBatches - # rubocop:disable Migration/UpdateLargeTable - update_column_in_batches(:ci_job_artifacts, :file_store, 1) do |table, query| - query.where(table[:file_store].eq(nil)) - end - # rubocop:enable Migration/UpdateColumnInBatches - # rubocop:enable Migration/UpdateLargeTable - end - - def down - # no-op - end -end diff --git a/db/migrate/20200617150041_create_namespace_limits.rb b/db/migrate/20200617150041_create_namespace_limits.rb deleted file mode 100644 index 59a014ff7ca..00000000000 --- a/db/migrate/20200617150041_create_namespace_limits.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class CreateNamespaceLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :namespace_limits, id: false do |t| - t.bigint :additional_purchased_storage_size, default: 0, null: false - t.date :additional_purchased_storage_ends_on, null: true - - t.references :namespace, primary_key: true, default: nil, type: :integer, index: false, foreign_key: { on_delete: :cascade } - end - end - end - - def down - drop_table :namespace_limits - end -end diff --git a/db/migrate/20200617205000_add_deploy_key_id_to_push_access_levels.rb b/db/migrate/20200617205000_add_deploy_key_id_to_push_access_levels.rb deleted file mode 100644 index 11b92c2a321..00000000000 --- a/db/migrate/20200617205000_add_deploy_key_id_to_push_access_levels.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddDeployKeyIdToPushAccessLevels < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:protected_branch_push_access_levels, :deploy_key_id) - add_column :protected_branch_push_access_levels, :deploy_key_id, :integer - end - - add_concurrent_foreign_key :protected_branch_push_access_levels, :keys, column: :deploy_key_id, on_delete: :cascade - add_concurrent_index :protected_branch_push_access_levels, :deploy_key_id, name: 'index_deploy_key_id_on_protected_branch_push_access_levels' - end - - def down - remove_column :protected_branch_push_access_levels, :deploy_key_id - end -end diff --git a/db/migrate/20200618105638_add_index_on_id_and_created_at_to_snippets.rb b/db/migrate/20200618105638_add_index_on_id_and_created_at_to_snippets.rb deleted file mode 100644 index d9ef3b18e9b..00000000000 --- a/db/migrate/20200618105638_add_index_on_id_and_created_at_to_snippets.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnIdAndCreatedAtToSnippets < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :snippets, [:id, :created_at] - end - - def down - remove_concurrent_index :snippets, [:id, :created_at] - end -end diff --git a/db/migrate/20200618134223_restore_previous_schema_without_lock_version_null_constraint.rb b/db/migrate/20200618134223_restore_previous_schema_without_lock_version_null_constraint.rb deleted file mode 100644 index 85e98d05d02..00000000000 --- a/db/migrate/20200618134223_restore_previous_schema_without_lock_version_null_constraint.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class RestorePreviousSchemaWithoutLockVersionNullConstraint < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - TABLES = %i(epics merge_requests issues ci_stages ci_builds ci_pipelines).freeze - - disable_ddl_transaction! - - def up - TABLES.each do |table| - remove_not_null_constraint table, :lock_version - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20200618134723_restore_previous_schema_with_lock_version_indices.rb b/db/migrate/20200618134723_restore_previous_schema_with_lock_version_indices.rb deleted file mode 100644 index 64fdb373387..00000000000 --- a/db/migrate/20200618134723_restore_previous_schema_with_lock_version_indices.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class RestorePreviousSchemaWithLockVersionIndices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :issues, :lock_version, where: "lock_version IS NULL" - add_concurrent_index :merge_requests, :lock_version, where: "lock_version IS NULL" - add_concurrent_index :epics, :lock_version, where: "lock_version IS NULL" - add_concurrent_index :ci_stages, :id, where: "lock_version IS NULL", name: "tmp_index_ci_stages_lock_version" - add_concurrent_index :ci_builds, :id, where: "lock_version IS NULL", name: "tmp_index_ci_builds_lock_version" - add_concurrent_index :ci_pipelines, :id, where: "lock_version IS NULL", name: "tmp_index_ci_pipelines_lock_version" - end - - def down - # no-op - end -end diff --git a/db/migrate/20200619000316_add_has_confluence_to_project_settings.rb b/db/migrate/20200619000316_add_has_confluence_to_project_settings.rb deleted file mode 100644 index 0f33e0bc47a..00000000000 --- a/db/migrate/20200619000316_add_has_confluence_to_project_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddHasConfluenceToProjectSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_settings, :has_confluence, :boolean, default: false, null: false - end - end - - def down - with_lock_retries do - remove_column :project_settings, :has_confluence - end - end -end diff --git a/db/migrate/20200619154527_add_project_key_to_jira_tracker_data.rb b/db/migrate/20200619154527_add_project_key_to_jira_tracker_data.rb deleted file mode 100644 index 574eb99a6cc..00000000000 --- a/db/migrate/20200619154527_add_project_key_to_jira_tracker_data.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddProjectKeyToJiraTrackerData < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20200619154528_add_text_limit_to_jira_tracker_data_project_key - def change - add_column :jira_tracker_data, :project_key, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200619154528_add_text_limit_to_jira_tracker_data_project_key.rb b/db/migrate/20200619154528_add_text_limit_to_jira_tracker_data_project_key.rb deleted file mode 100644 index 6cf8a787381..00000000000 --- a/db/migrate/20200619154528_add_text_limit_to_jira_tracker_data_project_key.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToJiraTrackerDataProjectKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :jira_tracker_data, :project_key, 255 - end - - def down - remove_text_limit :jira_tracker_data, :project_key - end -end diff --git a/db/migrate/20200622040750_add_prometheus_alert_id_to_alert_management_alerts.rb b/db/migrate/20200622040750_add_prometheus_alert_id_to_alert_management_alerts.rb deleted file mode 100644 index e7669db0a28..00000000000 --- a/db/migrate/20200622040750_add_prometheus_alert_id_to_alert_management_alerts.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddPrometheusAlertIdToAlertManagementAlerts < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :alert_management_alerts, :prometheus_alert_id, :integer - - add_column :alert_management_alerts, :environment_id, :integer - end - - def down - remove_column :alert_management_alerts, :prometheus_alert_id - remove_column :alert_management_alerts, :environment_id - end -end diff --git a/db/migrate/20200622070606_add_vendor_to_vulnerability_scanners.rb b/db/migrate/20200622070606_add_vendor_to_vulnerability_scanners.rb deleted file mode 100644 index 2c9c0a9110d..00000000000 --- a/db/migrate/20200622070606_add_vendor_to_vulnerability_scanners.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddVendorToVulnerabilityScanners < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - DEFAULT_SCANNER_VENDOR = 'GitLab' - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20200622070620_add_limit_to_vulnerability_scanners_vendor - def up - with_lock_retries do - add_column :vulnerability_scanners, :vendor, :text, default: DEFAULT_SCANNER_VENDOR, null: false - end - end - - def down - with_lock_retries do - remove_column :vulnerability_scanners, :vendor - end - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200622070620_add_limit_to_vulnerability_scanners_vendor.rb b/db/migrate/20200622070620_add_limit_to_vulnerability_scanners_vendor.rb deleted file mode 100644 index efcbbde3e29..00000000000 --- a/db/migrate/20200622070620_add_limit_to_vulnerability_scanners_vendor.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddLimitToVulnerabilityScannersVendor < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :vulnerability_scanners, :vendor, 255, validate: false - end - - def down - remove_text_limit :vulnerability_scanners, :vendor - end -end diff --git a/db/migrate/20200622095419_add_snippets_size_to_project_statistics.rb b/db/migrate/20200622095419_add_snippets_size_to_project_statistics.rb deleted file mode 100644 index 9fe470478b8..00000000000 --- a/db/migrate/20200622095419_add_snippets_size_to_project_statistics.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddSnippetsSizeToProjectStatistics < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_statistics, :snippets_size, :bigint - end -end diff --git a/db/migrate/20200622103836_create_snippet_statistics.rb b/db/migrate/20200622103836_create_snippet_statistics.rb deleted file mode 100644 index 691a9acdc04..00000000000 --- a/db/migrate/20200622103836_create_snippet_statistics.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CreateSnippetStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :snippet_statistics, id: false do |t| - t.references :snippet, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade } - t.bigint :repository_size, default: 0, null: false - t.bigint :file_count, default: 0, null: false - t.bigint :commit_count, default: 0, null: false - end - end - end - - def down - with_lock_retries do - drop_table :snippet_statistics - end - end -end diff --git a/db/migrate/20200622104923_create_ci_pipeline_messages_table.rb b/db/migrate/20200622104923_create_ci_pipeline_messages_table.rb deleted file mode 100644 index 40d63b1189e..00000000000 --- a/db/migrate/20200622104923_create_ci_pipeline_messages_table.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateCiPipelineMessagesTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - ERROR_SEVERITY = 0 - MAX_CONTENT_LENGTH = 10_000 - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :ci_pipeline_messages do |t| - t.integer :severity, null: false, default: ERROR_SEVERITY, limit: 2 - t.references :pipeline, index: true, null: false, foreign_key: { to_table: :ci_pipelines, on_delete: :cascade }, type: :integer - t.text :content, null: false - end - end - - add_text_limit :ci_pipeline_messages, :content, MAX_CONTENT_LENGTH - end - - def down - drop_table :ci_pipeline_messages - end -end diff --git a/db/migrate/20200622235737_remove_index_ci_job_artifacts_file_store_is_null.rb b/db/migrate/20200622235737_remove_index_ci_job_artifacts_file_store_is_null.rb deleted file mode 100644 index e293bcfa1ce..00000000000 --- a/db/migrate/20200622235737_remove_index_ci_job_artifacts_file_store_is_null.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexCiJobArtifactsFileStoreIsNull < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_job_artifacts_file_store_is_null' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name(:ci_job_artifacts, INDEX_NAME) - end - - def down - add_concurrent_index(:ci_job_artifacts, :id, where: "file_store IS NULL", name: INDEX_NAME) - end -end diff --git a/db/migrate/20200623000148_remove_index_lfs_objects_file_store_is_null.rb b/db/migrate/20200623000148_remove_index_lfs_objects_file_store_is_null.rb deleted file mode 100644 index 76faa5c4cd2..00000000000 --- a/db/migrate/20200623000148_remove_index_lfs_objects_file_store_is_null.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexLfsObjectsFileStoreIsNull < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_lfs_objects_file_store_is_null' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name(:lfs_objects, INDEX_NAME) - end - - def down - add_concurrent_index(:lfs_objects, :id, where: "file_store IS NULL", name: INDEX_NAME) - end -end diff --git a/db/migrate/20200623000320_remove_index_uploads_store_is_null.rb b/db/migrate/20200623000320_remove_index_uploads_store_is_null.rb deleted file mode 100644 index ad84cd5a649..00000000000 --- a/db/migrate/20200623000320_remove_index_uploads_store_is_null.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexUploadsStoreIsNull < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_uploads_store_is_null' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name(:uploads, INDEX_NAME) - end - - def down - add_concurrent_index(:uploads, :id, where: "store IS NULL", name: INDEX_NAME) - end -end diff --git a/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb b/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb deleted file mode 100644 index 01d0d8ce1d4..00000000000 --- a/db/migrate/20200623073431_add_source_merge_request_id_to_resource_state_events.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class AddSourceMergeRequestIdToResourceStateEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - INDEX_NAME = 'index_resource_state_events_on_source_merge_request_id' - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:resource_state_events, :source_merge_request_id) - add_column :resource_state_events, :source_merge_request_id, :bigint - end - - unless index_exists?(:resource_state_events, :source_merge_request_id, name: INDEX_NAME) - add_index :resource_state_events, :source_merge_request_id, name: INDEX_NAME # rubocop: disable Migration/AddIndex - end - - unless foreign_key_exists?(:resource_state_events, :merge_requests, column: :source_merge_request_id) - with_lock_retries do - add_foreign_key :resource_state_events, :merge_requests, column: :source_merge_request_id, on_delete: :nullify - end - end - end - - def down - with_lock_retries do - remove_column :resource_state_events, :source_merge_request_id - end - end -end diff --git a/db/migrate/20200623090030_add_author_name_to_audit_event.rb b/db/migrate/20200623090030_add_author_name_to_audit_event.rb deleted file mode 100644 index 8b45503189a..00000000000 --- a/db/migrate/20200623090030_add_author_name_to_audit_event.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddAuthorNameToAuditEvent < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - def up - unless column_exists?(:audit_events, :author_name) - with_lock_retries do - add_column :audit_events, :author_name, :text - end - end - - add_text_limit :audit_events, :author_name, 255 - end - - def down - remove_column :audit_events, :author_name - end -end diff --git a/db/migrate/20200623121135_create_dynamic_partitions_schema.rb b/db/migrate/20200623121135_create_dynamic_partitions_schema.rb deleted file mode 100644 index 931a55ebcf4..00000000000 --- a/db/migrate/20200623121135_create_dynamic_partitions_schema.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreateDynamicPartitionsSchema < ActiveRecord::Migration[6.0] - include Gitlab::Database::SchemaHelpers - - DOWNTIME = false - - def up - execute 'CREATE SCHEMA gitlab_partitions_dynamic' - - create_comment(:schema, :gitlab_partitions_dynamic, <<~EOS.strip) - Schema to hold partitions managed dynamically from the application, e.g. for time space partitioning. - EOS - end - - def down - execute 'DROP SCHEMA gitlab_partitions_dynamic' - end -end diff --git a/db/migrate/20200623141217_add_view_diffs_file_by_file_to_user_preferences.rb b/db/migrate/20200623141217_add_view_diffs_file_by_file_to_user_preferences.rb deleted file mode 100644 index 9ea38bd4ab4..00000000000 --- a/db/migrate/20200623141217_add_view_diffs_file_by_file_to_user_preferences.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddViewDiffsFileByFileToUserPreferences < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - add_column :user_preferences, :view_diffs_file_by_file, :boolean, default: false, null: false - end - end - - def down - with_lock_retries do - remove_column :user_preferences, :view_diffs_file_by_file, :boolean - end - end -end diff --git a/db/migrate/20200623141544_create_elastic_reindexing_task.rb b/db/migrate/20200623141544_create_elastic_reindexing_task.rb deleted file mode 100644 index 7089df4f1ea..00000000000 --- a/db/migrate/20200623141544_create_elastic_reindexing_task.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class CreateElasticReindexingTask < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :elastic_reindexing_tasks do |t| - t.timestamps_with_timezone null: false - t.integer :documents_count - t.integer :state, null: false, default: 0, limit: 2, index: true - t.boolean :in_progress, null: false, default: true - t.text :index_name_from - t.text :index_name_to - t.text :elastic_task - t.text :error_message - end - - add_text_limit :elastic_reindexing_tasks, :index_name_from, 255 - add_text_limit :elastic_reindexing_tasks, :index_name_to, 255 - add_text_limit :elastic_reindexing_tasks, :elastic_task, 255 - add_text_limit :elastic_reindexing_tasks, :error_message, 255 - - add_index :elastic_reindexing_tasks, :in_progress, unique: true, where: 'in_progress' - end - - def down - drop_table :elastic_reindexing_tasks - end -end diff --git a/db/migrate/20200623170000_create_static_partitions_schema.rb b/db/migrate/20200623170000_create_static_partitions_schema.rb deleted file mode 100644 index d8878d2fe33..00000000000 --- a/db/migrate/20200623170000_create_static_partitions_schema.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreateStaticPartitionsSchema < ActiveRecord::Migration[6.0] - include Gitlab::Database::SchemaHelpers - - DOWNTIME = false - - def up - execute 'CREATE SCHEMA gitlab_partitions_static' - - create_comment(:schema, :gitlab_partitions_static, <<~EOS.strip) - Schema to hold static partitions, e.g. for hash partitioning - EOS - end - - def down - execute 'DROP SCHEMA gitlab_partitions_static' - end -end diff --git a/db/migrate/20200623185440_add_product_analytics_table.rb b/db/migrate/20200623185440_add_product_analytics_table.rb deleted file mode 100644 index 0a0d438bfb9..00000000000 --- a/db/migrate/20200623185440_add_product_analytics_table.rb +++ /dev/null @@ -1,202 +0,0 @@ -# frozen_string_literal: true - -class AddProductAnalyticsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - # Table is based on https://github.com/snowplow/snowplow/blob/master/4-storage/postgres-storage/sql/atomic-def.sql 6e07b1c, with the following differences: - # * app_id varchar -> project_id integer (+ FK) - # * Add `id bigserial` - # * Hash partitioning based on `project_id` - # * Timestamp columns: Change type to timestamp with time zone - # - # This table is part of the "product analytics experiment" and as such marked "experimental". The goal here is to - # explore the product analytics as a MVP feature more. We are explicitly not spending time on relational modeling - # here. - # - # We expect significant changes to the database part of this once the feature has been validated. - # Therefore, we expect to drop the table when feature validation is complete. All data will be lost. - def up - with_lock_retries do - execute <<~SQL - CREATE TABLE "product_analytics_events_experimental" ( - id bigserial NOT NULL, - -- App - "project_id" integer NOT NULL REFERENCES projects(id) ON DELETE CASCADE, - "platform" varchar(255), - -- Date/time - "etl_tstamp" timestamp with time zone, - "collector_tstamp" timestamp with time zone NOT NULL, - "dvce_created_tstamp" timestamp with time zone, - -- Date/time - "event" varchar(128), - "event_id" char(36) NOT NULL, - "txn_id" integer, - -- Versioning - "name_tracker" varchar(128), - "v_tracker" varchar(100), - "v_collector" varchar(100) NOT NULL, - "v_etl" varchar(100) NOT NULL, - -- User and visit - "user_id" varchar(255), - "user_ipaddress" varchar(45), - "user_fingerprint" varchar(50), - "domain_userid" varchar(36), - "domain_sessionidx" smallint, - "network_userid" varchar(38), - -- Location - "geo_country" char(2), - "geo_region" char(3), - "geo_city" varchar(75), - "geo_zipcode" varchar(15), - "geo_latitude" double precision, - "geo_longitude" double precision, - "geo_region_name" varchar(100), - -- IP lookups - "ip_isp" varchar(100), - "ip_organization" varchar(100), - "ip_domain" varchar(100), - "ip_netspeed" varchar(100), - -- Page - "page_url" text, - "page_title" varchar(2000), - "page_referrer" text, - -- Page URL components - "page_urlscheme" varchar(16), - "page_urlhost" varchar(255), - "page_urlport" integer, - "page_urlpath" varchar(3000), - "page_urlquery" varchar(6000), - "page_urlfragment" varchar(3000), - -- Referrer URL components - "refr_urlscheme" varchar(16), - "refr_urlhost" varchar(255), - "refr_urlport" integer, - "refr_urlpath" varchar(6000), - "refr_urlquery" varchar(6000), - "refr_urlfragment" varchar(3000), - -- Referrer details - "refr_medium" varchar(25), - "refr_source" varchar(50), - "refr_term" varchar(255), - -- Marketing - "mkt_medium" varchar(255), - "mkt_source" varchar(255), - "mkt_term" varchar(255), - "mkt_content" varchar(500), - "mkt_campaign" varchar(255), - -- Custom structured event - "se_category" varchar(1000), - "se_action" varchar(1000), - "se_label" varchar(1000), - "se_property" varchar(1000), - "se_value" double precision, - -- Ecommerce - "tr_orderid" varchar(255), - "tr_affiliation" varchar(255), - "tr_total" decimal(18,2), - "tr_tax" decimal(18,2), - "tr_shipping" decimal(18,2), - "tr_city" varchar(255), - "tr_state" varchar(255), - "tr_country" varchar(255), - "ti_orderid" varchar(255), - "ti_sku" varchar(255), - "ti_name" varchar(255), - "ti_category" varchar(255), - "ti_price" decimal(18,2), - "ti_quantity" integer, - -- Page ping - "pp_xoffset_min" integer, - "pp_xoffset_max" integer, - "pp_yoffset_min" integer, - "pp_yoffset_max" integer, - -- User Agent - "useragent" varchar(1000), - -- Browser - "br_name" varchar(50), - "br_family" varchar(50), - "br_version" varchar(50), - "br_type" varchar(50), - "br_renderengine" varchar(50), - "br_lang" varchar(255), - "br_features_pdf" boolean, - "br_features_flash" boolean, - "br_features_java" boolean, - "br_features_director" boolean, - "br_features_quicktime" boolean, - "br_features_realplayer" boolean, - "br_features_windowsmedia" boolean, - "br_features_gears" boolean, - "br_features_silverlight" boolean, - "br_cookies" boolean, - "br_colordepth" varchar(12), - "br_viewwidth" integer, - "br_viewheight" integer, - -- Operating System - "os_name" varchar(50), - "os_family" varchar(50), - "os_manufacturer" varchar(50), - "os_timezone" varchar(50), - -- Device/Hardware - "dvce_type" varchar(50), - "dvce_ismobile" boolean, - "dvce_screenwidth" integer, - "dvce_screenheight" integer, - -- Document - "doc_charset" varchar(128), - "doc_width" integer, - "doc_height" integer, - -- Currency - "tr_currency" char(3), - "tr_total_base" decimal(18, 2), - "tr_tax_base" decimal(18, 2), - "tr_shipping_base" decimal(18, 2), - "ti_currency" char(3), - "ti_price_base" decimal(18, 2), - "base_currency" char(3), - -- Geolocation - "geo_timezone" varchar(64), - -- Click ID - "mkt_clickid" varchar(128), - "mkt_network" varchar(64), - -- ETL tags - "etl_tags" varchar(500), - -- Time event was sent - "dvce_sent_tstamp" timestamp with time zone, - -- Referer - "refr_domain_userid" varchar(36), - "refr_dvce_tstamp" timestamp with time zone, - -- Session ID - "domain_sessionid" char(36), - -- Derived timestamp - "derived_tstamp" timestamp with time zone, - -- Event schema - "event_vendor" varchar(1000), - "event_name" varchar(1000), - "event_format" varchar(128), - "event_version" varchar(128), - -- Event fingerprint - "event_fingerprint" varchar(128), - -- True timestamp - "true_tstamp" timestamp with time zone, - PRIMARY KEY (id, project_id) - ) PARTITION BY HASH (project_id) - WITHOUT OIDS; - - CREATE INDEX index_product_analytics_events_experimental_project_and_time ON product_analytics_events_experimental (project_id, collector_tstamp); - SQL - - create_hash_partitions :product_analytics_events_experimental, 64 - end - end - - def down - with_lock_retries do - execute 'DROP TABLE product_analytics_events_experimental' - end - end -end diff --git a/db/migrate/20200624075411_add_storage_size_limit_to_plan_limit.rb b/db/migrate/20200624075411_add_storage_size_limit_to_plan_limit.rb deleted file mode 100644 index 7d1b081be02..00000000000 --- a/db/migrate/20200624075411_add_storage_size_limit_to_plan_limit.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddStorageSizeLimitToPlanLimit < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :storage_size_limit, :integer, default: 0, null: false - end -end diff --git a/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb b/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb deleted file mode 100644 index 4b3f5222399..00000000000 --- a/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class CreateAnalyticsCycleAnalyticsGroupValueStreams < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_analytics_ca_group_value_streams_on_group_id_and_name' - - disable_ddl_transaction! - - def up - unless table_exists?(:analytics_cycle_analytics_group_value_streams) - with_lock_retries do - create_table :analytics_cycle_analytics_group_value_streams do |t| - t.timestamps_with_timezone - t.references(:group, - null: false, - index: false, - foreign_key: { to_table: :namespaces, on_delete: :cascade } - ) - t.text :name, null: false - t.index [:group_id, :name], unique: true, name: INDEX_NAME - end - end - end - - add_text_limit :analytics_cycle_analytics_group_value_streams, :name, 100 - end - - def down - drop_table :analytics_cycle_analytics_group_value_streams - end -end diff --git a/db/migrate/20200624142207_add_group_value_stream_to_cycle_analytics_group_stages.rb b/db/migrate/20200624142207_add_group_value_stream_to_cycle_analytics_group_stages.rb deleted file mode 100644 index 3ce912eb440..00000000000 --- a/db/migrate/20200624142207_add_group_value_stream_to_cycle_analytics_group_stages.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddGroupValueStreamToCycleAnalyticsGroupStages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :analytics_cycle_analytics_group_stages, :group_value_stream_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :analytics_cycle_analytics_group_stages, :group_value_stream_id - end - end -end diff --git a/db/migrate/20200624222443_add_default_branch_name_to_application_settings.rb b/db/migrate/20200624222443_add_default_branch_name_to_application_settings.rb deleted file mode 100644 index 5da9006e9a0..00000000000 --- a/db/migrate/20200624222443_add_default_branch_name_to_application_settings.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultBranchNameToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in db/migrate/20200625190458_add_limit_to_default_branch_name_to_application_settings - def change - add_column :application_settings, :default_branch_name, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200625045442_add_idx_and_fk_for_prometheus_and_environment_to_alert_management_alerts.rb b/db/migrate/20200625045442_add_idx_and_fk_for_prometheus_and_environment_to_alert_management_alerts.rb deleted file mode 100644 index f4869b15735..00000000000 --- a/db/migrate/20200625045442_add_idx_and_fk_for_prometheus_and_environment_to_alert_management_alerts.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class AddIdxAndFkForPrometheusAndEnvironmentToAlertManagementAlerts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :alert_management_alerts, :prometheus_alert_id, where: 'prometheus_alert_id is not null' - add_concurrent_foreign_key :alert_management_alerts, :prometheus_alerts, column: :prometheus_alert_id, on_delete: :cascade - - add_concurrent_index :alert_management_alerts, :environment_id, where: 'environment_id is not null' - add_concurrent_foreign_key :alert_management_alerts, :environments, column: :environment_id, on_delete: :nullify - end - - def down - remove_concurrent_index :alert_management_alerts, :prometheus_alert_id - remove_foreign_key_without_error :alert_management_alerts, column: :prometheus_alert_id - - remove_concurrent_index :alert_management_alerts, :environment_id - remove_foreign_key_without_error :alert_management_alerts, column: :environment_id - end -end diff --git a/db/migrate/20200625082258_add_snippets_size_to_root_storage_statistics.rb b/db/migrate/20200625082258_add_snippets_size_to_root_storage_statistics.rb deleted file mode 100644 index 7dd0bd94805..00000000000 --- a/db/migrate/20200625082258_add_snippets_size_to_root_storage_statistics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddSnippetsSizeToRootStorageStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespace_root_storage_statistics, :snippets_size, :bigint, default: 0, null: false - end - end - - def down - with_lock_retries do - remove_column :namespace_root_storage_statistics, :snippets_size - end - end -end diff --git a/db/migrate/20200625113337_add_last_used_to_personal_access_tokens.rb b/db/migrate/20200625113337_add_last_used_to_personal_access_tokens.rb deleted file mode 100644 index c9d155eb628..00000000000 --- a/db/migrate/20200625113337_add_last_used_to_personal_access_tokens.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddLastUsedToPersonalAccessTokens < ActiveRecord::Migration[6.0] - DOWNTIME = false - - include Gitlab::Database::MigrationHelpers - - def up - with_lock_retries do - add_column :personal_access_tokens, :last_used_at, :datetime_with_timezone - end - end - - def down - with_lock_retries do - remove_column :personal_access_tokens, :last_used_at, :datetime_with_timezone - end - end -end diff --git a/db/migrate/20200625174052_add_partial_index_to_locked_pipelines.rb b/db/migrate/20200625174052_add_partial_index_to_locked_pipelines.rb deleted file mode 100644 index 85f706f5d31..00000000000 --- a/db/migrate/20200625174052_add_partial_index_to_locked_pipelines.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddPartialIndexToLockedPipelines < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_pipelines, [:ci_ref_id, :id], name: 'idx_ci_pipelines_artifacts_locked', where: 'locked = 1' - end - - def down - remove_concurrent_index :ci_pipelines, 'idx_ci_pipelines_artifacts_locked' - end -end diff --git a/db/migrate/20200625190458_add_limit_to_default_branch_name_to_application_settings.rb b/db/migrate/20200625190458_add_limit_to_default_branch_name_to_application_settings.rb deleted file mode 100644 index b11eb514577..00000000000 --- a/db/migrate/20200625190458_add_limit_to_default_branch_name_to_application_settings.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddLimitToDefaultBranchNameToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :default_branch_name, 255 - end - - def down - remove_text_limit :application_settings, :default_branch_name - end -end diff --git a/db/migrate/20200625193358_increase_size_on_instance_level_variable_values.rb b/db/migrate/20200625193358_increase_size_on_instance_level_variable_values.rb deleted file mode 100644 index ee665287a31..00000000000 --- a/db/migrate/20200625193358_increase_size_on_instance_level_variable_values.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class IncreaseSizeOnInstanceLevelVariableValues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - existing_constraint_name = text_limit_name(:ci_instance_variables, :encrypted_value) - new_constraint_name = check_constraint_name(:ci_instance_variables, :encrypted_value, :char_length_updated) - - add_text_limit(:ci_instance_variables, :encrypted_value, 13_579, constraint_name: new_constraint_name) - remove_check_constraint(:ci_instance_variables, existing_constraint_name) - end - - def down - # no-op - end -end diff --git a/db/migrate/20200626130220_drop_partitions_dynamic_schema_if_exists.rb b/db/migrate/20200626130220_drop_partitions_dynamic_schema_if_exists.rb deleted file mode 100644 index fa31bc8ff0e..00000000000 --- a/db/migrate/20200626130220_drop_partitions_dynamic_schema_if_exists.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class DropPartitionsDynamicSchemaIfExists < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # This targets GitLab.com only - we deployed a migration to create this schema, but reverted the change - execute 'DROP SCHEMA IF EXISTS partitions_dynamic' - end - - def down - # no-op - end -end diff --git a/db/migrate/20200628210938_add_maintenance_mode_application_to_settings.rb b/db/migrate/20200628210938_add_maintenance_mode_application_to_settings.rb deleted file mode 100644 index 6f1959a128f..00000000000 --- a/db/migrate/20200628210938_add_maintenance_mode_application_to_settings.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddMaintenanceModeApplicationToSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:application_settings, :maintenance_mode) - change_table :application_settings do |t| - t.boolean :maintenance_mode, default: false, null: false - t.text :maintenance_mode_message - end - end - - add_text_limit(:application_settings, :maintenance_mode_message, 255) - end - - def down - if column_exists?(:application_settings, :maintenance_mode) - remove_column :application_settings, :maintenance_mode - end - - if column_exists?(:application_settings, :maintenance_mode_message) - remove_column :application_settings, :maintenance_mode_message - end - end -end diff --git a/db/migrate/20200629134747_add_extra_index_to_label_links.rb b/db/migrate/20200629134747_add_extra_index_to_label_links.rb deleted file mode 100644 index e2066a1db42..00000000000 --- a/db/migrate/20200629134747_add_extra_index_to_label_links.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddExtraIndexToLabelLinks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_COVERING_ALL_COLUMNS = 'index_on_label_links_all_columns' - INDEX_TO_REPLACE = 'index_label_links_on_label_id' - NEW_INDEX = 'index_label_links_on_label_id_and_target_type' - - disable_ddl_transaction! - - def up - add_concurrent_index :label_links, [:target_id, :label_id, :target_type], name: INDEX_COVERING_ALL_COLUMNS - - add_concurrent_index :label_links, [:label_id, :target_type], name: NEW_INDEX - remove_concurrent_index_by_name(:label_links, INDEX_TO_REPLACE) - end - - def down - remove_concurrent_index_by_name(:label_links, INDEX_COVERING_ALL_COLUMNS) - - add_concurrent_index(:label_links, :label_id, name: INDEX_TO_REPLACE) - remove_concurrent_index_by_name(:label_links, NEW_INDEX) - end -end diff --git a/db/migrate/20200629192638_add_uniq_index_on_metric_identifier_and_project_id.rb b/db/migrate/20200629192638_add_uniq_index_on_metric_identifier_and_project_id.rb deleted file mode 100644 index 3e77f80b5e8..00000000000 --- a/db/migrate/20200629192638_add_uniq_index_on_metric_identifier_and_project_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddUniqIndexOnMetricIdentifierAndProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :prometheus_metrics, [:identifier, :project_id], unique: true - end - - def down - remove_concurrent_index :prometheus_metrics, [:identifier, :project_id] - end -end diff --git a/db/migrate/20200630091656_add_bio_html_to_user_details.rb b/db/migrate/20200630091656_add_bio_html_to_user_details.rb deleted file mode 100644 index 6a9df85d6a4..00000000000 --- a/db/migrate/20200630091656_add_bio_html_to_user_details.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddBioHtmlToUserDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - # Note: bio_html is calculated from bio, the bio column is already constrained - add_column :user_details, :bio_html, :text # rubocop:disable Migration/AddLimitToTextColumns - add_column :user_details, :cached_markdown_version, :integer - end - end - - def down - with_lock_retries do - remove_column :user_details, :bio_html - remove_column :user_details, :cached_markdown_version - end - end -end diff --git a/db/migrate/20200630110826_add_documents_count_target_to_elastic_reindexing_tasks.rb b/db/migrate/20200630110826_add_documents_count_target_to_elastic_reindexing_tasks.rb deleted file mode 100644 index dcb4ccc857d..00000000000 --- a/db/migrate/20200630110826_add_documents_count_target_to_elastic_reindexing_tasks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDocumentsCountTargetToElasticReindexingTasks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :elastic_reindexing_tasks, :documents_count_target, :integer - end -end diff --git a/db/migrate/20200701064756_add_not_valid_foreign_key_to_cycle_analytics_group_stages.rb b/db/migrate/20200701064756_add_not_valid_foreign_key_to_cycle_analytics_group_stages.rb deleted file mode 100644 index e54cecc5af8..00000000000 --- a/db/migrate/20200701064756_add_not_valid_foreign_key_to_cycle_analytics_group_stages.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddNotValidForeignKeyToCycleAnalyticsGroupStages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_analytics_cycle_analytics_group_stages_group_value_stream_id' - INDEX_NAME = 'index_analytics_ca_group_stages_on_value_stream_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :analytics_cycle_analytics_group_stages, :group_value_stream_id, name: INDEX_NAME - add_foreign_key :analytics_cycle_analytics_group_stages, :analytics_cycle_analytics_group_value_streams, - column: :group_value_stream_id, name: CONSTRAINT_NAME, on_delete: :cascade, validate: false - end - - def down - remove_foreign_key_if_exists :analytics_cycle_analytics_group_stages, column: :group_value_stream_id, name: CONSTRAINT_NAME - remove_concurrent_index :analytics_cycle_analytics_group_stages, :group_value_stream_id - end -end diff --git a/db/migrate/20200701093859_add_import_export_limits_to_application_settings.rb b/db/migrate/20200701093859_add_import_export_limits_to_application_settings.rb deleted file mode 100644 index 6f40f439385..00000000000 --- a/db/migrate/20200701093859_add_import_export_limits_to_application_settings.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddImportExportLimitsToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :project_import_limit, :integer, default: 6, null: false - add_column :application_settings, :project_export_limit, :integer, default: 6, null: false - add_column :application_settings, :project_download_export_limit, :integer, default: 1, null: false - - add_column :application_settings, :group_import_limit, :integer, default: 6, null: false - add_column :application_settings, :group_export_limit, :integer, default: 6, null: false - add_column :application_settings, :group_download_export_limit, :integer, default: 1, null: false - end -end diff --git a/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb b/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb deleted file mode 100644 index fcc08723520..00000000000 --- a/db/migrate/20200701190523_add_delayed_project_removal_to_namespaces.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDelayedProjectRemovalToNamespaces < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespaces, :delayed_project_removal, :boolean, default: false, null: false # rubocop:disable Migration/AddColumnsToWideTables - end - end - - def down - with_lock_retries do - remove_column :namespaces, :delayed_project_removal - end - end -end diff --git a/db/migrate/20200701205710_create_background_migration_jobs.rb b/db/migrate/20200701205710_create_background_migration_jobs.rb deleted file mode 100644 index 706b8bd5abe..00000000000 --- a/db/migrate/20200701205710_create_background_migration_jobs.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class CreateBackgroundMigrationJobs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:background_migration_jobs) - create_table :background_migration_jobs do |t| - t.timestamps_with_timezone - t.integer :status, null: false, limit: 2, default: 0 - t.text :class_name, null: false - t.jsonb :arguments, null: false - - t.index [:class_name, :arguments] - t.index [:class_name, :status, :id] - end - end - - add_text_limit :background_migration_jobs, :class_name, 200 - end - - def down - drop_table :background_migration_jobs - end -end diff --git a/db/migrate/20200701221303_change_default_value_of_ci_max_artifact_size_terraform_of_plan_limits_from_0_to_5.rb b/db/migrate/20200701221303_change_default_value_of_ci_max_artifact_size_terraform_of_plan_limits_from_0_to_5.rb deleted file mode 100644 index e295d2f601a..00000000000 --- a/db/migrate/20200701221303_change_default_value_of_ci_max_artifact_size_terraform_of_plan_limits_from_0_to_5.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class ChangeDefaultValueOfCiMaxArtifactSizeTerraformOfPlanLimitsFrom0To5 < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :plan_limits, :ci_max_artifact_size_terraform, 5 - execute('UPDATE plan_limits SET ci_max_artifact_size_terraform = 5 WHERE ci_max_artifact_size_terraform = 0') - end - end - - def down - with_lock_retries do - change_column_default :plan_limits, :ci_max_artifact_size_terraform, 0 - execute('UPDATE plan_limits SET ci_max_artifact_size_terraform = 0 WHERE ci_max_artifact_size_terraform = 5') - end - end -end diff --git a/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb b/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb deleted file mode 100644 index 7562a32a25e..00000000000 --- a/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class ChangeProjectIdIndexToBeUniqueOnVulnerabilityStatisticsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - INDEX_NAME = 'index_vulnerability_statistics_on_unique_project_id' - - def up - remove_index :vulnerability_statistics, :project_id # rubocop:disable Migration/RemoveIndex (table is empty) - add_index :vulnerability_statistics, :project_id, name: INDEX_NAME, unique: true # rubocop:disable Migration/AddIndex (table is empty) - end - - def down - remove_index :vulnerability_statistics, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex (table is empty) - add_index :vulnerability_statistics, :project_id # rubocop:disable Migration/AddIndex (table is empty) - end -end diff --git a/db/migrate/20200702201039_change_prometheus_metrics_identifier_index.rb b/db/migrate/20200702201039_change_prometheus_metrics_identifier_index.rb deleted file mode 100644 index 248195c8c75..00000000000 --- a/db/migrate/20200702201039_change_prometheus_metrics_identifier_index.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class ChangePrometheusMetricsIdentifierIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - NEW_INDEX = :index_prometheus_metrics_on_identifier_and_null_project - OLD_INDEX = :index_prometheus_metrics_on_identifier - - disable_ddl_transaction! - - def up - add_concurrent_index :prometheus_metrics, :identifier, name: NEW_INDEX, unique: true, where: 'project_id IS NULL' - remove_concurrent_index_by_name :prometheus_metrics, OLD_INDEX - end - - def down - add_concurrent_index :prometheus_metrics, :identifier, name: OLD_INDEX, unique: true - remove_concurrent_index_by_name :prometheus_metrics, NEW_INDEX - end -end diff --git a/db/migrate/20200703035021_add_notes_to_timelogs.rb b/db/migrate/20200703035021_add_notes_to_timelogs.rb deleted file mode 100644 index d711fd0400d..00000000000 --- a/db/migrate/20200703035021_add_notes_to_timelogs.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class AddNotesToTimelogs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - add_column :timelogs, :note_id, :integer - end - add_concurrent_index :timelogs, :note_id - add_concurrent_foreign_key :timelogs, :notes, column: :note_id - end - - def down - remove_foreign_key_if_exists :timelogs, column: :note_id - remove_concurrent_index :timelogs, :note_id - with_lock_retries do - remove_column :timelogs, :note_id - end - end -end diff --git a/db/migrate/20200703121557_remove_f_keys_from_ci_daily_report_results_table.rb b/db/migrate/20200703121557_remove_f_keys_from_ci_daily_report_results_table.rb deleted file mode 100644 index 43b869b007d..00000000000 --- a/db/migrate/20200703121557_remove_f_keys_from_ci_daily_report_results_table.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class RemoveFKeysFromCiDailyReportResultsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - remove_foreign_key_if_exists :ci_daily_report_results, :projects - remove_foreign_key_if_exists :ci_daily_report_results, :ci_pipelines - end - end - - def down - add_concurrent_foreign_key :ci_daily_report_results, :projects, column: :project_id, on_delete: :cascade - add_concurrent_foreign_key :ci_daily_report_results, :ci_pipelines, column: :last_pipeline_id, on_delete: :cascade - end -end diff --git a/db/migrate/20200703124823_create_namespace_settings.rb b/db/migrate/20200703124823_create_namespace_settings.rb deleted file mode 100644 index 907b9d2ca8c..00000000000 --- a/db/migrate/20200703124823_create_namespace_settings.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class CreateNamespaceSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :namespace_settings, id: false do |t| - t.timestamps_with_timezone null: false - t.references :namespace, primary_key: true, default: nil, type: :integer, index: false, foreign_key: { on_delete: :cascade } - end - end - end - - def down - drop_table :namespace_settings - end -end diff --git a/db/migrate/20200703154822_add_issues_enabled_to_jira_tracker_data.rb b/db/migrate/20200703154822_add_issues_enabled_to_jira_tracker_data.rb deleted file mode 100644 index e56f6f6ee11..00000000000 --- a/db/migrate/20200703154822_add_issues_enabled_to_jira_tracker_data.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddIssuesEnabledToJiraTrackerData < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :jira_tracker_data, :issues_enabled, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200706005325_remove_elastic_batch_project_indexer_worker_queue.rb b/db/migrate/20200706005325_remove_elastic_batch_project_indexer_worker_queue.rb deleted file mode 100644 index 07854096a8b..00000000000 --- a/db/migrate/20200706005325_remove_elastic_batch_project_indexer_worker_queue.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class RemoveElasticBatchProjectIndexerWorkerQueue < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - Sidekiq.redis do |conn| - conn.del "queue:elastic_batch_project_indexer" - end - end -end diff --git a/db/migrate/20200706035141_adjust_unique_index_alert_management_alerts.rb b/db/migrate/20200706035141_adjust_unique_index_alert_management_alerts.rb deleted file mode 100644 index 0a6e614be9a..00000000000 --- a/db/migrate/20200706035141_adjust_unique_index_alert_management_alerts.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class AdjustUniqueIndexAlertManagementAlerts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_alert_management_alerts_on_project_id_and_fingerprint' - NEW_INDEX_NAME = 'index_partial_am_alerts_on_project_id_and_fingerprint' - RESOLVED_STATUS = 2 - - disable_ddl_transaction! - - def up - add_concurrent_index(:alert_management_alerts, %w(project_id fingerprint), where: "status <> #{RESOLVED_STATUS}", name: NEW_INDEX_NAME, unique: true, using: :btree) - remove_concurrent_index_by_name :alert_management_alerts, INDEX_NAME - end - - def down - # Nullify duplicate fingerprints, except for the newest of each match (project_id, fingerprint). - query = <<-SQL - UPDATE alert_management_alerts am - SET fingerprint = NULL - WHERE am.created_at <> - (SELECT MAX(created_at) - FROM alert_management_alerts am2 - WHERE am.fingerprint = am2.fingerprint AND am.project_id = am2.project_id) - AND am.fingerprint IS NOT NULL; - SQL - - execute(query) - - remove_concurrent_index_by_name :alert_management_alerts, NEW_INDEX_NAME - add_concurrent_index(:alert_management_alerts, %w(project_id fingerprint), name: INDEX_NAME, unique: true, using: :btree) - end -end diff --git a/db/migrate/20200706170536_add_temporary_storage_increase_to_namespace_limits.rb b/db/migrate/20200706170536_add_temporary_storage_increase_to_namespace_limits.rb deleted file mode 100644 index 0b6d57831c7..00000000000 --- a/db/migrate/20200706170536_add_temporary_storage_increase_to_namespace_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddTemporaryStorageIncreaseToNamespaceLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :namespace_limits, :temporary_storage_increase_ends_on, :date, null: true - end -end diff --git a/db/migrate/20200707071941_drop_old_non_unique_index_on_mr_metrics.rb b/db/migrate/20200707071941_drop_old_non_unique_index_on_mr_metrics.rb deleted file mode 100644 index aa90a0c5915..00000000000 --- a/db/migrate/20200707071941_drop_old_non_unique_index_on_mr_metrics.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class DropOldNonUniqueIndexOnMrMetrics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_merge_request_metrics' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) - end - - def down - add_concurrent_index :merge_request_metrics, :merge_request_id, name: INDEX_NAME - end -end diff --git a/db/migrate/20200707094341_add_browser_performance_to_plan_limits.rb b/db/migrate/20200707094341_add_browser_performance_to_plan_limits.rb deleted file mode 100644 index ef0bea88ead..00000000000 --- a/db/migrate/20200707094341_add_browser_performance_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddBrowserPerformanceToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, "ci_max_artifact_size_browser_performance", :integer, default: 0, null: false - end -end diff --git a/db/migrate/20200707095849_add_load_performance_to_plan_limits.rb b/db/migrate/20200707095849_add_load_performance_to_plan_limits.rb deleted file mode 100644 index df95956f089..00000000000 --- a/db/migrate/20200707095849_add_load_performance_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddLoadPerformanceToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, "ci_max_artifact_size_load_performance", :integer, default: 0, null: false - end -end diff --git a/db/migrate/20200708080631_add_pager_duty_integration_columns_to_project_incident_management_settings.rb b/db/migrate/20200708080631_add_pager_duty_integration_columns_to_project_incident_management_settings.rb deleted file mode 100644 index ab56a863f51..00000000000 --- a/db/migrate/20200708080631_add_pager_duty_integration_columns_to_project_incident_management_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddPagerDutyIntegrationColumnsToProjectIncidentManagementSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # limit constraints added in a separate migration: - # 20200710130234_add_limit_constraints_to_project_incident_management_settings_token.rb - def change - add_column :project_incident_management_settings, :pagerduty_active, :boolean, null: false, default: false - add_column :project_incident_management_settings, :encrypted_pagerduty_token, :binary, null: true - add_column :project_incident_management_settings, :encrypted_pagerduty_token_iv, :binary, null: true - end -end diff --git a/db/migrate/20200710105332_change_issues_create_limit_default.rb b/db/migrate/20200710105332_change_issues_create_limit_default.rb deleted file mode 100644 index 9fbd5375395..00000000000 --- a/db/migrate/20200710105332_change_issues_create_limit_default.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class ChangeIssuesCreateLimitDefault < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :application_settings, :issues_create_limit, from: 300, to: 0 - end - end - - def down - with_lock_retries do - change_column_default :application_settings, :issues_create_limit, from: 0, to: 300 - end - end -end diff --git a/db/migrate/20200710113437_add_container_registry_delete_tags_service_timeout_to_application_settings.rb b/db/migrate/20200710113437_add_container_registry_delete_tags_service_timeout_to_application_settings.rb deleted file mode 100644 index d3865db2e18..00000000000 --- a/db/migrate/20200710113437_add_container_registry_delete_tags_service_timeout_to_application_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddContainerRegistryDeleteTagsServiceTimeoutToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column( - :application_settings, - :container_registry_delete_tags_service_timeout, - :integer, - default: 250, - null: false - ) - end - - def down - remove_column(:application_settings, :container_registry_delete_tags_service_timeout) - end -end diff --git a/db/migrate/20200710130234_add_limit_constraints_to_project_incident_management_settings_token.rb b/db/migrate/20200710130234_add_limit_constraints_to_project_incident_management_settings_token.rb deleted file mode 100644 index 8af927d0959..00000000000 --- a/db/migrate/20200710130234_add_limit_constraints_to_project_incident_management_settings_token.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddLimitConstraintsToProjectIncidentManagementSettingsToken < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_check_constraint :project_incident_management_settings, 'octet_length(encrypted_pagerduty_token) <= 255', 'pagerduty_token_length_constraint' - add_check_constraint :project_incident_management_settings, 'octet_length(encrypted_pagerduty_token_iv) <= 12', 'pagerduty_token_iv_length_constraint' - end - - def down - remove_check_constraint :project_incident_management_settings, 'pagerduty_token_length_constraint' - remove_check_constraint :project_incident_management_settings, 'pagerduty_token_iv_length_constraint' - end -end diff --git a/db/migrate/20200710152642_add_verification_state_to_terraform_states.rb b/db/migrate/20200710152642_add_verification_state_to_terraform_states.rb deleted file mode 100644 index 71c14faab0c..00000000000 --- a/db/migrate/20200710152642_add_verification_state_to_terraform_states.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationStateToTerraformStates < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_table(:terraform_states) do |t| - t.column :verification_retry_at, :datetime_with_timezone - t.column :verified_at, :datetime_with_timezone - t.integer :verification_retry_count, limit: 2 - t.binary :verification_checksum, using: 'verification_checksum::bytea' - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20200710153009_add_verification_failure_limit_and_index_to_terraform_states - t.text :verification_failure - # rubocop:enable Migration/AddLimitToTextColumns - end - end -end diff --git a/db/migrate/20200710153009_add_verification_failure_limit_and_index_to_terraform_states.rb b/db/migrate/20200710153009_add_verification_failure_limit_and_index_to_terraform_states.rb deleted file mode 100644 index 9d36a8faf4f..00000000000 --- a/db/migrate/20200710153009_add_verification_failure_limit_and_index_to_terraform_states.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationFailureLimitAndIndexToTerraformStates < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :terraform_states, :verification_failure, where: "(verification_failure IS NOT NULL)", name: "terraform_states_verification_failure_partial" - add_concurrent_index :terraform_states, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "terraform_states_verification_checksum_partial" - add_text_limit :terraform_states, :verification_failure, 255 - end - - def down - remove_concurrent_index :terraform_states, :verification_failure - remove_concurrent_index :terraform_states, :verification_checksum - remove_text_limit :terraform_states, :verification_failure - end -end diff --git a/db/migrate/20200712084655_create_dast_sites.rb b/db/migrate/20200712084655_create_dast_sites.rb deleted file mode 100644 index fc8d423ffb2..00000000000 --- a/db/migrate/20200712084655_create_dast_sites.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateDastSites < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :dast_sites do |t| - t.references :project, foreign_key: { on_delete: :cascade }, null: false, index: false - t.timestamps_with_timezone null: false - - t.text :url, null: false - end - end - - add_concurrent_index :dast_sites, [:project_id, :url], unique: true - add_text_limit :dast_sites, :url, 255 - end - - def down - drop_table :dast_sites - end -end diff --git a/db/migrate/20200712235622_create_dast_site_profiles.rb b/db/migrate/20200712235622_create_dast_site_profiles.rb deleted file mode 100644 index 593cccd450a..00000000000 --- a/db/migrate/20200712235622_create_dast_site_profiles.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -class CreateDastSiteProfiles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :dast_site_profiles do |t| - t.references :project, foreign_key: { on_delete: :cascade }, null: false, index: false - t.references :dast_site, foreign_key: { on_delete: :cascade }, null: false - t.timestamps_with_timezone null: false - - t.text :name, null: false - end - end - - add_concurrent_index :dast_site_profiles, [:project_id, :name], unique: true - add_text_limit :dast_site_profiles, :name, 255 - end - - def down - drop_table :dast_site_profiles - end -end diff --git a/db/migrate/20200713141854_add_wiki_page_max_content_bytes_to_application_settings.rb b/db/migrate/20200713141854_add_wiki_page_max_content_bytes_to_application_settings.rb deleted file mode 100644 index c0763d9816c..00000000000 --- a/db/migrate/20200713141854_add_wiki_page_max_content_bytes_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddWikiPageMaxContentBytesToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :wiki_page_max_content_bytes, :bigint, default: 50.megabytes, null: false - end -end diff --git a/db/migrate/20200713152443_add_background_migration_job_index_for_partitioning_migrations.rb b/db/migrate/20200713152443_add_background_migration_job_index_for_partitioning_migrations.rb deleted file mode 100644 index 5ca9b6536ee..00000000000 --- a/db/migrate/20200713152443_add_background_migration_job_index_for_partitioning_migrations.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddBackgroundMigrationJobIndexForPartitioningMigrations < ActiveRecord::Migration[6.0] - DOWNTIME = false - - INDEX_NAME = 'index_background_migration_jobs_for_partitioning_migrations' - - def up - # rubocop:disable Migration/AddIndex - add_index :background_migration_jobs, '((arguments ->> 2))', name: INDEX_NAME, - where: "class_name = 'Gitlab::Database::PartitioningMigrationHelpers::BackfillPartitionedTable'" - # rubocop:enable Migration/AddIndex - end - - def down - remove_index :background_migration_jobs, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex - end -end diff --git a/db/migrate/20200715124210_add_target_details_to_audit_event.rb b/db/migrate/20200715124210_add_target_details_to_audit_event.rb deleted file mode 100644 index 65efe24a1e8..00000000000 --- a/db/migrate/20200715124210_add_target_details_to_audit_event.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddTargetDetailsToAuditEvent < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # rubocop:disable Migration/AddLimitToTextColumns - add_column(:audit_events, :target_details, :text) - # rubocop:enable Migration/AddLimitToTextColumns - end - end - - def down - with_lock_retries do - remove_column(:audit_events, :target_details) - end - end -end diff --git a/db/migrate/20200715135130_create_vulnerability_historical_statistics.rb b/db/migrate/20200715135130_create_vulnerability_historical_statistics.rb deleted file mode 100644 index 6afa123c341..00000000000 --- a/db/migrate/20200715135130_create_vulnerability_historical_statistics.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityHistoricalStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - INDEX_NAME = 'index_vuln_historical_statistics_on_project_id_and_date' - - DOWNTIME = false - - def up - with_lock_retries do - create_table :vulnerability_historical_statistics do |t| - t.timestamps_with_timezone null: false - t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade } - t.integer :total, default: 0, null: false - t.integer :critical, default: 0, null: false - t.integer :high, default: 0, null: false - t.integer :medium, default: 0, null: false - t.integer :low, default: 0, null: false - t.integer :unknown, default: 0, null: false - t.integer :info, default: 0, null: false - t.date :date, null: false - t.integer :letter_grade, limit: 1, null: false - t.index [:project_id, :date], unique: true, name: INDEX_NAME - end - end - end - - def down - with_lock_retries do - drop_table :vulnerability_historical_statistics - end - end -end diff --git a/db/migrate/20200715171155_add_deployment_type_to_tracker.rb b/db/migrate/20200715171155_add_deployment_type_to_tracker.rb deleted file mode 100644 index 649331ecb54..00000000000 --- a/db/migrate/20200715171155_add_deployment_type_to_tracker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDeploymentTypeToTracker < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :jira_tracker_data, :deployment_type, :smallint, default: 0, null: false - end -end diff --git a/db/migrate/20200715202659_add_index_on_package_files_file_store.rb b/db/migrate/20200715202659_add_index_on_package_files_file_store.rb deleted file mode 100644 index 92e8364d22c..00000000000 --- a/db/migrate/20200715202659_add_index_on_package_files_file_store.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnPackageFilesFileStore < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_package_files, :file_store - end - - def down - remove_concurrent_index :packages_package_files, :file_store - end -end diff --git a/db/migrate/20200716044023_add_entity_path_to_audit_events.rb b/db/migrate/20200716044023_add_entity_path_to_audit_events.rb deleted file mode 100644 index d16bfaa0beb..00000000000 --- a/db/migrate/20200716044023_add_entity_path_to_audit_events.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddEntityPathToAuditEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # rubocop:disable Migration/AddLimitToTextColumns - add_column(:audit_events, :entity_path, :text) - # rubocop:enable Migration/AddLimitToTextColumns - end - end - - def down - with_lock_retries do - remove_column(:audit_events, :entity_path) - end - end -end diff --git a/db/migrate/20200716120000_partition_audit_events.rb b/db/migrate/20200716120000_partition_audit_events.rb deleted file mode 100644 index aef090339ea..00000000000 --- a/db/migrate/20200716120000_partition_audit_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class PartitionAuditEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - include Gitlab::Database::PartitioningMigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - disable_ddl_transaction! - - def up - partition_table_by_date :audit_events, :created_at - end - - def down - drop_partitioned_table_for :audit_events - end -end diff --git a/db/migrate/20200716120419_add_text_limit_on_entity_path_to_audit_events.rb b/db/migrate/20200716120419_add_text_limit_on_entity_path_to_audit_events.rb deleted file mode 100644 index 0dea811f41c..00000000000 --- a/db/migrate/20200716120419_add_text_limit_on_entity_path_to_audit_events.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitOnEntityPathToAuditEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :audit_events, :entity_path, 5_500 - end - - def down - remove_text_limit :audit_events, :entity_path - end -end diff --git a/db/migrate/20200716145156_add_text_limit_to_audit_event_target_details.rb b/db/migrate/20200716145156_add_text_limit_to_audit_event_target_details.rb deleted file mode 100644 index 43ee98b69e0..00000000000 --- a/db/migrate/20200716145156_add_text_limit_to_audit_event_target_details.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToAuditEventTargetDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :audit_events, :target_details, 5_500 - end - - def down - remove_text_limit :audit_events, :target_details - end -end diff --git a/db/migrate/20200717040735_change_aws_roles_role_arn_null.rb b/db/migrate/20200717040735_change_aws_roles_role_arn_null.rb deleted file mode 100644 index 707cfe96a7c..00000000000 --- a/db/migrate/20200717040735_change_aws_roles_role_arn_null.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class ChangeAwsRolesRoleArnNull < ActiveRecord::Migration[6.0] - DOWNTIME = false - EXAMPLE_ARN = 'arn:aws:iam::000000000000:role/example-role' - - def up - change_column_null :aws_roles, :role_arn, true - end - - def down - # Records may now exist with nulls, so we must fill them with a dummy value - change_column_null :aws_roles, :role_arn, false, EXAMPLE_ARN - end -end diff --git a/db/migrate/20200717080257_add_prevent_forking_to_namespace_settings.rb b/db/migrate/20200717080257_add_prevent_forking_to_namespace_settings.rb deleted file mode 100644 index b46daac6a98..00000000000 --- a/db/migrate/20200717080257_add_prevent_forking_to_namespace_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddPreventForkingToNamespaceSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :namespace_settings, :prevent_forking_outside_group, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20200717163656_add_moved_project_to_notification_settings.rb b/db/migrate/20200717163656_add_moved_project_to_notification_settings.rb deleted file mode 100644 index 9c60a678c1f..00000000000 --- a/db/migrate/20200717163656_add_moved_project_to_notification_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddMovedProjectToNotificationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :notification_settings, :moved_project, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20200718040100_add_index_on_merge_request_diffs_external_diff_store.rb b/db/migrate/20200718040100_add_index_on_merge_request_diffs_external_diff_store.rb deleted file mode 100644 index 372a9df82a1..00000000000 --- a/db/migrate/20200718040100_add_index_on_merge_request_diffs_external_diff_store.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnMergeRequestDiffsExternalDiffStore < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :merge_request_diffs, :external_diff_store - end - - def down - remove_concurrent_index :merge_request_diffs, :external_diff_store - end -end diff --git a/db/migrate/20200718040200_add_index_on_terraform_states_file_store.rb b/db/migrate/20200718040200_add_index_on_terraform_states_file_store.rb deleted file mode 100644 index 7dddcf1fcea..00000000000 --- a/db/migrate/20200718040200_add_index_on_terraform_states_file_store.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnTerraformStatesFileStore < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :terraform_states, :file_store - end - - def down - remove_concurrent_index :terraform_states, :file_store - end -end diff --git a/db/migrate/20200718040300_add_index_on_vulnerability_exports_file_store.rb b/db/migrate/20200718040300_add_index_on_vulnerability_exports_file_store.rb deleted file mode 100644 index c0d546ae112..00000000000 --- a/db/migrate/20200718040300_add_index_on_vulnerability_exports_file_store.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnVulnerabilityExportsFileStore < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerability_exports, :file_store - end - - def down - remove_concurrent_index :vulnerability_exports, :file_store - end -end diff --git a/db/migrate/20200720053909_add_elasticsearch_indexed_file_size_limit_kb_to_application_settings.rb b/db/migrate/20200720053909_add_elasticsearch_indexed_file_size_limit_kb_to_application_settings.rb deleted file mode 100644 index bab5fe827d0..00000000000 --- a/db/migrate/20200720053909_add_elasticsearch_indexed_file_size_limit_kb_to_application_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddElasticsearchIndexedFileSizeLimitKbToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, - :elasticsearch_indexed_file_size_limit_kb, - :integer, - null: false, - default: 1024 # 1 MiB (units in KiB) - end -end diff --git a/db/migrate/20200720154007_create_vulnerabilities_export_verification_status.rb b/db/migrate/20200720154007_create_vulnerabilities_export_verification_status.rb deleted file mode 100644 index 5cbb5fdd1e5..00000000000 --- a/db/migrate/20200720154007_create_vulnerabilities_export_verification_status.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilitiesExportVerificationStatus < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:vulnerability_export_verification_status) - with_lock_retries do - create_table :vulnerability_export_verification_status, id: false do |t| - t.references :vulnerability_export, - primary_key: true, - null: false, - foreign_key: { on_delete: :cascade }, - index: - { name: 'index_vulnerability_export_verification_status_on_export_id' } - t.datetime_with_timezone :verification_retry_at - t.datetime_with_timezone :verified_at - t.integer :verification_retry_count, limit: 2 - t.binary :verification_checksum, using: 'verification_checksum::bytea' - t.text :verification_failure - - t.index :verification_failure, where: "(verification_failure IS NOT NULL)", name: "vulnerability_exports_verification_failure_partial" - t.index :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: "vulnerability_exports_verification_checksum_partial" - end - end - end - - add_text_limit :vulnerability_export_verification_status, :verification_failure, 255 - end - - def down - return unless table_exists?(:vulnerability_export_verification_status) - - with_lock_retries do - drop_table :vulnerability_export_verification_status - end - end -end diff --git a/db/migrate/20200720154123_add_external_to_custom_emoji.rb b/db/migrate/20200720154123_add_external_to_custom_emoji.rb deleted file mode 100644 index 2a97235eec4..00000000000 --- a/db/migrate/20200720154123_add_external_to_custom_emoji.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddExternalToCustomEmoji < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :custom_emoji, :external, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20200720191134_add_blocking_issues_count_to_issues.rb b/db/migrate/20200720191134_add_blocking_issues_count_to_issues.rb deleted file mode 100644 index dbb43541ad6..00000000000 --- a/db/migrate/20200720191134_add_blocking_issues_count_to_issues.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -class AddBlockingIssuesCountToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_issue_on_project_id_state_id_and_blocking_issues_count' - - disable_ddl_transaction! - - def up - unless column_exists?(:issues, :blocking_issues_count) - with_lock_retries do - add_column :issues, :blocking_issues_count, :integer, default: 0, null: false - end - end - - add_concurrent_index :issues, [:project_id, :state_id, :blocking_issues_count], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :issues, INDEX_NAME - - with_lock_retries do - remove_column :issues, :blocking_issues_count - end - end -end diff --git a/db/migrate/20200721034536_add_issue_type_to_issues.rb b/db/migrate/20200721034536_add_issue_type_to_issues.rb deleted file mode 100644 index 96ae8c421da..00000000000 --- a/db/migrate/20200721034536_add_issue_type_to_issues.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddIssueTypeToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # Set default to issue type - add_column :issues, :issue_type, :integer, limit: 2, default: 0, null: false - end - end - - def down - with_lock_retries do - remove_column :issues, :issue_type - end - end -end diff --git a/db/migrate/20200721043502_add_issue_type_index_to_issues.rb b/db/migrate/20200721043502_add_issue_type_index_to_issues.rb deleted file mode 100644 index 2faad98d032..00000000000 --- a/db/migrate/20200721043502_add_issue_type_index_to_issues.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIssueTypeIndexToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - disable_ddl_transaction! - - INCIDENT_TYPE = 1 - INDEX_NAME = 'index_issues_on_incident_issue_type' - - def up - add_concurrent_index :issues, - :issue_type, where: "issue_type = #{INCIDENT_TYPE}", - name: INDEX_NAME - end - - def down - remove_concurrent_index :issues, :issue_type - end -end diff --git a/db/migrate/20200721052853_create_dast_scanner_profile.rb b/db/migrate/20200721052853_create_dast_scanner_profile.rb deleted file mode 100644 index 0dc0012d837..00000000000 --- a/db/migrate/20200721052853_create_dast_scanner_profile.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class CreateDastScannerProfile < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:dast_scanner_profiles) - with_lock_retries do - create_table :dast_scanner_profiles do |t| - t.timestamps_with_timezone null: false - t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }, type: :integer - t.integer :spider_timeout, limit: 2 - t.integer :target_timeout, limit: 2 - t.text :name, null: false - t.index [:project_id, :name], unique: true - end - end - end - - add_text_limit(:dast_scanner_profiles, :name, 255) - end - - def down - with_lock_retries do - drop_table :dast_scanner_profiles - end - end -end diff --git a/db/migrate/20200721230558_add_index_to_projects_aimed_for_deletion.rb b/db/migrate/20200721230558_add_index_to_projects_aimed_for_deletion.rb deleted file mode 100644 index 44dfe2ff3e1..00000000000 --- a/db/migrate/20200721230558_add_index_to_projects_aimed_for_deletion.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToProjectsAimedForDeletion < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - PROJECTS_AIMED_FOR_DELETION_INDEX_NAME = "index_projects_aimed_for_deletion" - MARKED_FOR_DELETION_PROJECTS_INDEX_NAME = "index_projects_on_marked_for_deletion_at" - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, - :marked_for_deletion_at, - where: "marked_for_deletion_at IS NOT NULL AND pending_delete = false", - name: PROJECTS_AIMED_FOR_DELETION_INDEX_NAME - - remove_concurrent_index_by_name :projects, MARKED_FOR_DELETION_PROJECTS_INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, PROJECTS_AIMED_FOR_DELETION_INDEX_NAME - - add_concurrent_index :projects, :marked_for_deletion_at, where: 'marked_for_deletion_at IS NOT NULL' - end -end diff --git a/db/migrate/20200722075411_add_ci_needs_size_limit_to_plan_limit.rb b/db/migrate/20200722075411_add_ci_needs_size_limit_to_plan_limit.rb deleted file mode 100644 index b615a09a61b..00000000000 --- a/db/migrate/20200722075411_add_ci_needs_size_limit_to_plan_limit.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddCiNeedsSizeLimitToPlanLimit < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :ci_needs_size_limit, :integer, default: 50, null: false - end -end diff --git a/db/migrate/20200722084623_add_default_membership_role_to_saml_provider.rb b/db/migrate/20200722084623_add_default_membership_role_to_saml_provider.rb deleted file mode 100644 index bd82aab1aae..00000000000 --- a/db/migrate/20200722084623_add_default_membership_role_to_saml_provider.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultMembershipRoleToSamlProvider < ActiveRecord::Migration[6.0] - DOWNTIME = false - - GUEST_USER_ROLE = 10 - - def change - add_column :saml_providers, :default_membership_role, :smallint, default: GUEST_USER_ROLE, null: false - end -end diff --git a/db/migrate/20200722091435_add_relative_position_to_design_management_designs.rb b/db/migrate/20200722091435_add_relative_position_to_design_management_designs.rb deleted file mode 100644 index 42b7a1d3898..00000000000 --- a/db/migrate/20200722091435_add_relative_position_to_design_management_designs.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddRelativePositionToDesignManagementDesigns < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :design_management_designs, :relative_position, :integer - end -end diff --git a/db/migrate/20200722131241_create_resource_iteration_events_table.rb b/db/migrate/20200722131241_create_resource_iteration_events_table.rb deleted file mode 100644 index 619faeaaadf..00000000000 --- a/db/migrate/20200722131241_create_resource_iteration_events_table.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateResourceIterationEventsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :resource_iteration_events do |t| - t.bigint :user_id, null: false, index: { name: 'index_resource_iteration_events_on_user_id' } - t.bigint :issue_id, null: true, index: { name: 'index_resource_iteration_events_on_issue_id' } - t.bigint :merge_request_id, null: true, index: { name: 'index_resource_iteration_events_on_merge_request_id' } - t.bigint :iteration_id, index: { name: 'index_resource_iteration_events_on_iteration_id' } - t.datetime_with_timezone :created_at, null: false - t.integer :action, limit: 2, null: false - end - end -end diff --git a/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb deleted file mode 100644 index c3d95c9dfc2..00000000000 --- a/db/migrate/20200722132040_add_users_fk_to_resource_iteration_events_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUsersFkToResourceIterationEventsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_iteration_events, :users, column: :user_id, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_iteration_events, column: :user_id - end - end -end diff --git a/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb deleted file mode 100644 index b603f14f62b..00000000000 --- a/db/migrate/20200722132540_add_issues_fk_to_resource_iteration_events_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIssuesFkToResourceIterationEventsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_iteration_events, :issues, column: :issue_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_iteration_events, column: :issue_id - end - end -end diff --git a/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb deleted file mode 100644 index e047b157a53..00000000000 --- a/db/migrate/20200722133040_add_merge_requests_fk_to_resource_iteration_events_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMergeRequestsFkToResourceIterationEventsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_iteration_events, :merge_requests, column: :merge_request_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_iteration_events, column: :merge_request_id - end - end -end diff --git a/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb b/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb deleted file mode 100644 index 1bb3ac7c8bd..00000000000 --- a/db/migrate/20200722133540_add_iterations_fk_to_resource_iteration_events_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIterationsFkToResourceIterationEventsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :resource_iteration_events, :sprints, column: :iteration_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :resource_iteration_events, column: :iteration_id - end - end -end diff --git a/db/migrate/20200723125205_add_target_project_id_to_mr_metrics.rb b/db/migrate/20200723125205_add_target_project_id_to_mr_metrics.rb deleted file mode 100644 index fb01b3fe046..00000000000 --- a/db/migrate/20200723125205_add_target_project_id_to_mr_metrics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTargetProjectIdToMrMetrics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :merge_request_metrics, :target_project_id, :integer - end - end - - def down - with_lock_retries do - remove_column :merge_request_metrics, :target_project_id, :integer - end - end -end diff --git a/db/migrate/20200723128332_add_fk_to_metrics_target_project_id.rb b/db/migrate/20200723128332_add_fk_to_metrics_target_project_id.rb deleted file mode 100644 index 6536b20b9c1..00000000000 --- a/db/migrate/20200723128332_add_fk_to_metrics_target_project_id.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddFkToMetricsTargetProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:merge_request_metrics, :target_project_id) - add_concurrent_foreign_key(:merge_request_metrics, :projects, column: :target_project_id, on_delete: :cascade) - end - - def down - remove_foreign_key(:merge_request_metrics, column: :target_project_id) - remove_concurrent_index(:merge_request_metrics, :target_project_id) - end -end diff --git a/db/migrate/20200724100123_add_index_on_vulnerability_historical_statistics_date.rb b/db/migrate/20200724100123_add_index_on_vulnerability_historical_statistics_date.rb deleted file mode 100644 index 696f98b40f6..00000000000 --- a/db/migrate/20200724100123_add_index_on_vulnerability_historical_statistics_date.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnVulnerabilityHistoricalStatisticsDate < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerability_historical_statistics, [:date, :id] - end - - def down - remove_concurrent_index :vulnerability_historical_statistics, [:date, :id] - end -end diff --git a/db/migrate/20200727082309_remove_index_chat_name_service_id.rb b/db/migrate/20200727082309_remove_index_chat_name_service_id.rb deleted file mode 100644 index 49cda2dd41f..00000000000 --- a/db/migrate/20200727082309_remove_index_chat_name_service_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexChatNameServiceId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :chat_names, :service_id - end - - def down - add_concurrent_index :chat_names, :service_id - end -end diff --git a/db/migrate/20200727142337_update_defaults_for_sca_artifacts.rb b/db/migrate/20200727142337_update_defaults_for_sca_artifacts.rb deleted file mode 100644 index d745943a7d3..00000000000 --- a/db/migrate/20200727142337_update_defaults_for_sca_artifacts.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class UpdateDefaultsForScaArtifacts < ActiveRecord::Migration[6.0] - DOWNTIME = false - - DEPENDENCY_SCANNING_LIMIT_MB = 350 - CONTAINER_SCANNING_LIMIT_MB = 150 - LICENSE_SCANNING_LIMIT_MB = 100 - - def up - change_column_default :plan_limits, :ci_max_artifact_size_dependency_scanning, DEPENDENCY_SCANNING_LIMIT_MB - change_column_default :plan_limits, :ci_max_artifact_size_container_scanning, CONTAINER_SCANNING_LIMIT_MB - change_column_default :plan_limits, :ci_max_artifact_size_license_scanning, LICENSE_SCANNING_LIMIT_MB - end - - def down - change_column_default :plan_limits, :ci_max_artifact_size_dependency_scanning, 0 - change_column_default :plan_limits, :ci_max_artifact_size_container_scanning, 0 - change_column_default :plan_limits, :ci_max_artifact_size_license_scanning, 0 - end -end diff --git a/db/migrate/20200728080250_replace_unique_index_on_cycle_analytics_stages.rb b/db/migrate/20200728080250_replace_unique_index_on_cycle_analytics_stages.rb deleted file mode 100644 index 0e562ae27e2..00000000000 --- a/db/migrate/20200728080250_replace_unique_index_on_cycle_analytics_stages.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -class ReplaceUniqueIndexOnCycleAnalyticsStages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - OLD_INDEX_NAME = 'index_analytics_ca_group_stages_on_group_id_and_name' - NEW_INDEX_NAME = 'index_group_stages_on_group_id_group_value_stream_id_and_name' - - disable_ddl_transaction! - - def up - add_concurrent_index(:analytics_cycle_analytics_group_stages, - [:group_id, :group_value_stream_id, :name], - unique: true, - name: NEW_INDEX_NAME) - - remove_concurrent_index_by_name :analytics_cycle_analytics_group_stages, OLD_INDEX_NAME - end - - def down - # Removing duplicated records (group_id, name) that would prevent re-creating the old index. - execute <<-SQL - DELETE FROM analytics_cycle_analytics_group_stages - USING ( - SELECT group_id, name, MIN(id) as min_id - FROM analytics_cycle_analytics_group_stages - GROUP BY group_id, name - HAVING COUNT(id) > 1 - ) as analytics_cycle_analytics_group_stages_name_duplicates - WHERE analytics_cycle_analytics_group_stages_name_duplicates.group_id = analytics_cycle_analytics_group_stages.group_id - AND analytics_cycle_analytics_group_stages_name_duplicates.name = analytics_cycle_analytics_group_stages.name - AND analytics_cycle_analytics_group_stages_name_duplicates.min_id <> analytics_cycle_analytics_group_stages.id - SQL - - add_concurrent_index(:analytics_cycle_analytics_group_stages, - [:group_id, :name], - unique: true, - name: OLD_INDEX_NAME) - - remove_concurrent_index_by_name :analytics_cycle_analytics_group_stages, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20200728163009_add_deployment_events_to_web_hooks.rb b/db/migrate/20200728163009_add_deployment_events_to_web_hooks.rb deleted file mode 100644 index b1bf9560bcc..00000000000 --- a/db/migrate/20200728163009_add_deployment_events_to_web_hooks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDeploymentEventsToWebHooks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :web_hooks, :deployment_events, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20200728174137_add_index_on_design_management_designs_issue_id_and_relative_position_and_id.rb b/db/migrate/20200728174137_add_index_on_design_management_designs_issue_id_and_relative_position_and_id.rb deleted file mode 100644 index 140c344e837..00000000000 --- a/db/migrate/20200728174137_add_index_on_design_management_designs_issue_id_and_relative_position_and_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnDesignManagementDesignsIssueIdAndRelativePositionAndId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_design_management_designs_issue_id_relative_position_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :design_management_designs, [:issue_id, :relative_position, :id], name: INDEX_NAME - end - - def down - remove_concurrent_index :design_management_designs, [:issue_id, :relative_position, :id], name: INDEX_NAME - end -end diff --git a/db/migrate/20200728175710_add_enforce_namespace_storage_limit_to_application_settings.rb b/db/migrate/20200728175710_add_enforce_namespace_storage_limit_to_application_settings.rb deleted file mode 100644 index adbc86ec621..00000000000 --- a/db/migrate/20200728175710_add_enforce_namespace_storage_limit_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddEnforceNamespaceStorageLimitToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :enforce_namespace_storage_limit, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200728182311_add_o_auth_paths_to_protected_paths.rb b/db/migrate/20200728182311_add_o_auth_paths_to_protected_paths.rb deleted file mode 100644 index 7a5af0135fa..00000000000 --- a/db/migrate/20200728182311_add_o_auth_paths_to_protected_paths.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -class AddOAuthPathsToProtectedPaths < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - ADD_PROTECTED_PATHS = [ - '/oauth/authorize', - '/oauth/token' - ].freeze - - EXISTING_DEFAULT_PROTECTED_PATHS = [ - '/users/password', - '/users/sign_in', - '/api/v3/session.json', - '/api/v3/session', - '/api/v4/session.json', - '/api/v4/session', - '/users', - '/users/confirmation', - '/unsubscribes/', - '/import/github/personal_access_token', - '/admin/session' - ].freeze - - NEW_DEFAULT_PROTECTED_PATHS = (EXISTING_DEFAULT_PROTECTED_PATHS + ADD_PROTECTED_PATHS).freeze - - class ApplicationSetting < ActiveRecord::Base - self.table_name = 'application_settings' - end - - def up - change_column_default :application_settings, :protected_paths, NEW_DEFAULT_PROTECTED_PATHS - - ApplicationSetting.reset_column_information - - ApplicationSetting.where.not(protected_paths: nil).each do |application_setting| - missing_paths = ADD_PROTECTED_PATHS - application_setting.protected_paths - - next if missing_paths.empty? - - updated_protected_paths = application_setting.protected_paths + missing_paths - application_setting.update!(protected_paths: updated_protected_paths) - end - end - - def down - change_column_default :application_settings, :protected_paths, EXISTING_DEFAULT_PROTECTED_PATHS - - ApplicationSetting.reset_column_information - - ApplicationSetting.where.not(protected_paths: nil).each do |application_setting| - paths_to_remove = application_setting.protected_paths - EXISTING_DEFAULT_PROTECTED_PATHS - - next if paths_to_remove.empty? - - updated_protected_paths = application_setting.protected_paths - paths_to_remove - application_setting.update!(protected_paths: updated_protected_paths) - end - end -end diff --git a/db/migrate/20200729151021_add_after_expiry_notification_delivered_to_personal_access_tokens.rb b/db/migrate/20200729151021_add_after_expiry_notification_delivered_to_personal_access_tokens.rb deleted file mode 100644 index 001436b7285..00000000000 --- a/db/migrate/20200729151021_add_after_expiry_notification_delivered_to_personal_access_tokens.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddAfterExpiryNotificationDeliveredToPersonalAccessTokens < ActiveRecord::Migration[6.0] - DOWNTIME = false - - disable_ddl_transaction! - - def change - add_column :personal_access_tokens, :after_expiry_notification_delivered, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20200729175935_add_dashboard_path_to_prometheus_metrics.rb b/db/migrate/20200729175935_add_dashboard_path_to_prometheus_metrics.rb deleted file mode 100644 index 0562e8d1c14..00000000000 --- a/db/migrate/20200729175935_add_dashboard_path_to_prometheus_metrics.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class AddDashboardPathToPrometheusMetrics < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # Text limit is added in 20200730210506_add_text_limit_to_dashboard_path - add_column :prometheus_metrics, :dashboard_path, :text # rubocop:disable Migration/AddLimitToTextColumns - end - - def down - remove_column :prometheus_metrics, :dashboard_path - end -end diff --git a/db/migrate/20200729180539_add_can_push_to_group_deploy_keys_groups.rb b/db/migrate/20200729180539_add_can_push_to_group_deploy_keys_groups.rb deleted file mode 100644 index 3412790c20c..00000000000 --- a/db/migrate/20200729180539_add_can_push_to_group_deploy_keys_groups.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddCanPushToGroupDeployKeysGroups < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :group_deploy_keys_groups, :can_push, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200729181641_add_index_to_resource_milestone_events_add_events.rb b/db/migrate/20200729181641_add_index_to_resource_milestone_events_add_events.rb deleted file mode 100644 index 438f9c6bfa3..00000000000 --- a/db/migrate/20200729181641_add_index_to_resource_milestone_events_add_events.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToResourceMilestoneEventsAddEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_resource_milestone_events_on_milestone_id_and_add_action' - ADD_ACTION = '1' - - def up - # Index add milestone events - add_concurrent_index :resource_milestone_events, :milestone_id, where: "action = #{ADD_ACTION}", name: INDEX_NAME - end - - def down - remove_concurrent_index :resource_milestone_events, :milestone_id, name: INDEX_NAME - end -end diff --git a/db/migrate/20200729191227_add_runbook_to_prometheus_alert.rb b/db/migrate/20200729191227_add_runbook_to_prometheus_alert.rb deleted file mode 100644 index a45b6eab1ee..00000000000 --- a/db/migrate/20200729191227_add_runbook_to_prometheus_alert.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class AddRunbookToPrometheusAlert < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # limit is added in 20200501000002_add_text_limit_to_sprints_extended_title - add_column :prometheus_alerts, :runbook_url, :text # rubocop:disable Migration/AddLimitToTextColumns - end - - def down - remove_column :prometheus_alerts, :runbook_url - end -end diff --git a/db/migrate/20200729200808_add_text_limit_to_runbook_on_prometheus_alerts.rb b/db/migrate/20200729200808_add_text_limit_to_runbook_on_prometheus_alerts.rb deleted file mode 100644 index 010b53ab35e..00000000000 --- a/db/migrate/20200729200808_add_text_limit_to_runbook_on_prometheus_alerts.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToRunbookOnPrometheusAlerts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :prometheus_alerts, :runbook_url, 255 - end - - def down - remove_text_limit :prometheus_alerts, :runbook_url - end -end diff --git a/db/migrate/20200729202222_add_index_to_ci_pipeline_project_id_created_at.rb b/db/migrate/20200729202222_add_index_to_ci_pipeline_project_id_created_at.rb deleted file mode 100644 index d1ee9c49d30..00000000000 --- a/db/migrate/20200729202222_add_index_to_ci_pipeline_project_id_created_at.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToCiPipelineProjectIdCreatedAt < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_pipelines, [:project_id, :created_at] - end - - def down - remove_concurrent_index :ci_pipelines, [:project_id, :created_at] - end -end diff --git a/db/migrate/20200730044810_add_indexes_to_resource_label_events_to_support_vsa.rb b/db/migrate/20200730044810_add_indexes_to_resource_label_events_to_support_vsa.rb deleted file mode 100644 index ba114e81618..00000000000 --- a/db/migrate/20200730044810_add_indexes_to_resource_label_events_to_support_vsa.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesToResourceLabelEventsToSupportVsa < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - NEW_INDEX_NAME_ON_ISSUE_ID = 'index_resource_label_events_issue_id_label_id_action' - OLD_INDEX_NAME_ON_ISSUE_ID = 'index_resource_label_events_on_issue_id' - - NEW_INDEX_NAME_ON_MERGE_REQUEST_ID = 'index_resource_label_events_on_merge_request_id_label_id_action' - OLD_INDEX_NAME_ON_MERGE_REQUEST_ID = 'index_resource_label_events_on_merge_request_id' - - def up - add_concurrent_index :resource_label_events, [:issue_id, :label_id, :action], name: NEW_INDEX_NAME_ON_ISSUE_ID - remove_concurrent_index_by_name :resource_label_events, OLD_INDEX_NAME_ON_ISSUE_ID - - add_concurrent_index :resource_label_events, [:merge_request_id, :label_id, :action], name: NEW_INDEX_NAME_ON_MERGE_REQUEST_ID - remove_concurrent_index_by_name :resource_label_events, OLD_INDEX_NAME_ON_MERGE_REQUEST_ID - end - - def down - add_concurrent_index :resource_label_events, :issue_id, name: OLD_INDEX_NAME_ON_ISSUE_ID - remove_concurrent_index_by_name(:resource_label_events, NEW_INDEX_NAME_ON_ISSUE_ID) - - add_concurrent_index :resource_label_events, :merge_request_id, name: OLD_INDEX_NAME_ON_MERGE_REQUEST_ID - remove_concurrent_index_by_name(:resource_label_events, NEW_INDEX_NAME_ON_MERGE_REQUEST_ID) - end -end diff --git a/db/migrate/20200730083043_replace_index_for_service_usage_data.rb b/db/migrate/20200730083043_replace_index_for_service_usage_data.rb deleted file mode 100644 index 0d3012c319d..00000000000 --- a/db/migrate/20200730083043_replace_index_for_service_usage_data.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class ReplaceIndexForServiceUsageData < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - OLD_INDEX_NAME = 'index_services_on_type_and_id_and_template_when_active' - NEW_INDEX_NAME = 'index_services_on_type_id_when_active_not_instance_not_template' - - disable_ddl_transaction! - - def up - add_concurrent_index :services, [:type, :id], where: 'active = TRUE AND instance = FALSE AND template = FALSE', name: NEW_INDEX_NAME - - remove_concurrent_index_by_name :services, OLD_INDEX_NAME - end - - def down - add_concurrent_index :services, [:type, :id, :template], where: 'active = TRUE', name: OLD_INDEX_NAME - - remove_concurrent_index :services, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20200730131946_add_hide_lists_to_boards.rb b/db/migrate/20200730131946_add_hide_lists_to_boards.rb deleted file mode 100644 index e431ea852a7..00000000000 --- a/db/migrate/20200730131946_add_hide_lists_to_boards.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddHideListsToBoards < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :boards, :hide_backlog_list, :boolean, default: false, null: false - add_column :boards, :hide_closed_list, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200730210506_add_text_limit_to_dashboard_path.rb b/db/migrate/20200730210506_add_text_limit_to_dashboard_path.rb deleted file mode 100644 index a236cc68988..00000000000 --- a/db/migrate/20200730210506_add_text_limit_to_dashboard_path.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToDashboardPath < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit(:prometheus_metrics, :dashboard_path, 2048) - end - - def down - remove_text_limit(:prometheus_metrics, :dashboard_path) - end -end diff --git a/db/migrate/20200731085019_create_experiment.rb b/db/migrate/20200731085019_create_experiment.rb deleted file mode 100644 index cd326e0958f..00000000000 --- a/db/migrate/20200731085019_create_experiment.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateExperiment < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:experiments) - create_table :experiments do |t| - t.text :name, null: false - - t.index :name, unique: true - end - end - - add_text_limit :experiments, :name, 255 - end - - def down - drop_table :experiments - end -end diff --git a/db/migrate/20200731090553_create_experiment_user.rb b/db/migrate/20200731090553_create_experiment_user.rb deleted file mode 100644 index 9080429dfd3..00000000000 --- a/db/migrate/20200731090553_create_experiment_user.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CreateExperimentUser < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - create_table :experiment_users do |t| - t.bigint :experiment_id, null: false - t.bigint :user_id, null: false - t.integer :group_type, limit: 2, null: false, default: 0 - t.timestamps_with_timezone null: false - end - - add_index :experiment_users, :experiment_id - add_index :experiment_users, :user_id - end - - def down - drop_table :experiment_users - end -end diff --git a/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb b/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb deleted file mode 100644 index c1a6dae242b..00000000000 --- a/db/migrate/20200731201408_add_foreign_key_to_experiment_on_experiment_users.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToExperimentOnExperimentUsers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # There is no need to use add_concurrent_foreign_key since it's an empty table - add_foreign_key :experiment_users, :experiments, column: :experiment_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :experiment_users, column: :experiment_id - end - end -end diff --git a/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb b/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb deleted file mode 100644 index 673a0bde0b1..00000000000 --- a/db/migrate/20200731201834_add_foreign_key_to_user_on_experiment_users.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToUserOnExperimentUsers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - # There is no need to use add_concurrent_foreign_key since it's an empty table - add_foreign_key :experiment_users, :users, column: :user_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :experiment_users, column: :user_id - end - end -end diff --git a/db/migrate/20200803111512_add_group_id_to_services.rb b/db/migrate/20200803111512_add_group_id_to_services.rb deleted file mode 100644 index 7d4a0ef4dd5..00000000000 --- a/db/migrate/20200803111512_add_group_id_to_services.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddGroupIdToServices < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :services, :group_id, :bigint - end -end diff --git a/db/migrate/20200803112806_add_index_group_id_to_services.rb b/db/migrate/20200803112806_add_index_group_id_to_services.rb deleted file mode 100644 index 145009672ef..00000000000 --- a/db/migrate/20200803112806_add_index_group_id_to_services.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddIndexGroupIdToServices < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_services_on_unique_group_id_and_type' - - disable_ddl_transaction! - - def up - add_concurrent_index :services, [:group_id, :type], unique: true, name: INDEX_NAME - - add_concurrent_foreign_key :services, :namespaces, column: :group_id - end - - def down - remove_foreign_key_if_exists :services, column: :group_id - - remove_concurrent_index_by_name :services, INDEX_NAME - end -end diff --git a/db/migrate/20200803125340_create_raw_usage_data.rb b/db/migrate/20200803125340_create_raw_usage_data.rb deleted file mode 100644 index f1c23a7b0f5..00000000000 --- a/db/migrate/20200803125340_create_raw_usage_data.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CreateRawUsageData < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - unless table_exists?(:raw_usage_data) - create_table :raw_usage_data do |t| - t.timestamps_with_timezone - t.datetime_with_timezone :recorded_at, null: false - t.datetime_with_timezone :sent_at - t.jsonb :payload, null: false - - t.index [:recorded_at], unique: true - end - end - end - - def down - drop_table :raw_usage_data - end -end diff --git a/db/migrate/20200804041018_add_default_value_for_external_diff_store_to_merge_request_diffs.rb b/db/migrate/20200804041018_add_default_value_for_external_diff_store_to_merge_request_diffs.rb deleted file mode 100644 index 1a565fef125..00000000000 --- a/db/migrate/20200804041018_add_default_value_for_external_diff_store_to_merge_request_diffs.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultValueForExternalDiffStoreToMergeRequestDiffs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :merge_request_diffs, :external_diff_store, 1 - end - end - - def down - with_lock_retries do - change_column_default :merge_request_diffs, :external_diff_store, nil - end - end -end diff --git a/db/migrate/20200804222543_add_resolved_on_default_branch_into_vulnerabilities_table.rb b/db/migrate/20200804222543_add_resolved_on_default_branch_into_vulnerabilities_table.rb deleted file mode 100644 index afb97871575..00000000000 --- a/db/migrate/20200804222543_add_resolved_on_default_branch_into_vulnerabilities_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddResolvedOnDefaultBranchIntoVulnerabilitiesTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_table :vulnerabilities do |t| - t.boolean :resolved_on_default_branch, default: false, null: false - end - end -end diff --git a/db/migrate/20200805071842_add_index_on_end_date_and_namespace_id_to_gitlab_subscriptions.rb b/db/migrate/20200805071842_add_index_on_end_date_and_namespace_id_to_gitlab_subscriptions.rb deleted file mode 100644 index 266b0a50318..00000000000 --- a/db/migrate/20200805071842_add_index_on_end_date_and_namespace_id_to_gitlab_subscriptions.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnEndDateAndNamespaceIdToGitlabSubscriptions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :gitlab_subscriptions, [:end_date, :namespace_id] - end - - def down - remove_concurrent_index :gitlab_subscriptions, [:end_date, :namespace_id], - name: 'index_gitlab_subscriptions_on_end_date_and_namespace_id' - end -end diff --git a/db/migrate/20200805150316_create_ci_pipeline_artifact.rb b/db/migrate/20200805150316_create_ci_pipeline_artifact.rb deleted file mode 100644 index 01995972011..00000000000 --- a/db/migrate/20200805150316_create_ci_pipeline_artifact.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class CreateCiPipelineArtifact < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:ci_pipeline_artifacts) - create_table :ci_pipeline_artifacts do |t| - t.timestamps_with_timezone - t.bigint :pipeline_id, null: false, index: true - t.bigint :project_id, null: false, index: true - t.integer :size, null: false - t.integer :file_store, null: false, limit: 2 - t.integer :file_type, null: false, limit: 2 - t.integer :file_format, null: false, limit: 2 - t.text :file - - t.index [:pipeline_id, :file_type], unique: true - end - end - - add_text_limit :ci_pipeline_artifacts, :file, 255 - end - - def down - drop_table :ci_pipeline_artifacts - end -end diff --git a/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb b/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb deleted file mode 100644 index 5cfe0496b8d..00000000000 --- a/db/migrate/20200805151001_add_foreign_key_to_pipeline_id_on_pipeline_artifact.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToPipelineIdOnPipelineArtifact < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :ci_pipeline_artifacts, :ci_pipelines, column: :pipeline_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :ci_pipeline_artifacts, column: :pipeline_id - end - end -end diff --git a/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb b/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb deleted file mode 100644 index fe418f4c5af..00000000000 --- a/db/migrate/20200805151726_add_foreign_key_to_project_id_on_pipeline_artifact.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToProjectIdOnPipelineArtifact < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :ci_pipeline_artifacts, :projects, column: :project_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :ci_pipeline_artifacts, column: :project_id - end - end -end diff --git a/db/migrate/20200806004232_add_default_value_for_file_store_to_package_files.rb b/db/migrate/20200806004232_add_default_value_for_file_store_to_package_files.rb deleted file mode 100644 index 06f033891fc..00000000000 --- a/db/migrate/20200806004232_add_default_value_for_file_store_to_package_files.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultValueForFileStoreToPackageFiles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :packages_package_files, :file_store, 1 - end - end - - def down - with_lock_retries do - change_column_default :packages_package_files, :file_store, nil - end - end -end diff --git a/db/migrate/20200807070820_add_index_for_compliance_merged_merge_request_to_events.rb b/db/migrate/20200807070820_add_index_for_compliance_merged_merge_request_to_events.rb deleted file mode 100644 index 4650437056e..00000000000 --- a/db/migrate/20200807070820_add_index_for_compliance_merged_merge_request_to_events.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddIndexForComplianceMergedMergeRequestToEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_events_on_project_id_and_id_desc_on_merged_action' - - disable_ddl_transaction! - - def up - add_concurrent_index :events, [:project_id, :id], - order: { id: :desc }, - where: "action = 7", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :events, INDEX_NAME - end -end diff --git a/db/migrate/20200807132726_add_delete_original_index_at_to_reindexing_tasks.rb b/db/migrate/20200807132726_add_delete_original_index_at_to_reindexing_tasks.rb deleted file mode 100644 index 435b2a45e85..00000000000 --- a/db/migrate/20200807132726_add_delete_original_index_at_to_reindexing_tasks.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDeleteOriginalIndexAtToReindexingTasks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :elastic_reindexing_tasks, :delete_original_index_at, :datetime_with_timezone - end - end - - def down - with_lock_retries do - remove_column :elastic_reindexing_tasks, :delete_original_index_at - end - end -end diff --git a/db/migrate/20200807150937_add_file_count_to_merge_request_diffs.rb b/db/migrate/20200807150937_add_file_count_to_merge_request_diffs.rb deleted file mode 100644 index 3afc246d698..00000000000 --- a/db/migrate/20200807150937_add_file_count_to_merge_request_diffs.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddFileCountToMergeRequestDiffs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - add_column :merge_request_diffs, :files_count, :smallint - end - end - - def down - with_lock_retries do - remove_column :merge_request_diffs, :files_count, :smallint - end - end -end diff --git a/db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb b/db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb deleted file mode 100644 index 1aaa0f36f16..00000000000 --- a/db/migrate/20200810152043_add_expire_at_to_ci_pipeline_artifact.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddExpireAtToCiPipelineArtifact < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :ci_pipeline_artifacts, :expire_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20200811055018_remove_not_null_constraint_on_type_from_audit_events.rb b/db/migrate/20200811055018_remove_not_null_constraint_on_type_from_audit_events.rb deleted file mode 100644 index 25c3ef71655..00000000000 --- a/db/migrate/20200811055018_remove_not_null_constraint_on_type_from_audit_events.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullConstraintOnTypeFromAuditEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - # To avoid deadlock on audit_event and audit_event_part... since there is a trigger to insert record from audit_events - # to audit_events_part..., we need to ensure each ALTER TABLE command run in its own transaction. - def up - with_lock_retries do - change_column_null :audit_events_part_5fc467ac26, :type, true - end - - with_lock_retries do - change_column_null :audit_events, :type, true - end - end - - def down - # no-op -- null values might be added after this constraint is removed. - end -end diff --git a/db/migrate/20200811154630_add_gitpod_application_settings.rb b/db/migrate/20200811154630_add_gitpod_application_settings.rb deleted file mode 100644 index e4211d25d0b..00000000000 --- a/db/migrate/20200811154630_add_gitpod_application_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddGitpodApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20200727154631_add_gitpod_application_settings_text_limit - def change - add_column :application_settings, :gitpod_enabled, :boolean, default: false, null: false - add_column :application_settings, :gitpod_url, :text, default: 'https://gitpod.io/', null: true - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200811154631_add_gitpod_application_settings_text_limit.rb b/db/migrate/20200811154631_add_gitpod_application_settings_text_limit.rb deleted file mode 100644 index 1f43b5d88d5..00000000000 --- a/db/migrate/20200811154631_add_gitpod_application_settings_text_limit.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddGitpodApplicationSettingsTextLimit < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :gitpod_url, 255 - end - - def down - remove_text_limit :application_settings, :gitpod_url - end -end diff --git a/db/migrate/20200811154632_add_gitpod_user_preferences.rb b/db/migrate/20200811154632_add_gitpod_user_preferences.rb deleted file mode 100644 index 0392c80d39c..00000000000 --- a/db/migrate/20200811154632_add_gitpod_user_preferences.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddGitpodUserPreferences < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :user_preferences, :gitpod_enabled, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200811194848_add_default_value_for_file_store_to_pipeline_artifact.rb b/db/migrate/20200811194848_add_default_value_for_file_store_to_pipeline_artifact.rb deleted file mode 100644 index f689a505809..00000000000 --- a/db/migrate/20200811194848_add_default_value_for_file_store_to_pipeline_artifact.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultValueForFileStoreToPipelineArtifact < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - PIPELINE_ARTIFACT_LOCAL_FILE_STORE = 1 - - def up - with_lock_retries do - change_column_default :ci_pipeline_artifacts, :file_store, PIPELINE_ARTIFACT_LOCAL_FILE_STORE - end - end - - def down - with_lock_retries do - change_column_default :ci_pipeline_artifacts, :file_store, nil - end - end -end diff --git a/db/migrate/20200812112204_add_index_to_mr_metrics_target_project_id.rb b/db/migrate/20200812112204_add_index_to_mr_metrics_target_project_id.rb deleted file mode 100644 index da483e7222c..00000000000 --- a/db/migrate/20200812112204_add_index_to_mr_metrics_target_project_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToMrMetricsTargetProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_merge_request_metrics_on_target_project_id_merged_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) - end -end diff --git a/db/migrate/20200812150810_add_verification_state_to_snippet_repository.rb b/db/migrate/20200812150810_add_verification_state_to_snippet_repository.rb deleted file mode 100644 index 3fdf0b4adf4..00000000000 --- a/db/migrate/20200812150810_add_verification_state_to_snippet_repository.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationStateToSnippetRepository < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_table(:snippet_repositories) do |t| - t.integer :verification_retry_count, limit: 2 - t.column :verification_retry_at, :datetime_with_timezone - t.column :verified_at, :datetime_with_timezone - t.binary :verification_checksum, using: 'verification_checksum::bytea' - - # rubocop:disable Migration/AddLimitToTextColumns - t.text :verification_failure - # rubocop:enable Migration/AddLimitToTextColumns - end - end -end diff --git a/db/migrate/20200812150811_add_verification_failure_to_snippet_repository.rb b/db/migrate/20200812150811_add_verification_failure_to_snippet_repository.rb deleted file mode 100644 index 64cd094acf0..00000000000 --- a/db/migrate/20200812150811_add_verification_failure_to_snippet_repository.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationFailureToSnippetRepository < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'snippet_repositories_verification_failure_text_limit' - - def up - add_text_limit :snippet_repositories, :verification_failure, 255, constraint_name: CONSTRAINT_NAME - end - - def down - remove_check_constraint(:snippet_repositories, CONSTRAINT_NAME) - end -end diff --git a/db/migrate/20200812150812_add_verification_failure_index_to_snippet_repository.rb b/db/migrate/20200812150812_add_verification_failure_index_to_snippet_repository.rb deleted file mode 100644 index 3c1d2dc988d..00000000000 --- a/db/migrate/20200812150812_add_verification_failure_index_to_snippet_repository.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationFailureIndexToSnippetRepository < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :snippet_repositories, :verification_failure, where: "(verification_failure IS NOT NULL)", name: 'snippet_repositories_verification_failure_partial' - add_concurrent_index :snippet_repositories, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: 'snippet_repositories_verification_checksum_partial' - end - - def down - remove_concurrent_index_by_name :snippet_repositories, 'snippet_repositories_verification_failure_partial' - remove_concurrent_index_by_name :snippet_repositories, 'snippet_repositories_verification_checksum_partial' - end -end diff --git a/db/migrate/20200813135558_create_ci_deleted_objects.rb b/db/migrate/20200813135558_create_ci_deleted_objects.rb deleted file mode 100644 index 5364b7fc0ce..00000000000 --- a/db/migrate/20200813135558_create_ci_deleted_objects.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class CreateCiDeletedObjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :ci_deleted_objects, if_not_exists: true do |t| - t.integer :file_store, limit: 2, default: 1, null: false - t.datetime_with_timezone :pick_up_at, null: false, default: -> { 'now()' }, index: true - t.text :store_dir, null: false - - # rubocop:disable Migration/AddLimitToTextColumns - # This column depends on the `file` column from `ci_job_artifacts` table - # which doesn't have a constraint limit on it. - t.text :file, null: false - # rubocop:enable Migration/AddLimitToTextColumns - end - - add_text_limit(:ci_deleted_objects, :store_dir, 1024) - end - - def down - drop_table :ci_deleted_objects - end -end diff --git a/db/migrate/20200813143304_add_new_external_diff_migration_index.rb b/db/migrate/20200813143304_add_new_external_diff_migration_index.rb deleted file mode 100644 index 64611e4f50a..00000000000 --- a/db/migrate/20200813143304_add_new_external_diff_migration_index.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddNewExternalDiffMigrationIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_merge_request_diffs_by_id_partial' - - disable_ddl_transaction! - - def up - add_concurrent_index( - :merge_request_diffs, - :id, - name: INDEX_NAME, - where: 'files_count > 0 AND ((NOT stored_externally) OR (stored_externally IS NULL))' - ) - end - - def down - remove_concurrent_index_by_name(:merge_request_diffs, INDEX_NAME) - end -end diff --git a/db/migrate/20200813143356_remove_old_external_diff_migration_index.rb b/db/migrate/20200813143356_remove_old_external_diff_migration_index.rb deleted file mode 100644 index a3730247f10..00000000000 --- a/db/migrate/20200813143356_remove_old_external_diff_migration_index.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class RemoveOldExternalDiffMigrationIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name( - :merge_request_diffs, - 'index_merge_request_diffs_on_merge_request_id_and_id_partial' - ) - end - - def down - add_concurrent_index( - :merge_request_diffs, - [:merge_request_id, :id], - where: 'NOT stored_externally OR stored_externally IS NULL', - name: 'index_merge_request_diffs_on_merge_request_id_and_id_partial' - ) - end -end diff --git a/db/migrate/20200816133024_add_cve_id_request_project_setting.rb b/db/migrate/20200816133024_add_cve_id_request_project_setting.rb deleted file mode 100644 index c4fe86845eb..00000000000 --- a/db/migrate/20200816133024_add_cve_id_request_project_setting.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddCveIdRequestProjectSetting < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :project_settings, :cve_id_request_enabled, :boolean, default: true, null: false - end - - def down - remove_column :project_settings, :cve_id_request_enabled - end -end diff --git a/db/migrate/20200817142800_add_pipeline_artifacts_size_to_project_statistics.rb b/db/migrate/20200817142800_add_pipeline_artifacts_size_to_project_statistics.rb deleted file mode 100644 index a15d94a41b7..00000000000 --- a/db/migrate/20200817142800_add_pipeline_artifacts_size_to_project_statistics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPipelineArtifactsSizeToProjectStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_statistics, :pipeline_artifacts_size, :bigint, default: 0, null: false - end - end - - def down - with_lock_retries do - remove_column :project_statistics, :pipeline_artifacts_size, :bigint, default: 0, null: false - end - end -end diff --git a/db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb b/db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb deleted file mode 100644 index 71a29ae9bc5..00000000000 --- a/db/migrate/20200817195628_add_modified_to_approval_merge_request_rule.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddModifiedToApprovalMergeRequestRule < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :approval_merge_request_rules, :modified_from_project_rule, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200818052219_add_kubernetes_version_to_cluster_providers_aws.rb b/db/migrate/20200818052219_add_kubernetes_version_to_cluster_providers_aws.rb deleted file mode 100644 index fa3d5210e91..00000000000 --- a/db/migrate/20200818052219_add_kubernetes_version_to_cluster_providers_aws.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddKubernetesVersionToClusterProvidersAws < ActiveRecord::Migration[6.0] - # Uncomment the following include if you require helper functions: - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:cluster_providers_aws, :kubernetes_version) - add_column :cluster_providers_aws, :kubernetes_version, :text, null: false, default: '1.14' - end - - add_text_limit :cluster_providers_aws, :kubernetes_version, 30 - end - - def down - if column_exists?(:cluster_providers_aws, :kubernetes_version) - remove_column :cluster_providers_aws, :kubernetes_version - end - end -end diff --git a/db/migrate/20200818092401_add_checksum_to_build_chunk.rb b/db/migrate/20200818092401_add_checksum_to_build_chunk.rb deleted file mode 100644 index c1c968571a2..00000000000 --- a/db/migrate/20200818092401_add_checksum_to_build_chunk.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddChecksumToBuildChunk < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :ci_build_trace_chunks, :checksum, :binary - end -end diff --git a/db/migrate/20200818171229_add_package_max_file_size_to_plan_limits.rb b/db/migrate/20200818171229_add_package_max_file_size_to_plan_limits.rb deleted file mode 100644 index 5343da6ed5e..00000000000 --- a/db/migrate/20200818171229_add_package_max_file_size_to_plan_limits.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddPackageMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :conan_max_file_size, :bigint, default: 50.megabytes, null: false) - add_column(:plan_limits, :maven_max_file_size, :bigint, default: 50.megabytes, null: false) - add_column(:plan_limits, :npm_max_file_size, :bigint, default: 50.megabytes, null: false) - add_column(:plan_limits, :nuget_max_file_size, :bigint, default: 50.megabytes, null: false) - add_column(:plan_limits, :pypi_max_file_size, :bigint, default: 50.megabytes, null: false) - end -end diff --git a/db/migrate/20200819192143_add_emails_user_id_foreign_key.rb b/db/migrate/20200819192143_add_emails_user_id_foreign_key.rb deleted file mode 100644 index 7f00aa6341b..00000000000 --- a/db/migrate/20200819192143_add_emails_user_id_foreign_key.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddEmailsUserIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CONSTRAINT_NAME = 'fk_emails_user_id' - - def up - with_lock_retries do - add_foreign_key :emails, :users, on_delete: :cascade, validate: false, name: CONSTRAINT_NAME - end - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :emails, column: :user_id, name: CONSTRAINT_NAME - end - end -end diff --git a/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb b/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb deleted file mode 100644 index dd474b57602..00000000000 --- a/db/migrate/20200820105408_add_index_to_container_scanning_findings.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToContainerScanningFindings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'idx_container_scanning_findings' - - disable_ddl_transaction! - - def up - add_concurrent_index(:vulnerability_occurrences, :id, - where: "report_type = 2", - name: INDEX_NAME) - end - - def down - remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME) - end -end diff --git a/db/migrate/20200820130839_add_auto_close_incident_to_project_incident_management_settings.rb b/db/migrate/20200820130839_add_auto_close_incident_to_project_incident_management_settings.rb deleted file mode 100644 index 01aafa6d988..00000000000 --- a/db/migrate/20200820130839_add_auto_close_incident_to_project_incident_management_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddAutoCloseIncidentToProjectIncidentManagementSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :project_incident_management_settings, :auto_close_incident, :boolean, default: true, null: false - end - - def down - remove_column :project_incident_management_settings, :auto_close_incident - end -end diff --git a/db/migrate/20200820204041_create_ci_platform_metrics.rb b/db/migrate/20200820204041_create_ci_platform_metrics.rb deleted file mode 100644 index 27a5a3dc8eb..00000000000 --- a/db/migrate/20200820204041_create_ci_platform_metrics.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateCiPlatformMetrics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CI_VARIABLES_KEY_INDEX_NAME = "index_ci_variables_on_key" - - disable_ddl_transaction! - - def up - unless table_exists?(:ci_platform_metrics) - create_table :ci_platform_metrics do |t| - t.datetime_with_timezone :recorded_at, null: false - t.text :platform_target, null: false - t.integer :count, null: false - end - end - - add_text_limit :ci_platform_metrics, :platform_target, 255 - add_concurrent_index :ci_variables, :key, name: CI_VARIABLES_KEY_INDEX_NAME - end - - def down - if table_exists?(:ci_platform_metrics) - drop_table :ci_platform_metrics - end - - remove_concurrent_index :ci_variables, :key, name: CI_VARIABLES_KEY_INDEX_NAME - end -end diff --git a/db/migrate/20200821034419_add_unique_index_for_generic_packages.rb b/db/migrate/20200821034419_add_unique_index_for_generic_packages.rb deleted file mode 100644 index f0e4749bbb5..00000000000 --- a/db/migrate/20200821034419_add_unique_index_for_generic_packages.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddUniqueIndexForGenericPackages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'index_packages_on_project_id_name_version_unique_when_generic' - PACKAGE_TYPE_GENERIC = 7 - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_packages, [:project_id, :name, :version], unique: true, where: "package_type = #{PACKAGE_TYPE_GENERIC}", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:packages_packages, INDEX_NAME) - end -end diff --git a/db/migrate/20200821194920_create_atlassian_identities.rb b/db/migrate/20200821194920_create_atlassian_identities.rb deleted file mode 100644 index 1aab9ed6381..00000000000 --- a/db/migrate/20200821194920_create_atlassian_identities.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class CreateAtlassianIdentities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:atlassian_identities) - with_lock_retries do - create_table :atlassian_identities, id: false do |t| - t.references :user, index: false, foreign_key: { on_delete: :cascade }, null: false, primary_key: true - t.timestamps_with_timezone - t.datetime_with_timezone :expires_at - t.text :extern_uid, null: false, index: { unique: true } - t.binary :encrypted_token - t.binary :encrypted_token_iv - t.binary :encrypted_refresh_token - t.binary :encrypted_refresh_token_iv - end - end - end - - add_text_limit :atlassian_identities, :extern_uid, 255 - - add_check_constraint :atlassian_identities, 'octet_length(encrypted_token) <= 2048', 'atlassian_identities_token_length_constraint' - add_check_constraint :atlassian_identities, 'octet_length(encrypted_token_iv) <= 12', 'atlassian_identities_token_iv_length_constraint' - add_check_constraint :atlassian_identities, 'octet_length(encrypted_refresh_token) <= 512', 'atlassian_identities_refresh_token_length_constraint' - add_check_constraint :atlassian_identities, 'octet_length(encrypted_refresh_token_iv) <= 12', 'atlassian_identities_refresh_token_iv_length_constraint' - end - - def down - with_lock_retries do - drop_table :atlassian_identities - end - end -end diff --git a/db/migrate/20200824045812_add_generic_package_max_file_size_to_plan_limits.rb b/db/migrate/20200824045812_add_generic_package_max_file_size_to_plan_limits.rb deleted file mode 100644 index eea4f8de7bf..00000000000 --- a/db/migrate/20200824045812_add_generic_package_max_file_size_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddGenericPackageMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :generic_packages_max_file_size, :bigint, default: 5.gigabytes, null: false) - end -end diff --git a/db/migrate/20200824124623_create_issuable_severities.rb b/db/migrate/20200824124623_create_issuable_severities.rb deleted file mode 100644 index 674a54fc16d..00000000000 --- a/db/migrate/20200824124623_create_issuable_severities.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class CreateIssuableSeverities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :issuable_severities do |t| - t.references :issue, index: { unique: true }, null: false, foreign_key: { on_delete: :cascade } - t.integer :severity, null: false, default: 0, limit: 2 # 0 - will stand for unknown - end - end - end - - def down - with_lock_retries do - drop_table :issuable_severities - end - end -end diff --git a/db/migrate/20200825071735_create_merge_request_reviewers.rb b/db/migrate/20200825071735_create_merge_request_reviewers.rb deleted file mode 100644 index 45451476bb0..00000000000 --- a/db/migrate/20200825071735_create_merge_request_reviewers.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class CreateMergeRequestReviewers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - create_table :merge_request_reviewers do |t| - t.bigint :user_id, null: false - t.bigint :merge_request_id, null: false - t.datetime_with_timezone :created_at, null: false - end - - add_index :merge_request_reviewers, [:merge_request_id, :user_id], unique: true - add_index :merge_request_reviewers, :user_id - end - - def down - drop_table :merge_request_reviewers - end -end diff --git a/db/migrate/20200825081025_boards_epic_user_preferences.rb b/db/migrate/20200825081025_boards_epic_user_preferences.rb deleted file mode 100644 index fc7454a6a9a..00000000000 --- a/db/migrate/20200825081025_boards_epic_user_preferences.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class BoardsEpicUserPreferences < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - create_table :boards_epic_user_preferences do |t| - t.bigint :board_id, null: false - t.bigint :user_id, null: false - t.bigint :epic_id, null: false - t.boolean :collapsed, default: false, null: false - end - - add_index :boards_epic_user_preferences, :board_id - add_index :boards_epic_user_preferences, :user_id - add_index :boards_epic_user_preferences, :epic_id - add_index :boards_epic_user_preferences, [:board_id, :user_id, :epic_id], unique: true, name: 'index_boards_epic_user_preferences_on_board_user_epic_unique' - end - - def down - drop_table :boards_epic_user_preferences - end -end diff --git a/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb b/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb deleted file mode 100644 index 1c014573fb4..00000000000 --- a/db/migrate/20200825081035_boards_epic_user_preferences_fk_board.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class BoardsEpicUserPreferencesFkBoard < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :boards_epic_user_preferences, :boards, column: :board_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :boards_epic_user_preferences, column: :board_id - end - end -end diff --git a/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb b/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb deleted file mode 100644 index 3edc3bc0ded..00000000000 --- a/db/migrate/20200825081045_boards_epic_user_preferences_fk_user.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class BoardsEpicUserPreferencesFkUser < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :boards_epic_user_preferences, :users, column: :user_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :boards_epic_user_preferences, column: :user_id - end - end -end diff --git a/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb b/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb deleted file mode 100644 index 0354060b7c1..00000000000 --- a/db/migrate/20200825081055_boards_epic_user_preferences_fk_epic.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class BoardsEpicUserPreferencesFkEpic < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :boards_epic_user_preferences, :epics, column: :epic_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :boards_epic_user_preferences, column: :epic_id - end - end -end diff --git a/db/migrate/20200825084819_create_security_findings_table.rb b/db/migrate/20200825084819_create_security_findings_table.rb deleted file mode 100644 index d44b4671e2f..00000000000 --- a/db/migrate/20200825084819_create_security_findings_table.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateSecurityFindingsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:security_findings) - create_table :security_findings do |t| - t.references :scan, null: false - t.references :scanner, null: false - t.integer :severity, limit: 2, index: true, null: false - t.integer :confidence, limit: 2, index: true, null: false - t.text :project_fingerprint, index: true, null: false - end - end - - add_text_limit :security_findings, :project_fingerprint, 40 - end - - def down - drop_table :security_findings - end -end diff --git a/db/migrate/20200825154237_update_package_file_size_plan_limits_defaults.rb b/db/migrate/20200825154237_update_package_file_size_plan_limits_defaults.rb deleted file mode 100644 index b71e2a86f4a..00000000000 --- a/db/migrate/20200825154237_update_package_file_size_plan_limits_defaults.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class UpdatePackageFileSizePlanLimitsDefaults < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_default(:plan_limits, :maven_max_file_size, from: 50.megabytes, to: 3.gigabytes) - change_column_default(:plan_limits, :conan_max_file_size, from: 50.megabytes, to: 3.gigabytes) - change_column_default(:plan_limits, :nuget_max_file_size, from: 50.megabytes, to: 500.megabytes) - change_column_default(:plan_limits, :npm_max_file_size, from: 50.megabytes, to: 500.megabytes) - change_column_default(:plan_limits, :pypi_max_file_size, from: 50.megabytes, to: 3.gigabytes) - end -end diff --git a/db/migrate/20200825180050_add_pipeline_artifacts_size_to_root_storage_statistics.rb b/db/migrate/20200825180050_add_pipeline_artifacts_size_to_root_storage_statistics.rb deleted file mode 100644 index 069480c6887..00000000000 --- a/db/migrate/20200825180050_add_pipeline_artifacts_size_to_root_storage_statistics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPipelineArtifactsSizeToRootStorageStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespace_root_storage_statistics, :pipeline_artifacts_size, :bigint, default: 0, null: false - end - end - - def down - with_lock_retries do - remove_column :namespace_root_storage_statistics, :pipeline_artifacts_size, :bigint, default: 0, null: false - end - end -end diff --git a/db/migrate/20200826073745_add_default_to_ci_pipeline_locked.rb b/db/migrate/20200826073745_add_default_to_ci_pipeline_locked.rb deleted file mode 100644 index e73963043d5..00000000000 --- a/db/migrate/20200826073745_add_default_to_ci_pipeline_locked.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultToCiPipelineLocked < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - ARTIFACTS_LOCKED = 1 - UNLOCKED = 0 - - def up - with_lock_retries do - change_column_default :ci_pipelines, :locked, ARTIFACTS_LOCKED - end - end - - def down - with_lock_retries do - change_column_default :ci_pipelines, :locked, UNLOCKED - end - end -end diff --git a/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb b/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb deleted file mode 100644 index 5938d3c8d3a..00000000000 --- a/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddProjectsIndexOnImportTypeCreatorIdCreatedAt < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_imported_projects_on_import_type_creator_id_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, - [:import_type, :creator_id, :created_at], - where: 'import_type IS NOT NULL', - name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :projects, INDEX_NAME - end -end diff --git a/db/migrate/20200826212800_add_index_on_merge_request_id_and_rule_type_to_approval_merge_request_rule.rb b/db/migrate/20200826212800_add_index_on_merge_request_id_and_rule_type_to_approval_merge_request_rule.rb deleted file mode 100644 index a40e09648ef..00000000000 --- a/db/migrate/20200826212800_add_index_on_merge_request_id_and_rule_type_to_approval_merge_request_rule.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnMergeRequestIdAndRuleTypeToApprovalMergeRequestRule < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = "approval_mr_rule_index_merge_request_id" - - def up - add_concurrent_index( - :approval_merge_request_rules, - :merge_request_id, - name: INDEX_NAME - ) - end - - def down - remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME - end -end diff --git a/db/migrate/20200827005322_add_creator_id_to_packages.rb b/db/migrate/20200827005322_add_creator_id_to_packages.rb deleted file mode 100644 index ecd73ff8785..00000000000 --- a/db/migrate/20200827005322_add_creator_id_to_packages.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddCreatorIdToPackages < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:packages_packages, :creator_id, :integer) - end -end diff --git a/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb b/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb deleted file mode 100644 index 73d0eea9819..00000000000 --- a/db/migrate/20200827060911_add_merge_request_foreign_key_to_merge_request_reviewers.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddMergeRequestForeignKeyToMergeRequestReviewers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :merge_request_reviewers, :merge_requests, column: :merge_request_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :merge_request_reviewers, column: :merge_request_id - end - end -end diff --git a/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb b/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb deleted file mode 100644 index 5463c3d9846..00000000000 --- a/db/migrate/20200827060932_add_user_foreign_key_to_merge_request_reviewers.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddUserForeignKeyToMergeRequestReviewers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :merge_request_reviewers, :users, column: :user_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :merge_request_reviewers, column: :user_id - end - end -end diff --git a/db/migrate/20200827085101_add_seats_currently_in_use_in_gitlab_subscriptions.rb b/db/migrate/20200827085101_add_seats_currently_in_use_in_gitlab_subscriptions.rb deleted file mode 100644 index 83f2d573b6d..00000000000 --- a/db/migrate/20200827085101_add_seats_currently_in_use_in_gitlab_subscriptions.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSeatsCurrentlyInUseInGitlabSubscriptions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :gitlab_subscriptions, :seats_in_use, :integer, default: 0, null: false - add_column :gitlab_subscriptions, :seats_owed, :integer, default: 0, null: false - end - end - - def down - with_lock_retries do - remove_column :gitlab_subscriptions, :seats_in_use - remove_column :gitlab_subscriptions, :seats_owed - end - end -end diff --git a/db/migrate/20200827102234_add_ci_job_artifact_id_to_pages_metadata.rb b/db/migrate/20200827102234_add_ci_job_artifact_id_to_pages_metadata.rb deleted file mode 100644 index 4109c512f14..00000000000 --- a/db/migrate/20200827102234_add_ci_job_artifact_id_to_pages_metadata.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddCiJobArtifactIdToPagesMetadata < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:project_pages_metadata, :artifacts_archive_id, :bigint) - end -end diff --git a/db/migrate/20200827104432_add_foreign_key_to_artifacts_archive_id_in_pages_metadata.rb b/db/migrate/20200827104432_add_foreign_key_to_artifacts_archive_id_in_pages_metadata.rb deleted file mode 100644 index 90451ad597a..00000000000 --- a/db/migrate/20200827104432_add_foreign_key_to_artifacts_archive_id_in_pages_metadata.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToArtifactsArchiveIdInPagesMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = "index_project_pages_metadata_on_artifacts_archive_id" - - disable_ddl_transaction! - - def up - add_concurrent_index(:project_pages_metadata, :artifacts_archive_id, name: INDEX_NAME) - add_concurrent_foreign_key(:project_pages_metadata, :ci_job_artifacts, column: :artifacts_archive_id, on_delete: :nullify) - end - - def down - remove_foreign_key_if_exists(:project_pages_metadata, :ci_job_artifacts, column: :artifacts_archive_id) - remove_concurrent_index_by_name(:project_pages_metadata, INDEX_NAME) - end -end diff --git a/db/migrate/20200827114902_create_analytics_instance_statistics_measurements.rb b/db/migrate/20200827114902_create_analytics_instance_statistics_measurements.rb deleted file mode 100644 index f8584d4b9f6..00000000000 --- a/db/migrate/20200827114902_create_analytics_instance_statistics_measurements.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateAnalyticsInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0] - DOWNTIME = false - UNIQUE_INDEX_NAME = 'index_on_instance_statistics_recorded_at_and_identifier' - - def change - create_table :analytics_instance_statistics_measurements do |t| - t.bigint :count, null: false - t.datetime_with_timezone :recorded_at, null: false - t.integer :identifier, limit: 2, null: false - end - - add_index :analytics_instance_statistics_measurements, [:identifier, :recorded_at], unique: true, name: UNIQUE_INDEX_NAME - end -end diff --git a/db/migrate/20200827142811_create_merge_request_diff_details.rb b/db/migrate/20200827142811_create_merge_request_diff_details.rb deleted file mode 100644 index 29b070bc675..00000000000 --- a/db/migrate/20200827142811_create_merge_request_diff_details.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CreateMergeRequestDiffDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:merge_request_diff_details) - with_lock_retries do - create_table :merge_request_diff_details, id: false do |t| - t.references :merge_request_diff, primary_key: true, null: false, foreign_key: { on_delete: :cascade } - t.datetime_with_timezone :verification_retry_at - t.datetime_with_timezone :verified_at - t.integer :verification_retry_count, limit: 2 - t.binary :verification_checksum, using: 'verification_checksum::bytea' - t.text :verification_failure - end - end - end - - add_text_limit :merge_request_diff_details, :verification_failure, 255 - end - - def down - drop_table :merge_request_diff_details - end -end diff --git a/db/migrate/20200827150057_add_index_expire_at_to_pipeline_artifacts.rb b/db/migrate/20200827150057_add_index_expire_at_to_pipeline_artifacts.rb deleted file mode 100644 index 0a1943aa58b..00000000000 --- a/db/migrate/20200827150057_add_index_expire_at_to_pipeline_artifacts.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexExpireAtToPipelineArtifacts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_pipeline_artifacts_on_expire_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_pipeline_artifacts, :expire_at, name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:ci_pipeline_artifacts, INDEX_NAME) - end -end diff --git a/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb b/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb deleted file mode 100644 index 9d815cc75dc..00000000000 --- a/db/migrate/20200828155134_add_foreign_key_on_scan_id_to_security_scans.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyOnScanIdToSecurityScans < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :security_findings, :security_scans, column: :scan_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :security_findings, column: :scan_id - end - end -end diff --git a/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb b/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb deleted file mode 100644 index 015e83b59b1..00000000000 --- a/db/migrate/20200828155205_add_foreign_key_on_scanner_id_to_vulnerability_scanners.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyOnScannerIdToVulnerabilityScanners < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :security_findings, :vulnerability_scanners, column: :scanner_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :security_findings, column: :scanner_id - end - end -end diff --git a/db/migrate/20200830201204_add_index_to_package_creator.rb b/db/migrate/20200830201204_add_index_to_package_creator.rb deleted file mode 100644 index fbc8bbade94..00000000000 --- a/db/migrate/20200830201204_add_index_to_package_creator.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToPackageCreator < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_packages_packages_on_creator_id' - - def up - add_concurrent_index :packages_packages, :creator_id, name: INDEX_NAME - add_concurrent_foreign_key(:packages_packages, :users, column: :creator_id, on_delete: :nullify) - end - - def down - remove_foreign_key_if_exists(:packages_packages, :users, column: :creator_id) - remove_concurrent_index_by_name(:packages_packages, INDEX_NAME) - end -end diff --git a/db/migrate/20200831204646_add_project_feature_flags_to_plan_limits.rb b/db/migrate/20200831204646_add_project_feature_flags_to_plan_limits.rb deleted file mode 100644 index d4bd2431d9c..00000000000 --- a/db/migrate/20200831204646_add_project_feature_flags_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddProjectFeatureFlagsToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :project_feature_flags, :integer, default: 200, null: false) - end -end diff --git a/db/migrate/20200831222347_insert_project_feature_flags_plan_limits.rb b/db/migrate/20200831222347_insert_project_feature_flags_plan_limits.rb deleted file mode 100644 index 2c91016d9dd..00000000000 --- a/db/migrate/20200831222347_insert_project_feature_flags_plan_limits.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class InsertProjectFeatureFlagsPlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - return unless Gitlab.com? - - create_or_update_plan_limit('project_feature_flags', 'free', 50) - create_or_update_plan_limit('project_feature_flags', 'bronze', 100) - create_or_update_plan_limit('project_feature_flags', 'silver', 150) - create_or_update_plan_limit('project_feature_flags', 'gold', 200) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('project_feature_flags', 'free', 0) - create_or_update_plan_limit('project_feature_flags', 'bronze', 0) - create_or_update_plan_limit('project_feature_flags', 'silver', 0) - create_or_update_plan_limit('project_feature_flags', 'gold', 0) - end -end diff --git a/db/migrate/20200901203055_add_id_created_at_index_to_packages.rb b/db/migrate/20200901203055_add_id_created_at_index_to_packages.rb deleted file mode 100644 index d92309e3fef..00000000000 --- a/db/migrate/20200901203055_add_id_created_at_index_to_packages.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIdCreatedAtIndexToPackages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_packages_packages_on_id_and_created_at' - - def up - add_concurrent_index :packages_packages, [:id, :created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:packages_packages, INDEX_NAME) - end -end diff --git a/db/migrate/20200901214416_change_pypi_python_version_type.rb b/db/migrate/20200901214416_change_pypi_python_version_type.rb deleted file mode 100644 index b670b2129c2..00000000000 --- a/db/migrate/20200901214416_change_pypi_python_version_type.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class ChangePypiPythonVersionType < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - change_column_type_concurrently :packages_pypi_metadata, :required_python, :text, batch_column_name: :package_id # rubocop:disable Migration/AddLimitToTextColumns - end - - def down - cleanup_concurrent_column_type_change(:packages_pypi_metadata, :required_python) - change_column_null :packages_pypi_metadata, :required_python, false - end -end diff --git a/db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb b/db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb deleted file mode 100644 index 0ba8f12f89e..00000000000 --- a/db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -class UpdatePackageMaxFileSizePlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - # this is intended to be a no-op for GitLab.com - # 5GB is the value for these columns as of 2020-09-02 - if Gitlab.com? - update_all_plan_limits('conan_max_file_size', 5.gigabytes) - update_all_plan_limits('maven_max_file_size', 5.gigabytes) - update_all_plan_limits('npm_max_file_size', 5.gigabytes) - update_all_plan_limits('nuget_max_file_size', 5.gigabytes) - update_all_plan_limits('pypi_max_file_size', 5.gigabytes) - else - update_all_plan_limits('conan_max_file_size', 3.gigabytes) - update_all_plan_limits('maven_max_file_size', 3.gigabytes) - update_all_plan_limits('npm_max_file_size', 500.megabytes) - update_all_plan_limits('nuget_max_file_size', 500.megabytes) - update_all_plan_limits('pypi_max_file_size', 3.gigabytes) - end - end - - def down - update_all_plan_limits('conan_max_file_size', 50.megabytes) - update_all_plan_limits('maven_max_file_size', 50.megabytes) - update_all_plan_limits('npm_max_file_size', 50.megabytes) - update_all_plan_limits('nuget_max_file_size', 50.megabytes) - update_all_plan_limits('pypi_max_file_size', 50.megabytes) - end - - private - - def update_all_plan_limits(limit_name, limit_value) - limit_name_quoted = quote_column_name(limit_name) - limit_value_quoted = quote(limit_value) - - execute <<~SQL - UPDATE plan_limits - SET #{limit_name_quoted} = #{limit_value_quoted}; - SQL - end -end diff --git a/db/migrate/20200903054946_add_elasticsearch_client_timeout.rb b/db/migrate/20200903054946_add_elasticsearch_client_timeout.rb deleted file mode 100644 index 93e70461641..00000000000 --- a/db/migrate/20200903054946_add_elasticsearch_client_timeout.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddElasticsearchClientTimeout < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :elasticsearch_client_request_timeout, :integer, null: false, default: 0 - end -end diff --git a/db/migrate/20200903092241_add_index_to_resource_iteration_events_add_events.rb b/db/migrate/20200903092241_add_index_to_resource_iteration_events_add_events.rb deleted file mode 100644 index be530f1f9b5..00000000000 --- a/db/migrate/20200903092241_add_index_to_resource_iteration_events_add_events.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToResourceIterationEventsAddEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_resource_iteration_events_on_iteration_id_and_add_action' - ADD_ACTION = '1' - - def up - # Index add iteration events - add_concurrent_index :resource_iteration_events, :iteration_id, where: "action = #{ADD_ACTION}", name: INDEX_NAME - end - - def down - remove_concurrent_index :resource_iteration_events, :iteration_id, name: INDEX_NAME - end -end diff --git a/db/migrate/20200904092131_add_merge_ref_sha_to_merge_requests.rb b/db/migrate/20200904092131_add_merge_ref_sha_to_merge_requests.rb deleted file mode 100644 index a490bc8fe07..00000000000 --- a/db/migrate/20200904092131_add_merge_ref_sha_to_merge_requests.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddMergeRefShaToMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :merge_requests, :merge_ref_sha, :binary - end - end - - def down - with_lock_retries do - remove_column :merge_requests, :merge_ref_sha - end - end -end diff --git a/db/migrate/20200904131544_create_ci_build_pending_states.rb b/db/migrate/20200904131544_create_ci_build_pending_states.rb deleted file mode 100644 index 2c21ce3ce32..00000000000 --- a/db/migrate/20200904131544_create_ci_build_pending_states.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateCiBuildPendingStates < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :ci_build_pending_states do |t| - t.timestamps_with_timezone - t.references :build, index: { unique: true }, null: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }, type: :bigint - t.integer :state - t.integer :failure_reason - t.binary :trace_checksum - end - end - end - - def down - with_lock_retries do - drop_table :ci_build_pending_states - end - end -end diff --git a/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb b/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb deleted file mode 100644 index 0a6d0ce7339..00000000000 --- a/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddGolangPackageMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :golang_max_file_size, :bigint, default: 100.megabytes, null: false) - end -end diff --git a/db/migrate/20200907021256_create_dast_site_tokens.rb b/db/migrate/20200907021256_create_dast_site_tokens.rb deleted file mode 100644 index a8e221aef69..00000000000 --- a/db/migrate/20200907021256_create_dast_site_tokens.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -class CreateDastSiteTokens < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:dast_site_tokens) - with_lock_retries do - create_table :dast_site_tokens do |t| - t.references :project, foreign_key: { on_delete: :cascade }, null: false, index: true - - t.timestamps_with_timezone null: false - t.datetime_with_timezone :expired_at - - t.text :token, null: false, unique: true - t.text :url, null: false - end - end - end - - add_text_limit :dast_site_tokens, :token, 255 - add_text_limit :dast_site_tokens, :url, 255 - end - - def down - with_lock_retries do - drop_table :dast_site_tokens - end - end -end diff --git a/db/migrate/20200907062101_create_dast_site_validations.rb b/db/migrate/20200907062101_create_dast_site_validations.rb deleted file mode 100644 index 5ff2084d693..00000000000 --- a/db/migrate/20200907062101_create_dast_site_validations.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -class CreateDastSiteValidations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:dast_site_validations) - with_lock_retries do - create_table :dast_site_validations do |t| - t.references :dast_site_token, foreign_key: { on_delete: :cascade }, null: false, index: true - - t.timestamps_with_timezone null: false - t.datetime_with_timezone :validation_started_at - t.datetime_with_timezone :validation_passed_at - t.datetime_with_timezone :validation_failed_at - t.datetime_with_timezone :validation_last_retried_at - - t.integer :validation_strategy, null: false, limit: 2 - - t.text :url_base, null: false - t.text :url_path, null: false - end - end - end - - add_concurrent_index :dast_site_validations, :url_base - add_text_limit :dast_site_validations, :url_base, 255 - add_text_limit :dast_site_validations, :url_path, 255 - end - - def down - with_lock_retries do - drop_table :dast_site_validations - end - end -end diff --git a/db/migrate/20200907092610_add_user_id_to_group_import_states.rb b/db/migrate/20200907092610_add_user_id_to_group_import_states.rb deleted file mode 100644 index 231bafeabdb..00000000000 --- a/db/migrate/20200907092610_add_user_id_to_group_import_states.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddUserIdToGroupImportStates < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:group_import_states, :user_id) - with_lock_retries do - add_column :group_import_states, :user_id, :bigint - end - end - - add_concurrent_foreign_key :group_import_states, :users, column: :user_id, on_delete: :cascade - add_concurrent_index :group_import_states, :user_id, where: 'user_id IS NOT NULL', name: 'index_group_import_states_on_user_id' - end - - def down - with_lock_retries do - remove_column :group_import_states, :user_id - end - end -end diff --git a/db/migrate/20200908033805_add_dast_site_validation_id_to_dast_site.rb b/db/migrate/20200908033805_add_dast_site_validation_id_to_dast_site.rb deleted file mode 100644 index 3ac86fb1d9e..00000000000 --- a/db/migrate/20200908033805_add_dast_site_validation_id_to_dast_site.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class AddDastSiteValidationIdToDastSite < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - TABLE_NAME = :dast_sites - RELATION_NAME = :dast_site_validations - FK_NAME = :dast_site_validation_id - INDEX_NAME = "index_dast_sites_on_#{FK_NAME}" - - disable_ddl_transaction! - - def up - unless column_exists?(TABLE_NAME, FK_NAME) - with_lock_retries do - add_column TABLE_NAME, FK_NAME, :bigint - end - end - - add_concurrent_index TABLE_NAME, FK_NAME, name: INDEX_NAME - add_concurrent_foreign_key TABLE_NAME, RELATION_NAME, column: FK_NAME, on_delete: :nullify - end - - def down - remove_foreign_key_if_exists TABLE_NAME, RELATION_NAME - remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME - - with_lock_retries do - remove_column TABLE_NAME, FK_NAME - end - end -end diff --git a/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb b/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb deleted file mode 100644 index 27fc93a2c53..00000000000 --- a/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddNewSettingToNamespaceSetting < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :namespace_settings, :allow_mfa_for_subgroups, :boolean, default: true, null: false - end - end - - def down - with_lock_retries do - remove_column :namespace_settings, :allow_mfa_for_subgroups - end - end -end diff --git a/db/migrate/20200908100053_create_authentication_events.rb b/db/migrate/20200908100053_create_authentication_events.rb deleted file mode 100644 index 2ea9f4e24af..00000000000 --- a/db/migrate/20200908100053_create_authentication_events.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class CreateAuthenticationEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:authentication_events) - with_lock_retries do - create_table :authentication_events do |t| - t.datetime_with_timezone :created_at, null: false - t.references :user, foreign_key: { on_delete: :nullify }, index: true - t.integer :result, limit: 2, null: false - t.inet :ip_address - t.text :provider, null: false, index: true - t.text :user_name, null: false - end - end - end - - add_text_limit :authentication_events, :provider, 64 - add_text_limit :authentication_events, :user_name, 255 - end - - def down - with_lock_retries do - drop_table :authentication_events - end - end -end diff --git a/db/migrate/20200908183231_add_check_positive_constraint_to_ci_platform_metrics.rb b/db/migrate/20200908183231_add_check_positive_constraint_to_ci_platform_metrics.rb deleted file mode 100644 index 8593e03b5d8..00000000000 --- a/db/migrate/20200908183231_add_check_positive_constraint_to_ci_platform_metrics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCheckPositiveConstraintToCiPlatformMetrics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'ci_platform_metrics_check_count_positive' - - def up - add_check_constraint :ci_platform_metrics, 'count > 0', CONSTRAINT_NAME - end - - def down - remove_check_constraint :ci_platform_metrics, CONSTRAINT_NAME - end -end diff --git a/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb b/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb deleted file mode 100644 index 40e2b37b390..00000000000 --- a/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddFeatureFlagEventsToWebHooks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :web_hooks, :feature_flag_events, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20200909040555_create_package_events.rb b/db/migrate/20200909040555_create_package_events.rb deleted file mode 100644 index 000ff051a7c..00000000000 --- a/db/migrate/20200909040555_create_package_events.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreatePackageEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - create_table :packages_events do |t| - t.integer :event_type, null: false, limit: 2 - t.integer :event_scope, null: false, limit: 2 - t.integer :originator_type, null: false, limit: 2 - t.bigint :originator - t.datetime_with_timezone :created_at, null: false - - t.references :package, primary_key: false, default: nil, index: true, foreign_key: { to_table: :packages_packages, on_delete: :nullify }, type: :bigint - end - end -end diff --git a/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb b/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb deleted file mode 100644 index 7024cc4a263..00000000000 --- a/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddChangeReviewerMergeRequestToNotificationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :notification_settings, :change_reviewer_merge_request, :boolean - end -end diff --git a/db/migrate/20200911120132_create_pages_deployments.rb b/db/migrate/20200911120132_create_pages_deployments.rb deleted file mode 100644 index 25327a76900..00000000000 --- a/db/migrate/20200911120132_create_pages_deployments.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -class CreatePagesDeployments < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :pages_deployments, if_not_exists: true do |t| - t.timestamps_with_timezone - - t.bigint :project_id, index: true, null: false - t.bigint :ci_build_id, index: true - - t.integer :file_store, null: false, limit: 2 - t.integer :size, null: false - t.text :file, null: false - end - - add_text_limit :pages_deployments, :file, 255 - end - - def down - drop_table :pages_deployments - end -end diff --git a/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb b/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb deleted file mode 100644 index 665b9de9230..00000000000 --- a/db/migrate/20200911121027_add_pages_deployment_project_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPagesDeploymentProjectForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :pages_deployments, :projects, column: :project_id, on_delete: :cascade - end - end - - def down - with_lock_retries do - remove_foreign_key :pages_deployments, column: :project_id - end - end -end diff --git a/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb b/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb deleted file mode 100644 index 83f38b2fae3..00000000000 --- a/db/migrate/20200911121048_add_pages_deployment_ci_build_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPagesDeploymentCiBuildForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :pages_deployments, :ci_builds, column: :ci_build_id, on_delete: :nullify - end - end - - def down - with_lock_retries do - remove_foreign_key :pages_deployments, column: :ci_build_id - end - end -end diff --git a/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb b/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb deleted file mode 100644 index b469099014d..00000000000 --- a/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RenameAdminNotificationEmailApplicationSetting < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - rename_column_concurrently :application_settings, :admin_notification_email, :abuse_notification_email - end - - def down - undo_rename_column_concurrently :application_settings, :admin_notification_email, :abuse_notification_email - end -end diff --git a/db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb b/db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb deleted file mode 100644 index bc2b8d4ce97..00000000000 --- a/db/migrate/20200912193210_add_scheduling_issues_temp_indexes.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSchedulingIssuesTempIndexes < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :issue_links, [:source_id], where: 'link_type = 1', name: 'tmp_idx_blocking_type_links' - add_concurrent_index :issue_links, [:target_id], where: 'link_type = 2', name: 'tmp_idx_blocked_by_type_links' - add_concurrent_index :issues, :id, where: '(state_id = 1 AND blocking_issues_count = 0)', name: 'tmp_idx_index_issues_with_outdate_blocking_count' - end - - def down - remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocking_type_links') - remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocked_by_type_links') - remove_concurrent_index_by_name(:issues, 'tmp_idx_index_issues_with_outdate_blocking_count') - end -end diff --git a/db/migrate/20200913115700_add_kroki_application_settings.rb b/db/migrate/20200913115700_add_kroki_application_settings.rb deleted file mode 100644 index 84d490c2980..00000000000 --- a/db/migrate/20200913115700_add_kroki_application_settings.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddKrokiApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20201011005400_add_text_limit_to_application_settings_kroki_url.rb - # - def change - add_column :application_settings, :kroki_url, :text - add_column :application_settings, :kroki_enabled, :boolean, default: false, null: false - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb b/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb deleted file mode 100644 index fa787fe98b0..00000000000 --- a/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddExpirationPolicyStartedAtToContainerRepositories < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column(:container_repositories, :expiration_policy_started_at, :datetime_with_timezone) - end - - def down - remove_column(:container_repositories, :expiration_policy_started_at) - end -end diff --git a/db/migrate/20200914091326_change_build_pending_state_enums.rb b/db/migrate/20200914091326_change_build_pending_state_enums.rb deleted file mode 100644 index dadb15e8844..00000000000 --- a/db/migrate/20200914091326_change_build_pending_state_enums.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class ChangeBuildPendingStateEnums < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - change_column :ci_build_pending_states, :state, :integer, limit: 2 - change_column :ci_build_pending_states, :failure_reason, :integer, limit: 2 - end - - def down - change_column :ci_build_pending_states, :state, :integer - change_column :ci_build_pending_states, :failure_reason, :integer - end -end diff --git a/db/migrate/20200914104642_modify_merge_request_api_index.rb b/db/migrate/20200914104642_modify_merge_request_api_index.rb deleted file mode 100644 index c21404a10c2..00000000000 --- a/db/migrate/20200914104642_modify_merge_request_api_index.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class ModifyMergeRequestApiIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :merge_requests, [:target_project_id, :created_at, :id], name: :index_merge_requests_on_target_project_id_and_created_at_and_id - end - - def down - remove_concurrent_index :merge_requests, [:target_project_id, :created_at, :id], name: :index_merge_requests_on_target_project_id_and_created_at_and_id - end -end diff --git a/db/migrate/20200914105202_remove_old_merge_request_api_index.rb b/db/migrate/20200914105202_remove_old_merge_request_api_index.rb deleted file mode 100644 index 826833dbfb2..00000000000 --- a/db/migrate/20200914105202_remove_old_merge_request_api_index.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveOldMergeRequestApiIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :merge_requests, [:target_project_id, :created_at], name: :index_merge_requests_target_project_id_created_at - end - - def down - add_concurrent_index :merge_requests, [:target_project_id, :created_at], name: :index_merge_requests_target_project_id_created_at - end -end diff --git a/db/migrate/20200914155135_add_deduplicated_flag_into_security_findings_table.rb b/db/migrate/20200914155135_add_deduplicated_flag_into_security_findings_table.rb deleted file mode 100644 index f403c2d9a07..00000000000 --- a/db/migrate/20200914155135_add_deduplicated_flag_into_security_findings_table.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDeduplicatedFlagIntoSecurityFindingsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :security_findings, :deduplicated, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200914183227_add_index_on_deduplicated_column_of_security_findings.rb b/db/migrate/20200914183227_add_index_on_deduplicated_column_of_security_findings.rb deleted file mode 100644 index 1d0f656df4d..00000000000 --- a/db/migrate/20200914183227_add_index_on_deduplicated_column_of_security_findings.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnDeduplicatedColumnOfSecurityFindings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_security_findings_on_scan_id_and_deduplicated' - - disable_ddl_transaction! - - def up - add_concurrent_index :security_findings, [:scan_id, :deduplicated], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :security_findings, INDEX_NAME - end -end diff --git a/db/migrate/20200914184212_remove_index_on_security_findings_scan_id.rb b/db/migrate/20200914184212_remove_index_on_security_findings_scan_id.rb deleted file mode 100644 index 342dba537d5..00000000000 --- a/db/migrate/20200914184212_remove_index_on_security_findings_scan_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveIndexOnSecurityFindingsScanId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_security_findings_on_scan_id' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :security_findings, INDEX_NAME - end - - def down - add_concurrent_index :security_findings, :scan_id, name: INDEX_NAME - end -end diff --git a/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb b/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb deleted file mode 100644 index b7b0e1da2cb..00000000000 --- a/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddIndicesToApprovalProjectRules < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - RULE_TYPE_INDEX_NAME = 'index_approval_project_rules_on_id_with_regular_type' - RULE_ID_INDEX_NAME = 'index_approval_project_rules_users_on_approval_project_rule_id' - - def up - add_concurrent_index :approval_project_rules, :id, where: 'rule_type = 0', name: RULE_TYPE_INDEX_NAME - add_concurrent_index :approval_project_rules_users, :approval_project_rule_id, name: RULE_ID_INDEX_NAME - end - - def down - remove_concurrent_index :approval_project_rules, :id, where: 'rule_type = 0', name: RULE_TYPE_INDEX_NAME - remove_concurrent_index :approval_project_rules_users, :approval_project_rule_id, name: RULE_ID_INDEX_NAME - end -end diff --git a/db/migrate/20200915152641_add_verification_state_to_terraform_state_version.rb b/db/migrate/20200915152641_add_verification_state_to_terraform_state_version.rb deleted file mode 100644 index 9cc9a702397..00000000000 --- a/db/migrate/20200915152641_add_verification_state_to_terraform_state_version.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationStateToTerraformStateVersion < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_table(:terraform_state_versions) do |t| - t.integer :verification_retry_count, limit: 2 - t.column :verification_retry_at, :datetime_with_timezone - t.column :verified_at, :datetime_with_timezone - t.binary :verification_checksum, using: 'verification_checksum::bytea' - - # rubocop:disable Migration/AddLimitToTextColumns - t.text :verification_failure - # rubocop:enable Migration/AddLimitToTextColumns - end - end -end diff --git a/db/migrate/20200915164448_add_verification_failure_limit_to_terraform_state_version.rb b/db/migrate/20200915164448_add_verification_failure_limit_to_terraform_state_version.rb deleted file mode 100644 index 810057a5f54..00000000000 --- a/db/migrate/20200915164448_add_verification_failure_limit_to_terraform_state_version.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationFailureLimitToTerraformStateVersion < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'tf_state_versions_verification_failure_text_limit' - - def up - add_text_limit :terraform_state_versions, :verification_failure, 255, constraint_name: CONSTRAINT_NAME - end - - def down - remove_check_constraint(:terraform_state_versions, CONSTRAINT_NAME) - end -end diff --git a/db/migrate/20200915164844_add_verification_failure_index_to_terraform_state_version.rb b/db/migrate/20200915164844_add_verification_failure_index_to_terraform_state_version.rb deleted file mode 100644 index 423484e74bb..00000000000 --- a/db/migrate/20200915164844_add_verification_failure_index_to_terraform_state_version.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationFailureIndexToTerraformStateVersion < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - FAILURE_INDEX_NAME = 'terraform_state_versions_verification_failure_partial' - CHECKSUM_INDEX_NAME = 'terraform_state_versions_verification_checksum_partial' - - disable_ddl_transaction! - - def up - add_concurrent_index :terraform_state_versions, :verification_failure, - where: "(verification_failure IS NOT NULL)", - name: FAILURE_INDEX_NAME - add_concurrent_index :terraform_state_versions, :verification_checksum, - where: "(verification_checksum IS NOT NULL)", - name: CHECKSUM_INDEX_NAME - end - - def down - remove_concurrent_index_by_name :terraform_state_versions, FAILURE_INDEX_NAME - remove_concurrent_index_by_name :terraform_state_versions, CHECKSUM_INDEX_NAME - end -end diff --git a/db/migrate/20200916120837_add_index_to_members_for_unaccepted_invitations.rb b/db/migrate/20200916120837_add_index_to_members_for_unaccepted_invitations.rb deleted file mode 100644 index 3b0e4b99eb5..00000000000 --- a/db/migrate/20200916120837_add_index_to_members_for_unaccepted_invitations.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToMembersForUnacceptedInvitations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'idx_members_created_at_user_id_invite_token' - INDEX_SCOPE = 'invite_token IS NOT NULL AND user_id IS NULL' - - disable_ddl_transaction! - - def up - add_concurrent_index(:members, :created_at, where: INDEX_SCOPE, name: INDEX_NAME) - end - - def down - remove_concurrent_index(:members, :created_at, where: INDEX_SCOPE, name: INDEX_NAME) - end -end diff --git a/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb b/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb deleted file mode 100644 index bec162ff888..00000000000 --- a/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddStateIdIndexToMergeRequests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id - end - - def down - remove_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id - end -end diff --git a/db/migrate/20200916151442_add_result_index_to_authentication_events.rb b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb deleted file mode 100644 index 13b0521038e..00000000000 --- a/db/migrate/20200916151442_add_result_index_to_authentication_events.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddResultIndexToAuthenticationEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_authentication_events_on_provider_user_id_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :authentication_events, [:provider, :user_id, :created_at], where: 'result = 1', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :authentication_events, INDEX_NAME - end -end diff --git a/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb b/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb deleted file mode 100644 index 9a91a5d2195..00000000000 --- a/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDebianMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :debian_max_file_size, :bigint, default: 3.gigabytes, null: false - end -end diff --git a/db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb b/db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb deleted file mode 100644 index 21259b633b1..00000000000 --- a/db/migrate/20200917121650_add_help_page_documentation_url_to_application_settings.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddHelpPageDocumentationUrlToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20200921113722_add_text_limit_to_help_page_documentation_url.rb - def change - add_column :application_settings, :help_page_documentation_base_url, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb b/db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb deleted file mode 100644 index c8c856c7533..00000000000 --- a/db/migrate/20200919200318_add_default_branch_name_to_namespace_settings.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultBranchNameToNamespaceSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - - # limit is added in 20200919204155_add_text_limit_to_namespace_settings_default_branch_name - # - def change - add_column :namespace_settings, :default_branch_name, :text - end - - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb b/db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb deleted file mode 100644 index 174a1a9c556..00000000000 --- a/db/migrate/20200919204155_add_text_limit_to_namespace_settings_default_branch_name.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToNamespaceSettingsDefaultBranchName < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :namespace_settings, :default_branch_name, 255 - end - - def down - # Down is required as `add_text_limit` is not reversible - # - remove_text_limit :namespace_settings, :default_branch_name - end -end diff --git a/db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb b/db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb deleted file mode 100644 index 7501f150283..00000000000 --- a/db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddContainerExpirationPolicyWorkerSettingsToApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - unless column_exists?(:application_settings, :container_registry_expiration_policies_worker_capacity) - add_column(:application_settings, :container_registry_expiration_policies_worker_capacity, :integer, default: 0, null: false) - end - end - - def down - if column_exists?(:application_settings, :container_registry_expiration_policies_worker_capacity) - remove_column(:application_settings, :container_registry_expiration_policies_worker_capacity) - end - end -end diff --git a/db/migrate/20200921093826_add_index_to_user_preferences.rb b/db/migrate/20200921093826_add_index_to_user_preferences.rb deleted file mode 100644 index 78b04eb7a83..00000000000 --- a/db/migrate/20200921093826_add_index_to_user_preferences.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToUserPreferences < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :user_preferences, :gitpod_enabled, name: :index_user_preferences_on_gitpod_enabled - end - - def down - remove_concurrent_index :user_preferences, :gitpod_enabled, name: :index_user_preferences_on_gitpod_enabled - end -end diff --git a/db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb b/db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb deleted file mode 100644 index a262ea559a5..00000000000 --- a/db/migrate/20200921113722_add_text_limit_to_help_page_documentation_url.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToHelpPageDocumentationUrl < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :help_page_documentation_base_url, 255 - end - - def down - remove_text_limit :application_settings, :help_page_documentation_base_url - end -end diff --git a/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb b/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb deleted file mode 100644 index 395ce43d8ac..00000000000 --- a/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddPagesDeploymentIdToPagesMetadata < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_pages_metadata, :pages_deployment_id, :bigint - end -end diff --git a/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb b/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb deleted file mode 100644 index 8611f3ab943..00000000000 --- a/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToPagesDeploymentIdInProjectPagesMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_project_pages_metadata_on_pages_deployment_id' - - disable_ddl_transaction! - - def up - add_concurrent_index(:project_pages_metadata, :pages_deployment_id, name: INDEX_NAME) - add_concurrent_foreign_key :project_pages_metadata, :pages_deployments, column: :pages_deployment_id, on_delete: :nullify - end - - def down - remove_foreign_key_if_exists :project_pages_metadata, column: :pages_deployment_id - remove_concurrent_index_by_name(:project_pages_metadata, INDEX_NAME) - end -end diff --git a/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb b/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb deleted file mode 100644 index 3f073e32d84..00000000000 --- a/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveDuplicateClusterAgentsIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX = 'index_cluster_agents_on_project_id' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :cluster_agents, INDEX - end - - def down - add_concurrent_index :cluster_agents, :project_id, name: INDEX - end -end diff --git a/db/migrate/20200922052316_create_issue_email_participants.rb b/db/migrate/20200922052316_create_issue_email_participants.rb deleted file mode 100644 index a8aeb9d9a5a..00000000000 --- a/db/migrate/20200922052316_create_issue_email_participants.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class CreateIssueEmailParticipants < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:issue_email_participants) - with_lock_retries do - create_table :issue_email_participants do |t| - t.references :issue, index: false, null: false, foreign_key: { on_delete: :cascade } - t.datetime_with_timezone :created_at, null: false - t.datetime_with_timezone :updated_at, null: false - t.text :email, null: false - - t.index [:issue_id, :email], unique: true - end - end - - add_text_limit(:issue_email_participants, :email, 255) - end - end - - def down - with_lock_retries do - drop_table :issue_email_participants - end - end -end diff --git a/db/migrate/20200922075244_add_compliance_framework_model.rb b/db/migrate/20200922075244_add_compliance_framework_model.rb deleted file mode 100644 index 376482d9005..00000000000 --- a/db/migrate/20200922075244_add_compliance_framework_model.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddComplianceFrameworkModel < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:compliance_management_frameworks) - with_lock_retries do - create_table :compliance_management_frameworks do |t| - t.references :group, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false, index: false - t.text :name, null: false - t.text :description, null: false - t.text :color, null: false - t.index [:group_id, :name], unique: true - end - end - end - - add_text_limit :compliance_management_frameworks, :name, 255 - add_text_limit :compliance_management_frameworks, :description, 255 - add_text_limit :compliance_management_frameworks, :color, 10 - end - - def down - with_lock_retries do - drop_table :compliance_management_frameworks - end - end -end diff --git a/db/migrate/20200922093004_add_postgres_index_view.rb b/db/migrate/20200922093004_add_postgres_index_view.rb deleted file mode 100644 index c16eae4dd0b..00000000000 --- a/db/migrate/20200922093004_add_postgres_index_view.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class AddPostgresIndexView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - CREATE VIEW postgres_indexes AS - SELECT - pg_namespace.nspname || '.' || pg_class.relname as identifier, - pg_index.indexrelid, - pg_namespace.nspname as schema, - pg_class.relname as name, - pg_index.indisunique as unique, - pg_index.indisvalid as valid_index, - pg_class.relispartition as partitioned, - pg_index.indisexclusion as exclusion, - pg_indexes.indexdef as definition, - pg_relation_size(pg_class.oid) as ondisk_size_bytes - FROM pg_index - INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid - INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog' - SQL - end - - def down - execute(<<~SQL) - DROP VIEW postgres_indexes - SQL - end -end diff --git a/db/migrate/20200922133949_create_bulk_import.rb b/db/migrate/20200922133949_create_bulk_import.rb deleted file mode 100644 index 29d770d13ff..00000000000 --- a/db/migrate/20200922133949_create_bulk_import.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class CreateBulkImport < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :bulk_imports do |t| - t.references :user, type: :integer, index: true, null: false, foreign_key: { on_delete: :cascade } - - t.integer :source_type, null: false, limit: 2 - t.integer :status, null: false, limit: 2 - - t.timestamps_with_timezone - end - end - end - - def down - with_lock_retries do - drop_table :bulk_imports - end - end -end diff --git a/db/migrate/20200923071622_add_description_to_requirements.rb b/db/migrate/20200923071622_add_description_to_requirements.rb deleted file mode 100644 index b4b1250c10a..00000000000 --- a/db/migrate/20200923071622_add_description_to_requirements.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddDescriptionToRequirements < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit for description is added in 20200923071644_add_text_limit_to_requirements_description - # for description_html limit is not set because it's for caching purposes and - # its value is generated from `description` - def change - add_column :requirements, :description, :text - add_column :requirements, :description_html, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb b/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb deleted file mode 100644 index 0172d6bbba3..00000000000 --- a/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToRequirementsDescription < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :requirements, :description, 10_000 - end - - def down - remove_text_limit :requirements, :description - end -end diff --git a/db/migrate/20200923102312_update_programming_language_colors.rb b/db/migrate/20200923102312_update_programming_language_colors.rb deleted file mode 100644 index 37233bd3148..00000000000 --- a/db/migrate/20200923102312_update_programming_language_colors.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true -require 'yaml' - -class UpdateProgrammingLanguageColors < ActiveRecord::Migration[6.0] - DOWNTIME = false - - class ProgrammingLanguage < ActiveRecord::Base; end - - def up - YAML.load_file("vendor/languages.yml").each do |name, metadata| - color = metadata["color"] - next unless color.present? - - ProgrammingLanguage.where(name: name).update(color: color) - end - end - - def down - # noop - end -end diff --git a/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb b/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb deleted file mode 100644 index e9ab6f9ff15..00000000000 --- a/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class RemoveTmpContainerScanningIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'tmp_index_for_fixing_inconsistent_vulnerability_occurrences' - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME) - end - - def down - # report_type: 2 container scanning - add_concurrent_index(:vulnerability_occurrences, :id, - where: "LENGTH(location_fingerprint) = 40 AND report_type = 2", - name: INDEX_NAME) - end -end diff --git a/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb b/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb deleted file mode 100644 index ed37e44e201..00000000000 --- a/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddPostgresReindexActionsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :postgres_reindex_actions, if_not_exists: true do |t| - t.datetime_with_timezone :action_start, null: false - t.datetime_with_timezone :action_end - t.bigint :ondisk_size_bytes_start, null: false - t.bigint :ondisk_size_bytes_end - t.integer :state, limit: 2, null: false, default: 0 - t.text :index_identifier, null: false, index: true - end - - add_text_limit(:postgres_reindex_actions, :index_identifier, 255) - end - - def down - drop_table :postgres_reindex_actions - end -end diff --git a/db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb b/db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb deleted file mode 100644 index 588ce8fada7..00000000000 --- a/db/migrate/20200924035825_add_options_to_dast_scanner_profile.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddOptionsToDastScannerProfile < ActiveRecord::Migration[6.0] - DOWNTIME = false - - PASSIVE_SCAN_ENUM_VALUE = 1 - - def change - add_column :dast_scanner_profiles, :scan_type, :integer, limit: 2, default: PASSIVE_SCAN_ENUM_VALUE, null: false - add_column :dast_scanner_profiles, :use_ajax_spider, :boolean, default: false, null: false - add_column :dast_scanner_profiles, :show_debug_messages, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200925112104_create_bulk_import_configurations.rb b/db/migrate/20200925112104_create_bulk_import_configurations.rb deleted file mode 100644 index b894cdeefbc..00000000000 --- a/db/migrate/20200925112104_create_bulk_import_configurations.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateBulkImportConfigurations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :bulk_import_configurations, if_not_exists: true do |t| - t.references :bulk_import, type: :integer, index: true, null: false, foreign_key: { on_delete: :cascade } - - t.text :encrypted_url # rubocop: disable Migration/AddLimitToTextColumns - t.text :encrypted_url_iv # rubocop: disable Migration/AddLimitToTextColumns - - t.text :encrypted_access_token # rubocop: disable Migration/AddLimitToTextColumns - t.text :encrypted_access_token_iv # rubocop: disable Migration/AddLimitToTextColumns - - t.timestamps_with_timezone - end - end - - def down - drop_table :bulk_import_configurations - end -end diff --git a/db/migrate/20200925114522_create_bulk_import_entities.rb b/db/migrate/20200925114522_create_bulk_import_entities.rb deleted file mode 100644 index c78c4aee9ae..00000000000 --- a/db/migrate/20200925114522_create_bulk_import_entities.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class CreateBulkImportEntities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :bulk_import_entities, if_not_exists: true do |t| - t.bigint :bulk_import_id, index: true, null: false - t.bigint :parent_id, index: true - t.bigint :namespace_id, index: true - t.bigint :project_id, index: true - - t.integer :source_type, null: false, limit: 2 - t.text :source_full_path, null: false - - t.text :destination_name, null: false - t.text :destination_namespace, null: false - - t.integer :status, null: false, limit: 2 - t.text :jid - - t.timestamps_with_timezone - end - - add_text_limit(:bulk_import_entities, :source_full_path, 255) - add_text_limit(:bulk_import_entities, :destination_name, 255) - add_text_limit(:bulk_import_entities, :destination_namespace, 255) - add_text_limit(:bulk_import_entities, :jid, 255) - end - - def down - drop_table :bulk_import_entities - end -end diff --git a/db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb b/db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb deleted file mode 100644 index 8a352fc6e9f..00000000000 --- a/db/migrate/20200925125321_add_u2f_id_to_webauthn_registration.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddU2fIdToWebauthnRegistration < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - add_column :webauthn_registrations, :u2f_registration_id, :integer - end -end diff --git a/db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb deleted file mode 100644 index fca4070d990..00000000000 --- a/db/migrate/20200925153423_add_bulk_import_foreign_key_to_bulk_import_entities.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddBulkImportForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :bulk_import_entities, :bulk_imports, column: :bulk_import_id, on_delete: :cascade - end - - def down - remove_foreign_key :bulk_import_entities, column: :bulk_import_id - end -end diff --git a/db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb deleted file mode 100644 index 37e38c384b8..00000000000 --- a/db/migrate/20200925193815_add_parent_foreign_key_to_bulk_import_entities.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddParentForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :bulk_import_entities, :bulk_import_entities, column: :parent_id, on_delete: :cascade - end - - def down - remove_foreign_key :bulk_import_entities, column: :parent_id - end -end diff --git a/db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb deleted file mode 100644 index 13212395488..00000000000 --- a/db/migrate/20200925193906_add_namespace_foreign_key_to_bulk_import_entities.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddNamespaceForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :bulk_import_entities, :namespaces, column: :namespace_id - end - - def down - with_lock_retries do - remove_foreign_key :bulk_import_entities, column: :namespace_id - end - end -end diff --git a/db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb b/db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb deleted file mode 100644 index 975f2b1ef4a..00000000000 --- a/db/migrate/20200925194006_add_project_foreign_key_to_bulk_import_entities.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddProjectForeignKeyToBulkImportEntities < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :bulk_import_entities, :projects, column: :project_id - end - - def down - with_lock_retries do - remove_foreign_key :bulk_import_entities, column: :project_id - end - end -end diff --git a/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb b/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb deleted file mode 100644 index ed4dd5b9cc1..00000000000 --- a/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddIncidentIssueTypeIndexToIssues < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INCIDENT_ISSUE_TYPE = 1 - INDEX_NAME = 'index_issues_project_id_issue_type_incident' - - def up - add_concurrent_index :issues, :project_id, where: "issue_type = #{INCIDENT_ISSUE_TYPE}", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:issues, INDEX_NAME) - end -end diff --git a/db/migrate/20200928095732_add_state_to_dast_site_validation.rb b/db/migrate/20200928095732_add_state_to_dast_site_validation.rb deleted file mode 100644 index 7adeef54d71..00000000000 --- a/db/migrate/20200928095732_add_state_to_dast_site_validation.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddStateToDastSiteValidation < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20200928100408_add_text_limit_to_dast_site_validation_state.rb - def change - add_column :dast_site_validations, :state, :text, default: :pending, null: false - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb b/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb deleted file mode 100644 index 18bf7ee4bdc..00000000000 --- a/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToDastSiteValidationState < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :dast_site_validations, :state, 255 - end - - def down - remove_text_limit :dast_site_validations, :state - end -end diff --git a/db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb b/db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb deleted file mode 100644 index 4d611a56e9c..00000000000 --- a/db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddExpirationPolicyCleanupStatusToContainerRepositories < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'idx_container_repositories_on_exp_cleanup_status_and_start_date' - - disable_ddl_transaction! - - def up - unless column_exists?(:container_repositories, :expiration_policy_cleanup_status) - add_column(:container_repositories, :expiration_policy_cleanup_status, :integer, limit: 2, default: 0, null: false) - end - - add_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :expiration_policy_started_at], name: INDEX_NAME) - end - - def down - remove_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :expiration_policy_started_at], name: INDEX_NAME) - - if column_exists?(:container_repositories, :expiration_policy_cleanup_status) - remove_column(:container_repositories, :expiration_policy_cleanup_status) - end - end -end diff --git a/db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb b/db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb deleted file mode 100644 index b76b826658e..00000000000 --- a/db/migrate/20200928125258_add_foreign_key_to_u2f_reg_id_in_webauthn_regs.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToU2fRegIdInWebauthnRegs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_webauthn_registrations_on_u2f_registration_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :webauthn_registrations, :u2f_registration_id, where: 'u2f_registration_id IS NOT NULL', name: INDEX_NAME - add_concurrent_foreign_key :webauthn_registrations, :u2f_registrations, column: :u2f_registration_id, on_delete: :cascade - end - - def down - remove_foreign_key_if_exists :webauthn_registrations, column: :u2f_registration_id - remove_concurrent_index_by_name(:webauthn_registrations, INDEX_NAME) - end -end diff --git a/db/migrate/20200928131934_create_required_code_owners_sections.rb b/db/migrate/20200928131934_create_required_code_owners_sections.rb deleted file mode 100644 index f2dfd4007e5..00000000000 --- a/db/migrate/20200928131934_create_required_code_owners_sections.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class CreateRequiredCodeOwnersSections < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :required_code_owners_sections, if_not_exists: true do |t| - t.references :protected_branch, null: false, foreign_key: { on_delete: :cascade } - t.text :name, null: false - end - end - - add_text_limit :required_code_owners_sections, :name, 1024 - end - - def down - with_lock_retries do - drop_table :required_code_owners_sections, if_exists: true - end - end -end diff --git a/db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb b/db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb deleted file mode 100644 index 7bfae7377d7..00000000000 --- a/db/migrate/20200928164807_add_index_on_vulnerabilities_state_case.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnVulnerabilitiesStateCase < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_vulnerabilities_on_state_case_id' - STATE_ORDER_ARRAY_POSITION = 'ARRAY_POSITION(ARRAY[1, 4, 3, 2]::smallint[], state)' - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerabilities, "#{STATE_ORDER_ARRAY_POSITION}, id DESC", name: INDEX_NAME - add_concurrent_index :vulnerabilities, "#{STATE_ORDER_ARRAY_POSITION} DESC, id DESC", name: "#{INDEX_NAME}_desc" - end - - def down - remove_concurrent_index_by_name :vulnerabilities, "#{INDEX_NAME}_desc" - remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME - end -end diff --git a/db/migrate/20200928203531_create_alert_management_http_integrations.rb b/db/migrate/20200928203531_create_alert_management_http_integrations.rb deleted file mode 100644 index fe13fe400e3..00000000000 --- a/db/migrate/20200928203531_create_alert_management_http_integrations.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -class CreateAlertManagementHttpIntegrations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - UNIQUE_INDEX = 'index_http_integrations_on_active_and_project_and_endpoint' - - disable_ddl_transaction! - - def up - create_table :alert_management_http_integrations, if_not_exists: true do |t| - t.timestamps_with_timezone - t.bigint :project_id, index: true, null: false - t.boolean :active, null: false, default: false - t.text :encrypted_token, null: false - t.text :encrypted_token_iv, null: false - t.text :endpoint_identifier, null: false - t.text :name, null: false - end - - add_text_limit :alert_management_http_integrations, :encrypted_token, 255 - add_text_limit :alert_management_http_integrations, :encrypted_token_iv, 255 - add_text_limit :alert_management_http_integrations, :endpoint_identifier, 255 - add_text_limit :alert_management_http_integrations, :name, 255 - - add_index :alert_management_http_integrations, - [:active, :project_id, :endpoint_identifier], - unique: true, - name: UNIQUE_INDEX, - where: 'active' - end - - def down - drop_table :alert_management_http_integrations - end -end diff --git a/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb b/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb deleted file mode 100644 index f59a5a0b5bb..00000000000 --- a/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddHttpIntegrationsProjectForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_foreign_key :alert_management_http_integrations, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey - end - end - - def down - with_lock_retries do - remove_foreign_key :alert_management_http_integrations, column: :project_id - end - end -end diff --git a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb deleted file mode 100644 index b5a7bb5e39d..00000000000 --- a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial" - FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial" - - disable_ddl_transaction! - - def up - remove_concurrent_index :terraform_states, :verification_failure, name: FAILURE_INDEX_NAME - remove_concurrent_index :terraform_states, :verification_checksum, name: CHECKSUM_INDEX_NAME - end - - def down - add_concurrent_index :terraform_states, :verification_failure, where: "(verification_failure IS NOT NULL)", name: FAILURE_INDEX_NAME - add_concurrent_index :terraform_states, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: CHECKSUM_INDEX_NAME - end -end diff --git a/db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb b/db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb deleted file mode 100644 index 2848cdf8fcd..00000000000 --- a/db/migrate/20200929032729_add_sla_minutes_to_project_incident_management_settings.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddSlaMinutesToProjectIncidentManagementSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_incident_management_settings, :sla_timer, :boolean, default: false - add_column :project_incident_management_settings, :sla_timer_minutes, :integer - end -end diff --git a/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb b/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb deleted file mode 100644 index 92d82757b79..00000000000 --- a/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddRequireAdminApprovalAfterUserSignupToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :require_admin_approval_after_user_signup, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20200930094812_update_postgres_indexes_view.rb b/db/migrate/20200930094812_update_postgres_indexes_view.rb deleted file mode 100644 index b36ea362e6f..00000000000 --- a/db/migrate/20200930094812_update_postgres_indexes_view.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -class UpdatePostgresIndexesView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - CREATE OR REPLACE VIEW postgres_indexes AS - SELECT - pg_namespace.nspname || '.' || pg_class.relname as identifier, - pg_index.indexrelid, - pg_namespace.nspname as schema, - pg_class.relname as name, - pg_index.indisunique as unique, - pg_index.indisvalid as valid_index, - pg_class.relispartition as partitioned, - pg_index.indisexclusion as exclusion, - pg_indexes.indexdef as definition, - pg_relation_size(pg_class.oid) as ondisk_size_bytes - FROM pg_index - INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid - INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog' - AND pg_namespace.nspname IN ( - current_schema(), - 'gitlab_partitions_dynamic', - 'gitlab_partitions_static' - ) - SQL - end - - def down - execute(<<~SQL) - CREATE OR REPLACE VIEW postgres_indexes AS - SELECT - pg_namespace.nspname || '.' || pg_class.relname as identifier, - pg_index.indexrelid, - pg_namespace.nspname as schema, - pg_class.relname as name, - pg_index.indisunique as unique, - pg_index.indisvalid as valid_index, - pg_class.relispartition as partitioned, - pg_index.indisexclusion as exclusion, - pg_indexes.indexdef as definition, - pg_relation_size(pg_class.oid) as ondisk_size_bytes - FROM pg_index - INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid - INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog' - SQL - end -end diff --git a/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb b/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb deleted file mode 100644 index 19a536f8f6e..00000000000 --- a/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddIndexOnProjectIdAndShaToDeployments < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - INDEX_NAME = 'index_deployments_on_project_id_sha' - - disable_ddl_transaction! - - def up - add_concurrent_index :deployments, [:project_id, :sha], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:deployments, INDEX_NAME) - end -end diff --git a/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb b/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb deleted file mode 100644 index 9be79974ee4..00000000000 --- a/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddApiFuzzingToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, "ci_max_artifact_size_api_fuzzing", :integer, default: 0, null: false - end -end diff --git a/db/migrate/20201002012659_add_issuable_sla_table.rb b/db/migrate/20201002012659_add_issuable_sla_table.rb deleted file mode 100644 index c43187bf93a..00000000000 --- a/db/migrate/20201002012659_add_issuable_sla_table.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddIssuableSlaTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :issuable_slas do |t| - t.references :issue, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } - t.datetime_with_timezone :due_at, null: false - end - end -end diff --git a/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb b/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb deleted file mode 100644 index 73028b6b795..00000000000 --- a/db/migrate/20201004163918_remove_project_id_and_id_index_from_vulnerabilities_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class RemoveProjectIdAndIdIndexFromVulnerabilitiesTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_vulnerabilities_on_project_id_and_id' - - disable_ddl_transaction! - - def up - Gitlab::BackgroundMigration.steal('PopulateResolvedOnDefaultBranchColumn') - remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME - end - - def down - add_concurrent_index :vulnerabilities, [:project_id, :id], name: INDEX_NAME - end -end diff --git a/db/migrate/20201005092703_add_namespace_column_to_frameworks.rb b/db/migrate/20201005092703_add_namespace_column_to_frameworks.rb deleted file mode 100644 index b7a9866e50b..00000000000 --- a/db/migrate/20201005092703_add_namespace_column_to_frameworks.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddNamespaceColumnToFrameworks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'idx_on_compliance_management_frameworks_namespace_id_name' - - disable_ddl_transaction! - - def up - unless column_exists?(:compliance_management_frameworks, :namespace_id) - add_column(:compliance_management_frameworks, :namespace_id, :integer) - end - - add_concurrent_foreign_key(:compliance_management_frameworks, :namespaces, column: :namespace_id, on_delete: :cascade) - add_concurrent_index(:compliance_management_frameworks, [:namespace_id, :name], unique: true, name: INDEX_NAME) - end - - def down - remove_concurrent_index_by_name(:compliance_management_frameworks, INDEX_NAME) - remove_foreign_key_if_exists(:compliance_management_frameworks, :namespaces, column: :namespace_id) - - remove_column(:compliance_management_frameworks, :namespace_id) - end -end diff --git a/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb b/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb deleted file mode 100644 index dcbe48c03f9..00000000000 --- a/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class RemoveComplianceFrameworksGroupIdFk < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_compliance_management_frameworks_on_group_id_and_name' - - class TmpComplianceFramework < ActiveRecord::Base - self.table_name = 'compliance_management_frameworks' - - include EachBatch - end - - disable_ddl_transaction! - - def up - TmpComplianceFramework.each_batch(of: 100) do |query| - query.update_all('namespace_id = group_id') # Copy data in case we rolled back before... - end - - change_column_null(:compliance_management_frameworks, :group_id, true) - - remove_foreign_key_if_exists(:compliance_management_frameworks, :namespaces, column: :group_id) - remove_concurrent_index_by_name(:compliance_management_frameworks, INDEX_NAME) - end - - def down - # This is just to make the rollback possible - TmpComplianceFramework.each_batch(of: 100) do |query| - query.update_all('group_id = namespace_id') # The group_id column is not in used at all - end - - change_column_null(:compliance_management_frameworks, :group_id, false) - - add_concurrent_foreign_key(:compliance_management_frameworks, :namespaces, column: :group_id, on_delete: :cascade) - add_concurrent_index(:compliance_management_frameworks, [:group_id, :name], unique: true, name: INDEX_NAME) - end -end diff --git a/db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb b/db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb deleted file mode 100644 index f9ac12dcfd2..00000000000 --- a/db/migrate/20201005092753_add_framework_id_to_project_framework_settings.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -class AddFrameworkIdToProjectFrameworkSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:project_compliance_framework_settings, :framework_id) - with_lock_retries do - add_column(:project_compliance_framework_settings, :framework_id, :bigint) - end - end - - add_concurrent_index(:project_compliance_framework_settings, :framework_id) - - add_concurrent_foreign_key( - :project_compliance_framework_settings, - :compliance_management_frameworks, - column: :framework_id, - on_delete: :cascade - ) - end - - def down - remove_foreign_key_if_exists(:project_compliance_framework_settings, :compliance_management_frameworks, column: :framework_id) - - with_lock_retries do - remove_column(:project_compliance_framework_settings, :framework_id) - end - end -end diff --git a/db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb b/db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb deleted file mode 100644 index f88bd177b98..00000000000 --- a/db/migrate/20201006014605_add_automatic_purchased_storage_allocation_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddAutomaticPurchasedStorageAllocationToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :automatic_purchased_storage_allocation, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20201007033527_add_daily_invites_to_plan_limits.rb b/db/migrate/20201007033527_add_daily_invites_to_plan_limits.rb deleted file mode 100644 index 8f0079cd639..00000000000 --- a/db/migrate/20201007033527_add_daily_invites_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDailyInvitesToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:plan_limits, :daily_invites, :integer, default: 0, null: false) - end -end diff --git a/db/migrate/20201007033723_insert_daily_invites_plan_limits.rb b/db/migrate/20201007033723_insert_daily_invites_plan_limits.rb deleted file mode 100644 index dcdcbbb0964..00000000000 --- a/db/migrate/20201007033723_insert_daily_invites_plan_limits.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class InsertDailyInvitesPlanLimits < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - return unless Gitlab.com? - - create_or_update_plan_limit('daily_invites', 'free', 20) - create_or_update_plan_limit('daily_invites', 'bronze', 0) - create_or_update_plan_limit('daily_invites', 'silver', 0) - create_or_update_plan_limit('daily_invites', 'gold', 0) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('daily_invites', 'free', 0) - create_or_update_plan_limit('daily_invites', 'bronze', 0) - create_or_update_plan_limit('daily_invites', 'silver', 0) - create_or_update_plan_limit('daily_invites', 'gold', 0) - end -end diff --git a/db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb b/db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb deleted file mode 100644 index fdef5e2f52a..00000000000 --- a/db/migrate/20201007115209_add_lock_version_to_ci_build_trace_chunk.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddLockVersionToCiBuildTraceChunk < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :ci_build_trace_chunks, :lock_version, :integer, default: 0, null: false - end -end diff --git a/db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb b/db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb deleted file mode 100644 index c51f7e8b706..00000000000 --- a/db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddCiJwtSigningKeyToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20201001011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv - def change - add_column :application_settings, :encrypted_ci_jwt_signing_key, :text - add_column :application_settings, :encrypted_ci_jwt_signing_key_iv, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb b/db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb deleted file mode 100644 index 39f6eb2106a..00000000000 --- a/db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToApplicationSettingsEncryptedCiJwtSigningKeyIv < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :encrypted_ci_jwt_signing_key_iv, 255 - end - - def down - remove_text_limit :application_settings, :encrypted_ci_jwt_signing_key_iv - end -end diff --git a/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb b/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb deleted file mode 100644 index 5d7b6349fe6..00000000000 --- a/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class GenerateCiJwtSigningKey < ActiveRecord::Migration[6.0] - DOWNTIME = false - - class ApplicationSetting < ActiveRecord::Base - self.table_name = 'application_settings' - - attr_encrypted :ci_jwt_signing_key, { - mode: :per_attribute_iv, - key: Gitlab::Utils.ensure_utf8_size(Rails.application.secrets.db_key_base, bytes: 32.bytes), - algorithm: 'aes-256-gcm', - encode: true - } - end - - def up - ApplicationSetting.reset_column_information - - ApplicationSetting.find_each do |application_setting| - application_setting.update(ci_jwt_signing_key: OpenSSL::PKey::RSA.new(2048).to_pem) - end - end - - def down - ApplicationSetting.reset_column_information - - ApplicationSetting.find_each do |application_setting| - application_setting.update_columns(encrypted_ci_jwt_signing_key: nil, encrypted_ci_jwt_signing_key_iv: nil) - end - end -end diff --git a/db/migrate/20201008075620_add_releases_events_to_web_hooks.rb b/db/migrate/20201008075620_add_releases_events_to_web_hooks.rb deleted file mode 100644 index f6df213f162..00000000000 --- a/db/migrate/20201008075620_add_releases_events_to_web_hooks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddReleasesEventsToWebHooks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :web_hooks, :releases_events, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20201008125643_create_csv_issue_imports.rb b/db/migrate/20201008125643_create_csv_issue_imports.rb deleted file mode 100644 index be3206af6d8..00000000000 --- a/db/migrate/20201008125643_create_csv_issue_imports.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreateCsvIssueImports < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - create_table :csv_issue_imports do |t| - t.bigint :project_id, null: false, index: true - t.bigint :user_id, null: false, index: true - - t.timestamps_with_timezone - end - end - - def down - drop_table :csv_issue_imports - end -end diff --git a/db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb b/db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb deleted file mode 100644 index 45c411fc238..00000000000 --- a/db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class SetRegexDefaultsOnContainerExpirationPolicies < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :container_expiration_policies, :name_regex, '.*' - change_column_default :container_expiration_policies, :enabled, false - end - end - - def down - with_lock_retries do - change_column_default :container_expiration_policies, :name_regex, nil - change_column_default :container_expiration_policies, :enabled, true - end - end -end diff --git a/db/migrate/20201008224441_add_position_into_security_findings.rb b/db/migrate/20201008224441_add_position_into_security_findings.rb deleted file mode 100644 index ee6d5370f83..00000000000 --- a/db/migrate/20201008224441_add_position_into_security_findings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPositionIntoSecurityFindings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :security_findings, :position, :integer - end - end - - def down - with_lock_retries do - remove_column :security_findings, :position - end - end -end diff --git a/db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb b/db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb deleted file mode 100644 index ec44d5ddcef..00000000000 --- a/db/migrate/20201009090954_add_index_with_project_id_to_container_expiration_policies.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexWithProjectIdToContainerExpirationPolicies < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'idx_container_exp_policies_on_project_id_next_run_at_enabled' - - disable_ddl_transaction! - - def up - add_concurrent_index :container_expiration_policies, [:project_id, :next_run_at, :enabled], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :container_expiration_policies, INDEX_NAME - end -end diff --git a/db/migrate/20201011005400_add_text_limit_to_application_settings_kroki_url.rb b/db/migrate/20201011005400_add_text_limit_to_application_settings_kroki_url.rb deleted file mode 100644 index 96427cc3454..00000000000 --- a/db/migrate/20201011005400_add_text_limit_to_application_settings_kroki_url.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToApplicationSettingsKrokiUrl < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :kroki_url, 1024 - end - - def down - # Down is required as `add_text_limit` is not reversible - # - remove_text_limit :application_settings, :kroki_url - end -end diff --git a/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb b/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb deleted file mode 100644 index b8cc8984575..00000000000 --- a/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class RemoveNotNullConstraintOnFramework < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - GDPR_FRAMEWORK_ID = 1 - - disable_ddl_transaction! - - class TmpComplianceProjectFrameworkSetting < ActiveRecord::Base - self.table_name = 'project_compliance_framework_settings' - self.primary_key = :project_id - - include EachBatch - end - - def up - change_column_null :project_compliance_framework_settings, :framework, true - end - - def down - # Custom frameworks cannot be rolled back easily since we don't have enum for them. - # To make the database consistent, we mark them as GDPR framework. - # Note: framework customization will be implemented in the next 1-3 releases so data - # corruption due to the rollback is unlikely. - TmpComplianceProjectFrameworkSetting.each_batch(of: 100) do |query| - query.where(framework: nil).update_all(framework: GDPR_FRAMEWORK_ID) - end - - change_column_null :project_compliance_framework_settings, :framework, false - end -end diff --git a/db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb b/db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb deleted file mode 100644 index e4f7d1309a3..00000000000 --- a/db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddContainerRegistryExpirationPoliciesWorkerCapacityConstraint < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - CONSTRAINT_NAME = 'app_settings_registry_exp_policies_worker_capacity_positive' - - disable_ddl_transaction! - - def up - add_check_constraint :application_settings, 'container_registry_expiration_policies_worker_capacity >= 0', CONSTRAINT_NAME - end - - def down - remove_check_constraint :application_settings, CONSTRAINT_NAME - end -end diff --git a/db/migrate/20201012134230_create_ci_test_cases.rb b/db/migrate/20201012134230_create_ci_test_cases.rb deleted file mode 100644 index fd1bcaf1093..00000000000 --- a/db/migrate/20201012134230_create_ci_test_cases.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateCiTestCases < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:ci_test_cases) - create_table :ci_test_cases do |t| - t.bigint :project_id, null: false - t.text :key_hash, null: false - - t.index [:project_id, :key_hash], unique: true - # NOTE: FK for projects will be added on a separate migration as per guidelines - end - end - - add_text_limit :ci_test_cases, :key_hash, 64 - end - - def down - drop_table :ci_test_cases - end -end diff --git a/db/migrate/20201012135330_create_ci_test_case_failures.rb b/db/migrate/20201012135330_create_ci_test_case_failures.rb deleted file mode 100644 index 7eaf7b5256d..00000000000 --- a/db/migrate/20201012135330_create_ci_test_case_failures.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class CreateCiTestCaseFailures < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - create_table :ci_test_case_failures do |t| - t.datetime_with_timezone :failed_at - t.bigint :test_case_id, null: false - t.bigint :build_id, null: false - - t.index [:test_case_id, :failed_at, :build_id], name: 'index_test_case_failures_unique_columns', unique: true, order: { failed_at: :desc } - t.index :build_id - t.foreign_key :ci_test_cases, column: :test_case_id, on_delete: :cascade - # NOTE: FK for ci_builds will be added on a separate migration as per guidelines - end - end - - def down - drop_table :ci_test_case_failures - end -end diff --git a/db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb b/db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb deleted file mode 100644 index d30b332e41a..00000000000 --- a/db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddProjectsFkToCiTestCases < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :ci_test_cases, :projects, column: :project_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :ci_test_cases, column: :project_id - end - end -end diff --git a/db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb b/db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb deleted file mode 100644 index 0f2fdf071fa..00000000000 --- a/db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCiBuildsFkToCiTestCaseFailures < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :ci_test_case_failures, :ci_builds, column: :build_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :ci_test_case_failures, column: :build_id - end - end -end diff --git a/db/migrate/20201012194936_create_saml_group_links.rb b/db/migrate/20201012194936_create_saml_group_links.rb deleted file mode 100644 index d47c383afef..00000000000 --- a/db/migrate/20201012194936_create_saml_group_links.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CreateSamlGroupLinks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :saml_group_links, if_not_exists: true do |t| - t.integer :access_level, null: false, limit: 2 - t.references :group, index: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false - t.timestamps_with_timezone - t.text :saml_group_name, null: false - - t.index [:group_id, :saml_group_name], unique: true - end - end - - add_text_limit :saml_group_links, :saml_group_name, 255 - end - - def down - with_lock_retries do - drop_table :saml_group_links - end - end -end diff --git a/db/migrate/20201014163633_specify_primary_key_where_missing.rb b/db/migrate/20201014163633_specify_primary_key_where_missing.rb deleted file mode 100644 index bca111dacf2..00000000000 --- a/db/migrate/20201014163633_specify_primary_key_where_missing.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -class SpecifyPrimaryKeyWhereMissing < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - TABLES = { - project_authorizations: [:index_project_authorizations_on_user_id_project_id_access_level, %i(user_id project_id access_level)], - analytics_language_trend_repository_languages: [:analytics_repository_languages_unique_index, %i(programming_language_id project_id snapshot_date)], - approval_project_rules_protected_branches: [:index_approval_project_rules_protected_branches_unique, %i(approval_project_rule_id protected_branch_id)], - ci_build_trace_sections: [:index_ci_build_trace_sections_on_build_id_and_section_name_id, %i(build_id section_name_id)], - deployment_merge_requests: [:idx_deployment_merge_requests_unique_index, %i(deployment_id merge_request_id)], - issue_assignees: [:index_issue_assignees_on_issue_id_and_user_id, %i(issue_id user_id)], - issues_prometheus_alert_events: [:issue_id_prometheus_alert_event_id_index, %i(issue_id prometheus_alert_event_id)], - issues_self_managed_prometheus_alert_events: [:issue_id_self_managed_prometheus_alert_event_id_index, %i(issue_id self_managed_prometheus_alert_event_id)], - merge_request_diff_commits: [:index_merge_request_diff_commits_on_mr_diff_id_and_order, %i(merge_request_diff_id relative_order)], - merge_request_diff_files: [:index_merge_request_diff_files_on_mr_diff_id_and_order, %i(merge_request_diff_id relative_order)], - milestone_releases: [:index_miletone_releases_on_milestone_and_release, %i(milestone_id release_id)], - project_pages_metadata: [:index_project_pages_metadata_on_project_id, %i(project_id)], - push_event_payloads: [:index_push_event_payloads_on_event_id, %i(event_id)], - repository_languages: [:index_repository_languages_on_project_and_languages_id, %i(project_id programming_language_id)], - user_interacted_projects: [:index_user_interacted_projects_on_project_id_and_user_id, %i(project_id user_id)], - users_security_dashboard_projects: [:users_security_dashboard_projects_unique_index, %i(project_id user_id)] - }.freeze - - def up - TABLES.each do |table, (unique_index, _)| - with_lock_retries do - execute "ALTER TABLE #{table} ADD CONSTRAINT #{table}_pkey PRIMARY KEY USING INDEX #{unique_index}" if index_exists_by_name?(table, unique_index) - end - end - end - - def down - TABLES.each do |table, (unique_index, columns)| - add_concurrent_index table, columns, name: unique_index, unique: true - - with_lock_retries do - execute "ALTER TABLE #{table} DROP CONSTRAINT #{table}_pkey" - end - end - end -end diff --git a/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb b/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb deleted file mode 100644 index c26636444af..00000000000 --- a/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class DropBackfillJiraTrackerDeploymentTypeJobs < ActiveRecord::Migration[6.0] - DOWNTIME = false - DROPPED_JOB_CLASS = 'BackfillJiraTrackerDeploymentType' - QUEUE = 'background_migration' - - def up - sidekiq_queues.each do |queue| - queue.each do |job| - next unless job.args.first == DROPPED_JOB_CLASS - - job.delete - end - end - end - - def down - # no-op - end - - def sidekiq_queues - [Sidekiq::ScheduledSet.new, Sidekiq::RetrySet.new, Sidekiq::Queue.new(QUEUE)] - end -end diff --git a/db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb b/db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb deleted file mode 100644 index 9476d2d55bd..00000000000 --- a/db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddProjectForeignKeyToCsvIssueImports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :csv_issue_imports, :projects, column: :project_id - end - - def down - with_lock_retries do - remove_foreign_key :csv_issue_imports, column: :project_id - end - end -end diff --git a/db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb b/db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb deleted file mode 100644 index ae91695bff4..00000000000 --- a/db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddUserForeignKeyToCsvIssueImports < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :csv_issue_imports, :users, column: :user_id - end - - def down - with_lock_retries do - remove_foreign_key :csv_issue_imports, column: :user_id - end - end -end diff --git a/db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb b/db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb deleted file mode 100644 index 785d7c8829c..00000000000 --- a/db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnStateForDastSiteValidations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - OLD_INDEX_NAME = 'index_dast_site_validations_on_url_base' - NEW_INDEX_NAME = 'index_dast_site_validations_on_url_base_and_state' - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :dast_site_validations, [:url_base, :state], name: NEW_INDEX_NAME - remove_concurrent_index_by_name :dast_site_validations, OLD_INDEX_NAME - end - - def down - add_concurrent_index :dast_site_validations, :url_base, name: OLD_INDEX_NAME - remove_concurrent_index_by_name :dast_site_validations, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb b/db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb deleted file mode 100644 index 539b2af5fc4..00000000000 --- a/db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -class AddCiBuildIdToTerraformStateVersions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_terraform_state_versions_on_ci_build_id' - - disable_ddl_transaction! - - def up - unless column_exists?(:terraform_state_versions, :ci_build_id) - add_column :terraform_state_versions, :ci_build_id, :bigint - end - - add_concurrent_index :terraform_state_versions, :ci_build_id, name: INDEX_NAME - add_concurrent_foreign_key :terraform_state_versions, :ci_builds, column: :ci_build_id, on_delete: :nullify - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :terraform_state_versions, :ci_builds, column: :ci_build_id - end - - remove_concurrent_index_by_name :terraform_state_versions, INDEX_NAME - remove_column :terraform_state_versions, :ci_build_id - end -end diff --git a/db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb b/db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb deleted file mode 100644 index b2e7c62ba0c..00000000000 --- a/db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexProjectIdAndIdToContainerRepositories < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_container_repositories_on_project_id_and_id' - - disable_ddl_transaction! - - def up - add_concurrent_index(:container_repositories, [:project_id, :id], name: INDEX_NAME) - end - - def down - remove_concurrent_index(:container_repositories, [:project_id, :id], name: INDEX_NAME) - end -end diff --git a/db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb b/db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb deleted file mode 100644 index 3303e41d8a1..00000000000 --- a/db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddUniqueIndexOnScanIdAndPositionOfSecurityFindings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_security_findings_on_scan_id_and_position' - - disable_ddl_transaction! - - def up - add_concurrent_index :security_findings, [:scan_id, :position], unique: true, name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :security_findings, INDEX_NAME - end -end diff --git a/db/migrate/20201019101549_add_es_custom_analyzers_settings.rb b/db/migrate/20201019101549_add_es_custom_analyzers_settings.rb deleted file mode 100644 index 47fd9ebbb8e..00000000000 --- a/db/migrate/20201019101549_add_es_custom_analyzers_settings.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddEsCustomAnalyzersSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :elasticsearch_analyzers_smartcn_enabled, :bool, null: false, default: false - add_column :application_settings, :elasticsearch_analyzers_smartcn_search, :bool, null: false, default: false - add_column :application_settings, :elasticsearch_analyzers_kuromoji_enabled, :bool, null: false, default: false - add_column :application_settings, :elasticsearch_analyzers_kuromoji_search, :bool, null: false, default: false - end -end diff --git a/db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb b/db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb deleted file mode 100644 index 1921701626d..00000000000 --- a/db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddSha256AndFilecountToPagesDeployments < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - # pages_deployments were never enabled on any production/staging - # environments, so we safely delete them for people who enabled - # them locally - execute "DELETE FROM pages_deployments" - - # rubocop:disable Rails/NotNullColumn - add_column :pages_deployments, :file_count, :integer, null: false - add_column :pages_deployments, :file_sha256, :binary, null: false - # rubocop:enable Rails/NotNullColumn - end - - def down - remove_column :pages_deployments, :file_sha256 - remove_column :pages_deployments, :file_count - end -end diff --git a/db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb b/db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb deleted file mode 100644 index 8754b0d481e..00000000000 --- a/db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddNewUserSignupsCapToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :new_user_signups_cap, :integer - end -end diff --git a/db/migrate/20201019130244_remove_license_compliance_temp_index.rb b/db/migrate/20201019130244_remove_license_compliance_temp_index.rb deleted file mode 100644 index d0383d999ed..00000000000 --- a/db/migrate/20201019130244_remove_license_compliance_temp_index.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class RemoveLicenseComplianceTempIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_job_artifacts_on_license_compliance_file_types' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :ci_job_artifacts, name: INDEX_NAME - end - - def down - add_concurrent_index :ci_job_artifacts, [:job_id, :file_type], where: 'file_type = 10 OR file_type = 101', name: INDEX_NAME - end -end diff --git a/db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb b/db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb deleted file mode 100644 index 8a0051b8106..00000000000 --- a/db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultBranchToDailyBuildGroupReportResult < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - add_column :ci_daily_build_group_report_results, :default_branch, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20201019161924_add_partitioned_table_view.rb b/db/migrate/20201019161924_add_partitioned_table_view.rb deleted file mode 100644 index 45bbfda40ff..00000000000 --- a/db/migrate/20201019161924_add_partitioned_table_view.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -class AddPartitionedTableView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - CREATE OR REPLACE VIEW postgres_partitioned_tables AS - SELECT - pg_namespace.nspname::text || '.'::text || pg_class.relname::text AS identifier, - pg_class.oid AS oid, - pg_namespace.nspname AS schema, - pg_class.relname AS name, - CASE partitioned_tables.partstrat - WHEN 'l' THEN 'list' - WHEN 'r' THEN 'range' - WHEN 'h' THEN 'hash' - END as strategy, - array_agg(pg_attribute.attname) as key_columns - FROM ( - SELECT - partrelid, - partstrat, - unnest(partattrs) as column_position - FROM pg_partitioned_table - ) partitioned_tables - INNER JOIN pg_class - ON partitioned_tables.partrelid = pg_class.oid - INNER JOIN pg_namespace - ON pg_class.relnamespace = pg_namespace.oid - INNER JOIN pg_attribute - ON pg_attribute.attrelid = pg_class.oid - AND pg_attribute.attnum = partitioned_tables.column_position - WHERE pg_namespace.nspname = current_schema() - GROUP BY identifier, pg_class.oid, schema, name, strategy; - SQL - end - - def down - execute(<<~SQL) - DROP VIEW IF EXISTS postgres_partitioned_tables - SQL - end -end diff --git a/db/migrate/20201019172704_add_partitions_view.rb b/db/migrate/20201019172704_add_partitions_view.rb deleted file mode 100644 index 991d137faf3..00000000000 --- a/db/migrate/20201019172704_add_partitions_view.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class AddPartitionsView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - CREATE OR REPLACE VIEW postgres_partitions AS - SELECT - pg_namespace.nspname::text || '.'::text || pg_class.relname::text AS identifier, - pg_class.oid AS oid, - pg_namespace.nspname AS schema, - pg_class.relname AS name, - parent_namespace.nspname::text || '.'::text || parent_class.relname::text AS parent_identifier, - pg_get_expr(pg_class.relpartbound, pg_inherits.inhrelid) AS condition - FROM pg_class - INNER JOIN pg_namespace - ON pg_namespace.oid = pg_class.relnamespace - INNER JOIN pg_inherits - ON pg_class.oid = pg_inherits.inhrelid - INNER JOIN pg_class parent_class - ON pg_inherits.inhparent = parent_class.oid - INNER JOIN pg_namespace parent_namespace - ON parent_class.relnamespace = parent_namespace.oid - WHERE pg_class.relispartition - AND pg_namespace.nspname IN ( - current_schema(), - 'gitlab_partitions_dynamic', - 'gitlab_partitions_static' - ) - SQL - end - - def down - execute(<<~SQL) - DROP VIEW IF EXISTS postgres_partitions - SQL - end -end diff --git a/db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb b/db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb deleted file mode 100644 index 3e322675ba6..00000000000 --- a/db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CreateAnalyticsDevopsAdoptionSegments < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :analytics_devops_adoption_segments, if_not_exists: true do |t| - t.text :name, null: false, index: { unique: true } - t.datetime_with_timezone :last_recorded_at - - t.timestamps_with_timezone - end - - add_text_limit :analytics_devops_adoption_segments, :name, 255 - end - - def down - drop_table :analytics_devops_adoption_segments - end -end diff --git a/db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb b/db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb deleted file mode 100644 index cf65c7500c5..00000000000 --- a/db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexRouteOnNameTrigramToRoute < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_route_on_name_trigram' - - disable_ddl_transaction! - - def up - add_concurrent_index :routes, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops } - end - - def down - remove_concurrent_index_by_name(:routes, INDEX_NAME) - end -end diff --git a/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb b/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb deleted file mode 100644 index c5aac7a82a5..00000000000 --- a/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class CreateAnalyticsDevopsAdoptionSegmentSelections < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :analytics_devops_adoption_segment_selections do |t| - t.references :segment, index: { name: 'index_on_segment_selections_segment_id' }, null: false, foreign_key: { to_table: :analytics_devops_adoption_segments, on_delete: :cascade } - t.bigint :group_id - t.bigint :project_id - t.index [:group_id, :segment_id], unique: true, name: 'index_on_segment_selections_group_id_segment_id' - t.index [:project_id, :segment_id], unique: true, name: 'index_on_segment_selections_project_id_segment_id' - - t.timestamps_with_timezone - end - end -end diff --git a/db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb b/db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb deleted file mode 100644 index 651770e059c..00000000000 --- a/db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyProjectIdToSegmentSelection < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key(:analytics_devops_adoption_segment_selections, :projects, column: :project_id, on_delete: :cascade) - end - - def down - with_lock_retries do - remove_foreign_key :analytics_devops_adoption_segment_selections, column: :project_id - end - end -end diff --git a/db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb b/db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb deleted file mode 100644 index 3ee73ee3a64..00000000000 --- a/db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyGroupIdToSegmentSelection < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key(:analytics_devops_adoption_segment_selections, :namespaces, column: :group_id, on_delete: :cascade) - end - - def down - with_lock_retries do - remove_foreign_key :analytics_devops_adoption_segment_selections, column: :group_id - end - end -end diff --git a/db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb b/db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb deleted file mode 100644 index 68fec36aa8a..00000000000 --- a/db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddCheckConstraintToSegmentSelection < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - CONSTRAINT_NAME = 'segment_selection_project_id_or_group_id_required' - - def up - add_check_constraint :analytics_devops_adoption_segment_selections, '(project_id != NULL AND group_id IS NULL) OR (group_id != NULL AND project_id IS NULL)', CONSTRAINT_NAME - end - - def down - remove_check_constraint :analytics_devops_adoption_segment_selections, CONSTRAINT_NAME - end -end diff --git a/db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb b/db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb deleted file mode 100644 index c811e3deeda..00000000000 --- a/db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToCiDailyBuildGroupReportResults < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_ci_daily_build_group_report_results_on_project_and_date' - - disable_ddl_transaction! - - def up - add_concurrent_index( - :ci_daily_build_group_report_results, - [:project_id, :date], - order: { date: :desc }, - where: "default_branch = TRUE AND (data -> 'coverage') IS NOT NULL", - name: INDEX_NAME - ) - end - - def down - remove_concurrent_index_by_name(:ci_daily_build_group_report_results, INDEX_NAME) - end -end diff --git a/db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb b/db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb deleted file mode 100644 index 6334dcd8c1a..00000000000 --- a/db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddSecretDetectionTokenRevocationApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :application_settings, :secret_detection_token_revocation_enabled, :boolean, default: false, null: false - add_column :application_settings, :secret_detection_token_revocation_url, :text, null: true # rubocop:disable Migration/AddLimitToTextColumns - - add_column :application_settings, :encrypted_secret_detection_token_revocation_token, :text - add_column :application_settings, :encrypted_secret_detection_token_revocation_token_iv, :text - end - - def down - remove_column :application_settings, :secret_detection_token_revocation_enabled - remove_column :application_settings, :secret_detection_token_revocation_url - - remove_column :application_settings, :encrypted_secret_detection_token_revocation_token - remove_column :application_settings, :encrypted_secret_detection_token_revocation_token_iv - end -end diff --git a/db/migrate/20201021155606_add_analytics_access_level_to_project_features.rb b/db/migrate/20201021155606_add_analytics_access_level_to_project_features.rb deleted file mode 100644 index faedbced06b..00000000000 --- a/db/migrate/20201021155606_add_analytics_access_level_to_project_features.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddAnalyticsAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_features, :analytics_access_level, :integer, default: 20, null: false - end - end - - def down - with_lock_retries do - remove_column :project_features, :analytics_access_level, :integer - end - end -end diff --git a/db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb b/db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb deleted file mode 100644 index ea5e12322d0..00000000000 --- a/db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToSecretDetectionTokenRevocationApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :secret_detection_token_revocation_url, 255 - end - - def down - remove_text_limit :application_settings, :secret_detection_token_revocation_url - end -end diff --git a/db/migrate/20201021220101_add_merge_trains_enabled.rb b/db/migrate/20201021220101_add_merge_trains_enabled.rb deleted file mode 100644 index 88a71897435..00000000000 --- a/db/migrate/20201021220101_add_merge_trains_enabled.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddMergeTrainsEnabled < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: false - end -end diff --git a/db/migrate/20201022080802_add_repository_read_only_to_snippets.rb b/db/migrate/20201022080802_add_repository_read_only_to_snippets.rb deleted file mode 100644 index d0cb329fb02..00000000000 --- a/db/migrate/20201022080802_add_repository_read_only_to_snippets.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddRepositoryReadOnlyToSnippets < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :snippets, :repository_read_only, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20201022094845_add_historical_data_recorded_at.rb b/db/migrate/20201022094845_add_historical_data_recorded_at.rb deleted file mode 100644 index c90889e2d38..00000000000 --- a/db/migrate/20201022094845_add_historical_data_recorded_at.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddHistoricalDataRecordedAt < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column(:historical_data, :recorded_at, :timestamptz) - end - - def down - remove_column(:historical_data, :recorded_at) - end -end diff --git a/db/migrate/20201022094846_update_historical_data_recorded_at.rb b/db/migrate/20201022094846_update_historical_data_recorded_at.rb deleted file mode 100644 index bd1889149bb..00000000000 --- a/db/migrate/20201022094846_update_historical_data_recorded_at.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class UpdateHistoricalDataRecordedAt < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - update_value = Arel.sql("COALESCE(created_at, date + '12:00'::time AT TIME ZONE '#{Time.zone&.tzinfo&.name || "Etc/UTC"}')") - - update_column_in_batches(:historical_data, :recorded_at, update_value) do |table, query| - query.where(table[:recorded_at].eq(nil)) - end - - add_not_null_constraint :historical_data, :recorded_at - - change_column_null :historical_data, :date, true - end - - def down - change_column_null :historical_data, :date, false - - remove_not_null_constraint :historical_data, :recorded_at - - update_column_in_batches(:historical_data, :recorded_at, nil) do |table, query| - query.where(table[:recorded_at].not_eq(nil)) - end - end -end diff --git a/db/migrate/20201022103304_add_availability_to_user_statuses.rb b/db/migrate/20201022103304_add_availability_to_user_statuses.rb deleted file mode 100644 index 9144c81fcfb..00000000000 --- a/db/migrate/20201022103304_add_availability_to_user_statuses.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddAvailabilityToUserStatuses < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :user_statuses, :availability, :integer, limit: 2, default: 0, null: false - end -end diff --git a/db/migrate/20201022144501_create_snippet_repository_storage_move.rb b/db/migrate/20201022144501_create_snippet_repository_storage_move.rb deleted file mode 100644 index 7db38191942..00000000000 --- a/db/migrate/20201022144501_create_snippet_repository_storage_move.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class CreateSnippetRepositoryStorageMove < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:snippet_repository_storage_moves) - with_lock_retries do - create_table :snippet_repository_storage_moves do |t| - t.timestamps_with_timezone - t.references :snippet, index: true, null: false, foreign_key: { on_delete: :cascade } - t.integer :state, limit: 2, default: 1, null: false - t.text :source_storage_name, null: false - t.text :destination_storage_name, null: false - end - end - end - - add_text_limit(:snippet_repository_storage_moves, :source_storage_name, 255, constraint_name: 'snippet_repository_storage_moves_source_storage_name') - add_text_limit(:snippet_repository_storage_moves, :destination_storage_name, 255, constraint_name: 'snippet_repository_storage_moves_destination_storage_name') - end - - def down - with_lock_retries do - drop_table :snippet_repository_storage_moves - end - end -end diff --git a/db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb b/db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb deleted file mode 100644 index bb2d683c4e2..00000000000 --- a/db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddHasVulnerabilitiesIntoProjectSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_settings, :has_vulnerabilities, :boolean, default: false, null: false - end - end - - def down - with_lock_retries do - remove_column :project_settings, :has_vulnerabilities - end - end -end diff --git a/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb b/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb deleted file mode 100644 index 57247bd0f22..00000000000 --- a/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class IndexProjectSettingsOnProjectIdPartially < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_project_settings_on_project_id_partially' - - disable_ddl_transaction! - - def up - add_concurrent_index :project_settings, :project_id, name: INDEX_NAME, where: 'has_vulnerabilities IS TRUE' - end - - def down - remove_concurrent_index_by_name :project_settings, INDEX_NAME - end -end diff --git a/db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb b/db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb deleted file mode 100644 index f63738682b1..00000000000 --- a/db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class CreateMergeRequestCleanupSchedules < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :merge_request_cleanup_schedules, id: false do |t| - t.references :merge_request, primary_key: true, index: { unique: true }, null: false, foreign_key: { on_delete: :cascade } - t.datetime_with_timezone :scheduled_at, null: false - t.datetime_with_timezone :completed_at, null: true - - t.timestamps_with_timezone - - t.index :scheduled_at, where: 'completed_at IS NULL', name: 'index_mr_cleanup_schedules_timestamps' - end - end - end - - def down - with_lock_retries do - drop_table :merge_request_cleanup_schedules - end - end -end diff --git a/db/migrate/20201026200736_seed_merge_trains_enabled.rb b/db/migrate/20201026200736_seed_merge_trains_enabled.rb deleted file mode 100644 index c22c2a408bc..00000000000 --- a/db/migrate/20201026200736_seed_merge_trains_enabled.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class SeedMergeTrainsEnabled < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - update_column_in_batches(:project_ci_cd_settings, :merge_trains_enabled, true) do |table, query| - query.where(table[:merge_pipelines_enabled].eq(true)) - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20201027002551_migrate_services_to_http_integrations.rb b/db/migrate/20201027002551_migrate_services_to_http_integrations.rb deleted file mode 100644 index 5fe05320862..00000000000 --- a/db/migrate/20201027002551_migrate_services_to_http_integrations.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -class MigrateServicesToHttpIntegrations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - ALERT_SERVICE_TYPE = 'AlertsService' - SERVICE_NAMES_IDENTIFIER = { - name: 'HTTP endpoint', - identifier: 'legacy' - } - - class HttpIntegration < ActiveRecord::Base - self.table_name = 'alert_management_http_integrations' - end - - # For each Alerts service, - # Create the matching HttpIntegration - def up - HttpIntegration.reset_column_information - - sql = <<~SQL - SELECT * FROM services - JOIN alerts_service_data - ON (services.id = alerts_service_data.service_id) - WHERE type = '#{ALERT_SERVICE_TYPE}' - AND active = TRUE - SQL - - current_time = Time.current - - values = select_all(sql).map do |alerts_service| - { - project_id: alerts_service['project_id'], - name: SERVICE_NAMES_IDENTIFIER[:name], - endpoint_identifier: SERVICE_NAMES_IDENTIFIER[:identifier], - encrypted_token: alerts_service['encrypted_token'], - encrypted_token_iv: alerts_service['encrypted_token_iv'], - active: alerts_service['active'], - updated_at: current_time, - created_at: current_time - } - end - - HttpIntegration.insert_all(values) if values.present? - end - - def down - # no-op - end -end diff --git a/db/migrate/20201027101010_create_user_follow_users.rb b/db/migrate/20201027101010_create_user_follow_users.rb deleted file mode 100644 index 7c1f831f3b2..00000000000 --- a/db/migrate/20201027101010_create_user_follow_users.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CreateUserFollowUsers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - execute <<~SQL - CREATE TABLE user_follow_users ( - follower_id integer not null references users (id) on delete cascade, - followee_id integer not null references users (id) on delete cascade, - PRIMARY KEY (follower_id, followee_id) - ); - CREATE INDEX ON user_follow_users (followee_id); - SQL - end - end - - def down - drop_table :user_follow_users - end -end diff --git a/db/migrate/20201027135651_add_auto_rollback_setting.rb b/db/migrate/20201027135651_add_auto_rollback_setting.rb deleted file mode 100644 index 8e916ac9d36..00000000000 --- a/db/migrate/20201027135651_add_auto_rollback_setting.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddAutoRollbackSetting < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_ci_cd_settings, :auto_rollback_enabled, :boolean, default: false, null: false - end - end - - def down - with_lock_retries do - remove_column :project_ci_cd_settings, :auto_rollback_enabled - end - end -end diff --git a/db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb b/db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb deleted file mode 100644 index 035d2fb4386..00000000000 --- a/db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToOauthAccessGrantsResourceOwnerId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_oauth_access_grants_on_resource_owner_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :oauth_access_grants, %i[resource_owner_id application_id created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :oauth_access_grants, INDEX_NAME - end -end diff --git a/db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb b/db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb deleted file mode 100644 index 92d9025706f..00000000000 --- a/db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class IncreaseDefaultDiffMaxPatchBytes < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_default(:application_settings, :diff_max_patch_bytes, from: 102400, to: 204800) - end -end diff --git a/db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb b/db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb deleted file mode 100644 index 05bb75be75a..00000000000 --- a/db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddTemporaryIndexToVulnerabilitiesTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'temporary_index_vulnerabilities_on_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerabilities, :id, where: "state = 2 AND (dismissed_at IS NULL OR dismissed_by_id IS NULL)", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME - end -end diff --git a/db/migrate/20201028184640_add_helm_major_version_to_clusters.rb b/db/migrate/20201028184640_add_helm_major_version_to_clusters.rb deleted file mode 100644 index 2169fd41826..00000000000 --- a/db/migrate/20201028184640_add_helm_major_version_to_clusters.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddHelmMajorVersionToClusters < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:clusters, :helm_major_version, :integer, default: 2, null: false) - end -end diff --git a/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb b/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb deleted file mode 100644 index 11d47904e67..00000000000 --- a/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class MigrateDefaultDiffMaxPatchBytesToMinimum200kb < ActiveRecord::Migration[6.0] - DOWNTIME = false - MAX_SIZE = 200.kilobytes - - class ApplicationSetting < ActiveRecord::Base - self.table_name = 'application_settings' - end - - def up - table = ApplicationSetting.arel_table - ApplicationSetting.where(table[:diff_max_patch_bytes].lt(MAX_SIZE)).update_all(diff_max_patch_bytes: MAX_SIZE) - end - - def down - table = ApplicationSetting.arel_table - ApplicationSetting.where(table[:diff_max_patch_bytes].eq(MAX_SIZE)).update_all(diff_max_patch_bytes: 100.kilobytes) - end -end diff --git a/db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb b/db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb deleted file mode 100644 index 2d96da91069..00000000000 --- a/db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class RenameApplicationSettingsToAllowDenyNames < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - rename_column_concurrently :application_settings, :domain_blacklist_enabled, :domain_denylist_enabled - rename_column_concurrently :application_settings, :domain_blacklist, :domain_denylist - rename_column_concurrently :application_settings, :domain_whitelist, :domain_allowlist - end - - def down - undo_rename_column_concurrently :application_settings, :domain_blacklist_enabled, :domain_denylist_enabled - undo_rename_column_concurrently :application_settings, :domain_blacklist, :domain_denylist - undo_rename_column_concurrently :application_settings, :domain_whitelist, :domain_allowlist - end -end diff --git a/db/migrate/20201029144444_create_vulnerability_finding_links.rb b/db/migrate/20201029144444_create_vulnerability_finding_links.rb deleted file mode 100644 index 225a2de6e19..00000000000 --- a/db/migrate/20201029144444_create_vulnerability_finding_links.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityFindingLinks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :vulnerability_finding_links, if_not_exists: true do |t| - t.timestamps_with_timezone null: false - t.references :vulnerability_occurrence, index: { name: 'finding_links_on_vulnerability_occurrence_id' }, null: false, foreign_key: { on_delete: :cascade } - t.text :name - t.text :url, null: false - end - - add_text_limit :vulnerability_finding_links, :name, 255 - add_text_limit :vulnerability_finding_links, :url, 2048 - end - - def down - drop_table :vulnerability_finding_links - end -end diff --git a/db/migrate/20201029144524_add_index_to_releases.rb b/db/migrate/20201029144524_add_index_to_releases.rb deleted file mode 100644 index fbffa1453af..00000000000 --- a/db/migrate/20201029144524_add_index_to_releases.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToReleases < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_releases_on_released_at' - - disable_ddl_transaction! - - def up - add_concurrent_index :releases, :released_at, name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :releases, INDEX_NAME - end -end diff --git a/db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb b/db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb deleted file mode 100644 index e4ba7b2adb9..00000000000 --- a/db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddRequirementsAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - unless column_exists?(:project_features, :requirements_access_level) - with_lock_retries { add_column :project_features, :requirements_access_level, :integer, default: 20, null: false } - end - end - - def down - if column_exists?(:project_features, :requirements_access_level) - with_lock_retries { remove_column :project_features, :requirements_access_level } - end - end -end diff --git a/db/migrate/20201030200115_add_iid_to_design_management_design.rb b/db/migrate/20201030200115_add_iid_to_design_management_design.rb deleted file mode 100644 index c31cd86d5e2..00000000000 --- a/db/migrate/20201030200115_add_iid_to_design_management_design.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddIidToDesignManagementDesign < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :design_management_designs, :iid, :integer - end -end diff --git a/db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb b/db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb deleted file mode 100644 index 3ff50c299cb..00000000000 --- a/db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnDesignManagementDesignsIidProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_design_management_designs_on_iid_and_project_id' - - def up - add_concurrent_index :design_management_designs, [:project_id, :iid], - name: INDEX_NAME, - unique: true - end - - def down - remove_concurrent_index_by_name :design_management_designs, INDEX_NAME - end -end diff --git a/db/migrate/20201030223933_add_ci_pipeline_deployments_to_plan_limits.rb b/db/migrate/20201030223933_add_ci_pipeline_deployments_to_plan_limits.rb deleted file mode 100644 index 60f0ff9d6ed..00000000000 --- a/db/migrate/20201030223933_add_ci_pipeline_deployments_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddCiPipelineDeploymentsToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :ci_pipeline_deployments, :integer, default: 500, null: false - end -end diff --git a/db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb b/db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb deleted file mode 100644 index 1fd900002c3..00000000000 --- a/db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToIncidentIssuesOnProjectAndCreatedAt < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - INCIDENT_TYPE = 1 - OLD_INDEX_NAME = 'index_issues_project_id_issue_type_incident' - NEW_INDEX_NAME = 'index_issues_on_project_id_and_created_at_issue_type_incident' - - DOWNTIME = false - disable_ddl_transaction! - - def up - add_concurrent_index :issues, - [:project_id, :created_at], - where: "issue_type = #{INCIDENT_TYPE}", - name: NEW_INDEX_NAME - - remove_concurrent_index_by_name :issues, OLD_INDEX_NAME - end - - def down - add_concurrent_index :issues, - :project_id, - where: "issue_type = #{INCIDENT_TYPE}", - name: OLD_INDEX_NAME - - remove_concurrent_index_by_name :issues, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20201103045515_add_issuable_metric_images.rb b/db/migrate/20201103045515_add_issuable_metric_images.rb deleted file mode 100644 index c598bb468a1..00000000000 --- a/db/migrate/20201103045515_add_issuable_metric_images.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class AddIssuableMetricImages < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:issuable_metric_images) - with_lock_retries do - create_table :issuable_metric_images do |t| - t.references :issue, null: false, index: true, foreign_key: { on_delete: :cascade } - t.timestamps_with_timezone - t.integer :file_store, limit: 2 - t.text :file, null: false - t.text :url - end - end - end - - add_text_limit(:issuable_metric_images, :url, 255) - add_text_limit(:issuable_metric_images, :file, 255) - end - - def down - with_lock_retries do - drop_table :issuable_metric_images - end - end -end diff --git a/db/migrate/20201103095752_add_issues_closed_at_index.rb b/db/migrate/20201103095752_add_issues_closed_at_index.rb deleted file mode 100644 index 7a8ee4e8d67..00000000000 --- a/db/migrate/20201103095752_add_issues_closed_at_index.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIssuesClosedAtIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index(:issues, [:project_id, :closed_at]) - end - - def down - remove_concurrent_index_by_name(:issues, 'index_issues_on_project_id_and_closed_at') - end -end diff --git a/db/migrate/20201103171537_add_index_active_billable_users_to_user.rb b/db/migrate/20201103171537_add_index_active_billable_users_to_user.rb deleted file mode 100644 index 3ad7a3f4ca3..00000000000 --- a/db/migrate/20201103171537_add_index_active_billable_users_to_user.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIndexActiveBillableUsersToUser < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'active_billable_users' - HUMAN_TYPE = 'NULL' - HUMAN_SVC_BOT_TYPES = "#{HUMAN_TYPE}, 6, 4" - BOT_TYPES = '2,6,1,3,7,8' - - disable_ddl_transaction! - - def up - add_concurrent_index :users, :id, name: INDEX_NAME, where: "(state = 'active' AND (user_type is #{HUMAN_TYPE} or user_type in (#{HUMAN_SVC_BOT_TYPES}))) and ((users.user_type IS #{HUMAN_TYPE}) OR (users.user_type <> ALL ('{#{BOT_TYPES}}')))" - end - - def down - remove_concurrent_index_by_name(:users, INDEX_NAME) - end -end diff --git a/db/migrate/20201103184333_create_packages_package_file_build_infos.rb b/db/migrate/20201103184333_create_packages_package_file_build_infos.rb deleted file mode 100644 index 9cb6869cae4..00000000000 --- a/db/migrate/20201103184333_create_packages_package_file_build_infos.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesPackageFileBuildInfos < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - unless table_exists?(:packages_package_file_build_infos) - with_lock_retries do - create_table :packages_package_file_build_infos do |t| - t.references :package_file, index: true, - null: false, - foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, - type: :bigint - t.references :pipeline, index: true, - null: true, - foreign_key: { to_table: :ci_pipelines, on_delete: :nullify }, - type: :bigint - end - end - end - end - - def down - with_lock_retries do - drop_table :packages_package_file_build_infos - end - end -end diff --git a/db/migrate/20201103202213_update_packages_build_infos_index.rb b/db/migrate/20201103202213_update_packages_build_infos_index.rb deleted file mode 100644 index d737517045b..00000000000 --- a/db/migrate/20201103202213_update_packages_build_infos_index.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class UpdatePackagesBuildInfosIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - NEW_INDEX_NAME = 'idx_packages_build_infos_on_package_id' - OLD_INDEX_NAME = 'index_packages_build_infos_on_package_id' - - def up - add_concurrent_index :packages_build_infos, :package_id, name: NEW_INDEX_NAME - remove_concurrent_index_by_name :packages_build_infos, OLD_INDEX_NAME - end - - def down - # No op. It is possible records would validate the UNIQUE constraint, so it - # cannot be added back to the index. - end -end diff --git a/db/migrate/20201104142036_add_index_to_merge_request_metrics_target_project_id.rb b/db/migrate/20201104142036_add_index_to_merge_request_metrics_target_project_id.rb deleted file mode 100644 index 348a3387b6f..00000000000 --- a/db/migrate/20201104142036_add_index_to_merge_request_metrics_target_project_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToMergeRequestMetricsTargetProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_mr_metrics_on_target_project_id_merged_at_time_to_merge' - - disable_ddl_transaction! - - def up - add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at, :created_at], where: 'merged_at > created_at', name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) - end -end diff --git a/db/migrate/20201104204739_create_bulk_import_trackers.rb b/db/migrate/20201104204739_create_bulk_import_trackers.rb deleted file mode 100644 index 906bd06248d..00000000000 --- a/db/migrate/20201104204739_create_bulk_import_trackers.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -class CreateBulkImportTrackers < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:bulk_import_trackers) - create_table :bulk_import_trackers do |t| - t.references :bulk_import_entity, - null: false, - index: false, - foreign_key: { on_delete: :cascade } - - t.text :relation, null: false - t.text :next_page - t.boolean :has_next_page, default: false, null: false - - t.index %w(bulk_import_entity_id relation), - unique: true, - name: :bulk_import_trackers_uniq_relation_by_entity - end - end - end - - add_check_constraint :bulk_import_trackers, - '(has_next_page IS FALSE or next_page IS NOT NULL)', - 'check_next_page_requirement' - add_text_limit :bulk_import_trackers, :relation, 255 - add_text_limit :bulk_import_trackers, :next_page, 255 - end - - def down - with_lock_retries do - drop_table :bulk_import_trackers - end - end -end diff --git a/db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb b/db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb deleted file mode 100644 index 1d2251f6c37..00000000000 --- a/db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddUploadsSizeToProjectStatistics < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :project_statistics, :uploads_size, :bigint, default: 0, null: false - end - - def down - remove_column :project_statistics, :uploads_size - end -end diff --git a/db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb b/db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb deleted file mode 100644 index c3cccc7d5f2..00000000000 --- a/db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddUploadsSizeToNamespaceRootStorageStatistics < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :namespace_root_storage_statistics, :uploads_size, :bigint, default: 0, null: false - end - - def down - remove_column :namespace_root_storage_statistics, :uploads_size - end -end diff --git a/db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb b/db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb deleted file mode 100644 index d53f81ecabb..00000000000 --- a/db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class ChangeDefaultValueOfCiMaxArtifactSizeLsifOfPlanLimitsFrom20To100 < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - change_column_default :plan_limits, :ci_max_artifact_size_lsif, 100 - execute('UPDATE plan_limits SET ci_max_artifact_size_lsif = 100 WHERE ci_max_artifact_size_lsif = 20') - end - end - - def down - with_lock_retries do - change_column_default :plan_limits, :ci_max_artifact_size_lsif, 20 - execute('UPDATE plan_limits SET ci_max_artifact_size_lsif = 20 WHERE ci_max_artifact_size_lsif = 100') - end - end -end diff --git a/db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb b/db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb deleted file mode 100644 index 27269de611c..00000000000 --- a/db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddVulnerabilitiesEnabledAndIssuetypeToJiraTrackerData < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb - def change - add_column :jira_tracker_data, :vulnerabilities_issuetype, :text - add_column :jira_tracker_data, :vulnerabilities_enabled, :boolean, default: false, null: false - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb b/db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb deleted file mode 100644 index 4a81b0ce7af..00000000000 --- a/db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToJiraTrackerDataIssuetype < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :jira_tracker_data, :vulnerabilities_issuetype, 255 - end - - def down - remove_text_limit :jira_tracker_data, :vulnerabilities_issuetype - end -end diff --git a/db/migrate/20201106134139_add_pipelines_created_index.rb b/db/migrate/20201106134139_add_pipelines_created_index.rb deleted file mode 100644 index aaf6643cf0b..00000000000 --- a/db/migrate/20201106134139_add_pipelines_created_index.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddPipelinesCreatedIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = :index_ci_pipelines_on_project_id_and_status_and_created_at - - disable_ddl_transaction! - - def up - add_concurrent_index :ci_pipelines, [:project_id, :status, :created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :ci_pipelines, INDEX_NAME - end -end diff --git a/db/migrate/20201106135608_remove_redundant_pipelines_index.rb b/db/migrate/20201106135608_remove_redundant_pipelines_index.rb deleted file mode 100644 index 03e757c0ec1..00000000000 --- a/db/migrate/20201106135608_remove_redundant_pipelines_index.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveRedundantPipelinesIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :ci_pipelines, :index_ci_pipelines_on_project_id_and_created_at - end - - def down - add_concurrent_index :ci_pipelines, [:project_id, :created_at] - end -end diff --git a/db/migrate/20201106193452_add_converted_at_to_experiment_users.rb b/db/migrate/20201106193452_add_converted_at_to_experiment_users.rb deleted file mode 100644 index 5391093516b..00000000000 --- a/db/migrate/20201106193452_add_converted_at_to_experiment_users.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddConvertedAtToExperimentUsers < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :experiment_users, :converted_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb b/db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb deleted file mode 100644 index 196f7bd8359..00000000000 --- a/db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultTrueRequireAdminApprovalAfterUserSignupToApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_default :application_settings, :require_admin_approval_after_user_signup, from: false, to: true - end -end diff --git a/db/migrate/20201108134919_add_finding_fingerprint_table.rb b/db/migrate/20201108134919_add_finding_fingerprint_table.rb deleted file mode 100644 index dd8ffe8e8aa..00000000000 --- a/db/migrate/20201108134919_add_finding_fingerprint_table.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -class AddFindingFingerprintTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - FINGERPRINT_IDX = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint - UNIQ_IDX = :idx_vuln_fingerprints_uniqueness - - def up - with_lock_retries do - create_table :vulnerability_finding_fingerprints do |t| - t.references :finding, - index: true, - null: false, - foreign_key: { to_table: :vulnerability_occurrences, column: :finding_id, on_delete: :cascade } - - t.timestamps_with_timezone null: false - - t.integer :algorithm_type, null: false - t.binary :fingerprint_sha256, null: false - - t.index %i[finding_id fingerprint_sha256], - name: FINGERPRINT_IDX, - unique: true # only one link should exist between occurrence and the fingerprint - - t.index %i[finding_id algorithm_type fingerprint_sha256], - name: UNIQ_IDX, - unique: true # these should be unique - end - end - end - - def down - with_lock_retries do - drop_table :vulnerability_finding_fingerprints - end - end -end diff --git a/db/migrate/20201109080645_create_vulnerability_remediations_table.rb b/db/migrate/20201109080645_create_vulnerability_remediations_table.rb deleted file mode 100644 index b00ce797c7d..00000000000 --- a/db/migrate/20201109080645_create_vulnerability_remediations_table.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityRemediationsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - create_table :vulnerability_remediations, if_not_exists: true do |t| - t.timestamps_with_timezone - - t.integer :file_store, limit: 2 - t.text :summary, null: false - t.text :file, null: false - end - - add_text_limit :vulnerability_remediations, :summary, 200 - add_text_limit :vulnerability_remediations, :file, 255 - end - - def down - drop_table :vulnerability_remediations - end -end diff --git a/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb b/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb deleted file mode 100644 index e944cee24e4..00000000000 --- a/db/migrate/20201109080646_create_vulnerability_findings_remediations_join_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityFindingsRemediationsJoinTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/CreateTableWithForeignKeys - def change - create_table :vulnerability_findings_remediations do |t| - t.references :vulnerability_occurrence, index: false, foreign_key: { on_delete: :cascade } - t.references :vulnerability_remediation, index: { name: 'index_vulnerability_findings_remediations_on_remediation_id' }, foreign_key: { on_delete: :cascade } - - t.timestamps_with_timezone - - t.index [:vulnerability_occurrence_id, :vulnerability_remediation_id], unique: true, name: 'index_vulnerability_findings_remediations_on_unique_keys' - end - end - # rubocop:enable Migration/CreateTableWithForeignKeys -end diff --git a/db/migrate/20201109144634_add_region_field_to_aws_role.rb b/db/migrate/20201109144634_add_region_field_to_aws_role.rb deleted file mode 100644 index ced75f24552..00000000000 --- a/db/migrate/20201109144634_add_region_field_to_aws_role.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddRegionFieldToAwsRole < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:aws_roles, :region) - add_column :aws_roles, :region, :text - end - - add_text_limit :aws_roles, :region, 255 - end - - def down - remove_column :aws_roles, :region - end -end diff --git a/db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb b/db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb deleted file mode 100644 index 0823655f92f..00000000000 --- a/db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddSecretDetectionRevocationTokenTypesApplicationSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - add_column :application_settings, :secret_detection_revocation_token_types_url, :text, null: true # rubocop:disable Migration/AddLimitToTextColumns - end - - def down - remove_column :application_settings, :secret_detection_revocation_token_types_url - end -end diff --git a/db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb b/db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb deleted file mode 100644 index 9e0329aafcc..00000000000 --- a/db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToSecretDetectionRevocationTokenTypesApplicationSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :secret_detection_revocation_token_types_url, 255 - end - - def down - remove_text_limit :application_settings, :secret_detection_revocation_token_types_url - end -end diff --git a/db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb b/db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb deleted file mode 100644 index fed117d5f08..00000000000 --- a/db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreatedIndexForVulnerabilityOccurrencesOnProjectFingerprint < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_vulnerability_occurrences_on_project_fingerprint' - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerability_occurrences, :project_fingerprint, name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME - end -end diff --git a/db/migrate/20201110110454_extend_postgres_indexes_view.rb b/db/migrate/20201110110454_extend_postgres_indexes_view.rb deleted file mode 100644 index 4e9172024d3..00000000000 --- a/db/migrate/20201110110454_extend_postgres_indexes_view.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -class ExtendPostgresIndexesView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - DROP VIEW postgres_indexes; - - CREATE VIEW postgres_indexes AS - SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, - pg_index.indexrelid, - pg_namespace.nspname AS schema, - pg_class.relname AS name, - pg_index.indisunique AS "unique", - pg_index.indisvalid AS valid_index, - pg_class.relispartition AS partitioned, - pg_index.indisexclusion AS exclusion, - pg_index.indexprs IS NOT NULL as expression, - pg_index.indpred IS NOT NULL as partial, - pg_indexes.indexdef AS definition, - pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes - FROM pg_index - JOIN pg_class ON pg_class.oid = pg_index.indexrelid - JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog'::name - AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); - SQL - end - - def down - execute(<<~SQL) - DROP VIEW postgres_indexes; - - CREATE VIEW postgres_indexes AS - SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, - pg_index.indexrelid, - pg_namespace.nspname AS schema, - pg_class.relname AS name, - pg_index.indisunique AS "unique", - pg_index.indisvalid AS valid_index, - pg_class.relispartition AS partitioned, - pg_index.indisexclusion AS exclusion, - pg_indexes.indexdef AS definition, - pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes - FROM pg_index - JOIN pg_class ON pg_class.oid = pg_index.indexrelid - JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog'::name - AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); - SQL - end -end diff --git a/db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb b/db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb deleted file mode 100644 index 5bd810207d8..00000000000 --- a/db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -class ChangeIndexMrMetricsTargetProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - disable_ddl_transaction! - - DOWNTIME = false - INDEX_NAME = 'index_merge_request_metrics_on_target_project_id_merged_at' - NULLS_LAST_INDEX_NAME = 'index_mr_metrics_on_target_project_id_merged_at_nulls_last' - - def up - add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at, :id], order: { merged_at: 'DESC NULLS LAST', id: 'DESC' }, name: NULLS_LAST_INDEX_NAME - remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) - end - - def down - add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at], name: INDEX_NAME - remove_concurrent_index_by_name(:merge_request_metrics, NULLS_LAST_INDEX_NAME) - end -end diff --git a/db/migrate/20201110221400_create_experiment_subjects.rb b/db/migrate/20201110221400_create_experiment_subjects.rb deleted file mode 100644 index 0c04d5b219f..00000000000 --- a/db/migrate/20201110221400_create_experiment_subjects.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class CreateExperimentSubjects < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - create_table :experiment_subjects do |t| - t.references :experiment, index: true, foreign_key: { on_delete: :cascade }, null: false - t.bigint :user_id, index: true - t.bigint :group_id, index: true - t.bigint :project_id, index: true - t.integer :variant, limit: 2, null: false, default: 0 - t.timestamps_with_timezone null: false - end - - # Require exactly one of user_id, group_id, or project_id to be NOT NULL - execute <<-SQL - ALTER TABLE experiment_subjects ADD CONSTRAINT chk_has_one_subject CHECK (num_nonnulls(user_id, group_id, project_id) = 1); - SQL - end - - def down - drop_table :experiment_subjects - end -end diff --git a/db/migrate/20201111051655_add_foreign_key_to_experiment_subjects_on_user.rb b/db/migrate/20201111051655_add_foreign_key_to_experiment_subjects_on_user.rb deleted file mode 100644 index 231d083dfda..00000000000 --- a/db/migrate/20201111051655_add_foreign_key_to_experiment_subjects_on_user.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToExperimentSubjectsOnUser < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - - DOWNTIME = false - - def up - add_concurrent_foreign_key :experiment_subjects, :users, column: :user_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :experiment_subjects, column: :user_id - end - end -end diff --git a/db/migrate/20201111051847_add_foreign_key_to_experiment_subjects_on_group.rb b/db/migrate/20201111051847_add_foreign_key_to_experiment_subjects_on_group.rb deleted file mode 100644 index ad0d7ae027e..00000000000 --- a/db/migrate/20201111051847_add_foreign_key_to_experiment_subjects_on_group.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToExperimentSubjectsOnGroup < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - - DOWNTIME = false - - def up - add_concurrent_foreign_key :experiment_subjects, :namespaces, column: :group_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :experiment_subjects, column: :group_id - end - end -end diff --git a/db/migrate/20201111051904_add_foreign_key_to_experiment_subjects_on_project.rb b/db/migrate/20201111051904_add_foreign_key_to_experiment_subjects_on_project.rb deleted file mode 100644 index a8a05292cca..00000000000 --- a/db/migrate/20201111051904_add_foreign_key_to_experiment_subjects_on_project.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddForeignKeyToExperimentSubjectsOnProject < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - - DOWNTIME = false - - def up - add_concurrent_foreign_key :experiment_subjects, :projects, column: :project_id, on_delete: :cascade - end - - def down - with_lock_retries do - remove_foreign_key :experiment_subjects, column: :project_id - end - end -end diff --git a/db/migrate/20201111100136_create_analytics_devops_adoption_snapshots.rb b/db/migrate/20201111100136_create_analytics_devops_adoption_snapshots.rb deleted file mode 100644 index ee029d17c94..00000000000 --- a/db/migrate/20201111100136_create_analytics_devops_adoption_snapshots.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class CreateAnalyticsDevopsAdoptionSnapshots < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - create_table :analytics_devops_adoption_snapshots do |t| - t.references :segment, index: false, null: false, foreign_key: { to_table: :analytics_devops_adoption_segments, on_delete: :cascade } - t.datetime_with_timezone :recorded_at, null: false - t.boolean :issue_opened, null: false - t.boolean :merge_request_opened, null: false - t.boolean :merge_request_approved, null: false - t.boolean :runner_configured, null: false - t.boolean :pipeline_succeeded, null: false - t.boolean :deploy_succeeded, null: false - t.boolean :security_scan_succeeded, null: false - - t.index [:segment_id, :recorded_at], name: 'index_on_snapshots_segment_id_recorded_at' - end - end -end diff --git a/db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb b/db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb deleted file mode 100644 index e2069835597..00000000000 --- a/db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class AddCloudLicenseAuthTokenToSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20201111110918_add_cloud_license_auth_token_application_settings_text_limit - def change - add_column :application_settings, :encrypted_cloud_license_auth_token, :text - add_column :application_settings, :encrypted_cloud_license_auth_token_iv, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb b/db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb deleted file mode 100644 index fd1ee5e07bf..00000000000 --- a/db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddCloudLicenseAuthTokenApplicationSettingsTextLimit < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :encrypted_cloud_license_auth_token_iv, 255 - end - - def down - remove_text_limit :application_settings, :encrypted_cloud_license_auth_token_iv - end -end diff --git a/db/migrate/20201111115414_create_incident_management_oncall_schedules.rb b/db/migrate/20201111115414_create_incident_management_oncall_schedules.rb deleted file mode 100644 index dbb7d1c0808..00000000000 --- a/db/migrate/20201111115414_create_incident_management_oncall_schedules.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class CreateIncidentManagementOncallSchedules < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:incident_management_oncall_schedules) - create_table :incident_management_oncall_schedules do |t| - t.timestamps_with_timezone - t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade } - t.integer :iid, null: false - t.text :name, null: false - t.text :description - t.text :timezone - - t.index %w(project_id iid), name: 'index_im_oncall_schedules_on_project_id_and_iid', unique: true, using: :btree - end - end - end - - add_text_limit :incident_management_oncall_schedules, :name, 200 - add_text_limit :incident_management_oncall_schedules, :description, 1000 - add_text_limit :incident_management_oncall_schedules, :timezone, 100 - end - - def down - with_lock_retries do - drop_table :incident_management_oncall_schedules - end - end -end diff --git a/db/migrate/20201111145317_add_relation_to_indexes_view.rb b/db/migrate/20201111145317_add_relation_to_indexes_view.rb deleted file mode 100644 index 318b77c1dc6..00000000000 --- a/db/migrate/20201111145317_add_relation_to_indexes_view.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -class AddRelationToIndexesView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - DROP VIEW postgres_indexes; - - CREATE VIEW postgres_indexes AS - SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, - pg_index.indexrelid, - pg_namespace.nspname AS schema, - pg_class.relname AS name, - pg_indexes.tablename, - pg_index.indisunique AS "unique", - pg_index.indisvalid AS valid_index, - pg_class.relispartition AS partitioned, - pg_index.indisexclusion AS exclusion, - pg_index.indexprs IS NOT NULL as expression, - pg_index.indpred IS NOT NULL as partial, - pg_indexes.indexdef AS definition, - pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes - FROM pg_index - JOIN pg_class ON pg_class.oid = pg_index.indexrelid - JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog'::name - AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); - SQL - end - - def down - execute(<<~SQL) - DROP VIEW postgres_indexes; - - CREATE VIEW postgres_indexes AS - SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, - pg_index.indexrelid, - pg_namespace.nspname AS schema, - pg_class.relname AS name, - pg_index.indisunique AS "unique", - pg_index.indisvalid AS valid_index, - pg_class.relispartition AS partitioned, - pg_index.indisexclusion AS exclusion, - pg_index.indexprs IS NOT NULL as expression, - pg_index.indpred IS NOT NULL as partial, - pg_indexes.indexdef AS definition, - pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes - FROM pg_index - JOIN pg_class ON pg_class.oid = pg_index.indexrelid - JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid - JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname - WHERE pg_namespace.nspname <> 'pg_catalog'::name - AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); - SQL - end -end diff --git a/db/migrate/20201111152859_add_missing_expression_indexes.rb b/db/migrate/20201111152859_add_missing_expression_indexes.rb deleted file mode 100644 index e2742f7f3bc..00000000000 --- a/db/migrate/20201111152859_add_missing_expression_indexes.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -class AddMissingExpressionIndexes < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEXES = [ - [:namespaces, :index_on_namespaces_lower_name, 'LOWER(name)'], - [:namespaces, :index_on_namespaces_lower_path, 'LOWER(path)'], - [:projects, :index_on_projects_lower_path, 'LOWER(path)'], - [:routes, :index_on_routes_lower_path, 'LOWER(path)'], - [:users, :index_on_users_lower_username, 'LOWER(username)'], - [:users, :index_on_users_lower_email, 'LOWER(email)'] - ] - - def up - # Those indexes had been introduced before, but they haven't been - # captured in structure.sql. For installations that already have it, - # this is a no-op - others will get it retroactively with - # this migration. - - tables = Set.new - - INDEXES.each do |(table, name, expression)| - unless index_name_exists?(table, name) - add_concurrent_index table, expression, name: name - tables.add(table) - end - end - - # Rebuild statistics on affected tables only - tables.each do |table| - execute("ANALYZE #{table}") - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20201112132808_create_bulk_import_failures.rb b/db/migrate/20201112132808_create_bulk_import_failures.rb deleted file mode 100644 index cdc5a4d6ff0..00000000000 --- a/db/migrate/20201112132808_create_bulk_import_failures.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class CreateBulkImportFailures < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:bulk_import_failures) - create_table :bulk_import_failures do |t| - t.references :bulk_import_entity, - null: false, - index: true, - foreign_key: { on_delete: :cascade } - - t.datetime_with_timezone :created_at, null: false - t.text :pipeline_class, null: false - t.text :exception_class, null: false - t.text :exception_message, null: false - t.text :correlation_id_value, index: true - end - end - end - - add_text_limit :bulk_import_failures, :pipeline_class, 255 - add_text_limit :bulk_import_failures, :exception_class, 255 - add_text_limit :bulk_import_failures, :exception_message, 255 - add_text_limit :bulk_import_failures, :correlation_id_value, 255 - end - - def down - with_lock_retries do - drop_table :bulk_import_failures - end - end -end diff --git a/db/migrate/20201112173532_add_verification_state_to_package_files.rb b/db/migrate/20201112173532_add_verification_state_to_package_files.rb deleted file mode 100644 index 61f526bd77e..00000000000 --- a/db/migrate/20201112173532_add_verification_state_to_package_files.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationStateToPackageFiles < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :packages_package_files, :verification_state, :integer, default: 0, limit: 2, null: false - add_column :packages_package_files, :verification_started_at, :datetime_with_timezone - end -end diff --git a/db/migrate/20201112173911_add_index_on_verification_state_on_package_files.rb b/db/migrate/20201112173911_add_index_on_verification_state_on_package_files.rb deleted file mode 100644 index 17e6b7d01f6..00000000000 --- a/db/migrate/20201112173911_add_index_on_verification_state_on_package_files.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnVerificationStateOnPackageFiles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_packages_package_files_on_verification_state' - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_package_files, :verification_state, name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :packages_package_files, INDEX_NAME - end -end diff --git a/db/migrate/20201112195322_reseed_merge_trains_enabled.rb b/db/migrate/20201112195322_reseed_merge_trains_enabled.rb deleted file mode 100644 index 777c59d16b1..00000000000 --- a/db/migrate/20201112195322_reseed_merge_trains_enabled.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class ReseedMergeTrainsEnabled < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - update_column_in_batches(:project_ci_cd_settings, :merge_trains_enabled, true) do |table, query| - query.where(table[:merge_pipelines_enabled].eq(true)) - end - end - - def down - # no-op - end -end diff --git a/db/migrate/20201112215028_add_partitioned_audit_event_indexes.rb b/db/migrate/20201112215028_add_partitioned_audit_event_indexes.rb deleted file mode 100644 index d8b2833474b..00000000000 --- a/db/migrate/20201112215028_add_partitioned_audit_event_indexes.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddPartitionedAuditEventIndexes < ActiveRecord::Migration[6.0] - include Gitlab::Database::PartitioningMigrationHelpers - - DOWNTIME = false - - CREATED_AT_AUTHOR_ID_INDEX_NAME = 'analytics_index_audit_events_part_on_created_at_and_author_id' - ENTITY_ID_DESC_INDEX_NAME = 'idx_audit_events_part_on_entity_id_desc_author_id_created_at' - - disable_ddl_transaction! - - def up - add_concurrent_partitioned_index :audit_events_part_5fc467ac26, - [:created_at, :author_id], - name: CREATED_AT_AUTHOR_ID_INDEX_NAME - - add_concurrent_partitioned_index :audit_events_part_5fc467ac26, - [:entity_id, :entity_type, :id, :author_id, :created_at], - order: { id: :desc }, - name: ENTITY_ID_DESC_INDEX_NAME - end - - def down - remove_concurrent_partitioned_index_by_name :audit_events_part_5fc467ac26, ENTITY_ID_DESC_INDEX_NAME - - remove_concurrent_partitioned_index_by_name :audit_events_part_5fc467ac26, CREATED_AT_AUTHOR_ID_INDEX_NAME - end -end diff --git a/db/migrate/20201112215132_swap_partitioned_audit_events.rb b/db/migrate/20201112215132_swap_partitioned_audit_events.rb deleted file mode 100644 index 8360dbd4aa5..00000000000 --- a/db/migrate/20201112215132_swap_partitioned_audit_events.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class SwapPartitionedAuditEvents < ActiveRecord::Migration[6.0] - include Gitlab::Database::PartitioningMigrationHelpers - - DOWNTIME = false - - def up - replace_with_partitioned_table :audit_events - end - - def down - rollback_replace_with_partitioned_table :audit_events - end -end diff --git a/db/migrate/20201116090328_add_regulated_to_compliance_frameworks.rb b/db/migrate/20201116090328_add_regulated_to_compliance_frameworks.rb deleted file mode 100644 index f2e0c23ccfc..00000000000 --- a/db/migrate/20201116090328_add_regulated_to_compliance_frameworks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddRegulatedToComplianceFrameworks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column(:compliance_management_frameworks, :regulated, :boolean, default: true, null: false) - end -end diff --git a/db/migrate/20201116211829_create_user_permission_export_uploads.rb b/db/migrate/20201116211829_create_user_permission_export_uploads.rb deleted file mode 100644 index d6207fe0c2c..00000000000 --- a/db/migrate/20201116211829_create_user_permission_export_uploads.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class CreateUserPermissionExportUploads < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:user_permission_export_uploads) - create_table :user_permission_export_uploads do |t| - t.timestamps_with_timezone null: false - t.references :user, foreign_key: { on_delete: :cascade }, index: false, null: false - t.integer :file_store - t.integer :status, limit: 2, null: false, default: 0 - t.text :file - - t.index [:user_id, :status] - end - end - end - - add_text_limit :user_permission_export_uploads, :file, 255 - end - - def down - with_lock_retries do - drop_table :user_permission_export_uploads - end - end -end diff --git a/db/migrate/20201117054609_add_cloud_license_enabled_to_settings.rb b/db/migrate/20201117054609_add_cloud_license_enabled_to_settings.rb deleted file mode 100644 index 4488aa376a1..00000000000 --- a/db/migrate/20201117054609_add_cloud_license_enabled_to_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddCloudLicenseEnabledToSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :cloud_license_enabled, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20201117075742_change_webauthn_xid_length.rb b/db/migrate/20201117075742_change_webauthn_xid_length.rb deleted file mode 100644 index 2d836662e01..00000000000 --- a/db/migrate/20201117075742_change_webauthn_xid_length.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class ChangeWebauthnXidLength < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :webauthn_registrations, :credential_xid, 340, constraint_name: check_constraint_name(:webauthn_registrations, :credential_xid, 'max_length_v2') - remove_text_limit :webauthn_registrations, :credential_xid, constraint_name: check_constraint_name(:webauthn_registrations, :credential_xid, 'max_length') - end - - def down - # no-op: Danger of failling if there are records with length(credential_xid) > 255 - end -end diff --git a/db/migrate/20201117153333_add_index_on_package_size_and_project_id_to_project_statistics.rb b/db/migrate/20201117153333_add_index_on_package_size_and_project_id_to_project_statistics.rb deleted file mode 100644 index efb5cf14d3c..00000000000 --- a/db/migrate/20201117153333_add_index_on_package_size_and_project_id_to_project_statistics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexOnPackageSizeAndProjectIdToProjectStatistics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_project_statistics_on_packages_size_and_project_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :project_statistics, [:packages_size, :project_id], - name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :project_statistics, INDEX_NAME - end -end diff --git a/db/migrate/20201117184334_add_index_to_project_repositories_shard_id_project_id.rb b/db/migrate/20201117184334_add_index_to_project_repositories_shard_id_project_id.rb deleted file mode 100644 index 25d95231ac4..00000000000 --- a/db/migrate/20201117184334_add_index_to_project_repositories_shard_id_project_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToProjectRepositoriesShardIdProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :project_repositories, [:shard_id, :project_id] - end - - def down - remove_concurrent_index :project_repositories, [:shard_id, :project_id], name: 'index_project_repositories_on_shard_id_and_project_id' - end -end diff --git a/db/migrate/20201117203224_add_iteration_id_to_boards_table.rb b/db/migrate/20201117203224_add_iteration_id_to_boards_table.rb deleted file mode 100644 index 18abe096604..00000000000 --- a/db/migrate/20201117203224_add_iteration_id_to_boards_table.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIterationIdToBoardsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :boards, :iteration_id, :bigint - end - end - - def down - with_lock_retries do - remove_column :boards, :iteration_id - end - end -end diff --git a/db/migrate/20201117213024_add_iteration_id_index_to_boards_table.rb b/db/migrate/20201117213024_add_iteration_id_index_to_boards_table.rb deleted file mode 100644 index e038b4eacd9..00000000000 --- a/db/migrate/20201117213024_add_iteration_id_index_to_boards_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIterationIdIndexToBoardsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_boards_on_iteration_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :boards, :iteration_id, name: INDEX_NAME - end - - def down - remove_concurrent_index :boards, :iteration_id, name: INDEX_NAME - end -end diff --git a/db/migrate/20201118093135_create_namespace_onboarding_actions.rb b/db/migrate/20201118093135_create_namespace_onboarding_actions.rb deleted file mode 100644 index 6b38a0dddca..00000000000 --- a/db/migrate/20201118093135_create_namespace_onboarding_actions.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class CreateNamespaceOnboardingActions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :namespace_onboarding_actions do |t| - t.references :namespace, index: true, null: false, foreign_key: { on_delete: :cascade } - t.datetime_with_timezone :created_at, null: false - t.integer :action, limit: 2, null: false - end - end - end - - def down - with_lock_retries do - drop_table :namespace_onboarding_actions - end - end -end diff --git a/db/migrate/20201119031515_add_iteration_id_to_lists.rb b/db/migrate/20201119031515_add_iteration_id_to_lists.rb deleted file mode 100644 index 62e13f53e92..00000000000 --- a/db/migrate/20201119031515_add_iteration_id_to_lists.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddIterationIdToLists < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :lists, :iteration_id, :bigint - end -end diff --git a/db/migrate/20201119053603_add_iteration_lists_foreign_key.rb b/db/migrate/20201119053603_add_iteration_lists_foreign_key.rb deleted file mode 100644 index 8d9ec1f2e59..00000000000 --- a/db/migrate/20201119053603_add_iteration_lists_foreign_key.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class AddIterationListsForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'index_lists_on_iteration_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :lists, :iteration_id, name: INDEX_NAME - add_concurrent_foreign_key :lists, :sprints, column: :iteration_id, on_delete: :cascade - end - - def down - remove_foreign_key_if_exists :lists, :sprints, column: :iteration_id - remove_concurrent_index_by_name :lists, INDEX_NAME - end -end diff --git a/db/migrate/20201119125730_add_web_hooks_service_foreign_key.rb b/db/migrate/20201119125730_add_web_hooks_service_foreign_key.rb deleted file mode 100644 index d350a7de282..00000000000 --- a/db/migrate/20201119125730_add_web_hooks_service_foreign_key.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AddWebHooksServiceForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_web_hooks_on_service_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :web_hooks, :service_id, name: INDEX_NAME - add_concurrent_foreign_key :web_hooks, :services, column: :service_id, on_delete: :cascade, validate: false - end - - def down - with_lock_retries do - remove_foreign_key_if_exists :web_hooks, column: :service_id - end - - remove_concurrent_index_by_name :web_hooks, INDEX_NAME - end -end diff --git a/db/migrate/20201119133534_add_personal_access_token_prefix_to_application_setting.rb b/db/migrate/20201119133534_add_personal_access_token_prefix_to_application_setting.rb deleted file mode 100644 index c6bb6b7d514..00000000000 --- a/db/migrate/20201119133534_add_personal_access_token_prefix_to_application_setting.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class AddPersonalAccessTokenPrefixToApplicationSetting < ActiveRecord::Migration[6.0] - DOWNTIME = false - - # rubocop:disable Migration/AddLimitToTextColumns - # limit is added in 20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix - def change - add_column :application_settings, :personal_access_token_prefix, :text - end - # rubocop:enable Migration/AddLimitToTextColumns -end diff --git a/db/migrate/20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix.rb b/db/migrate/20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix.rb deleted file mode 100644 index a118da9e3e7..00000000000 --- a/db/migrate/20201119133604_add_text_limit_to_application_setting_personal_access_token_prefix.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddTextLimitToApplicationSettingPersonalAccessTokenPrefix < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_text_limit :application_settings, :personal_access_token_prefix, 20 - end - - def down - remove_text_limit :application_settings, :personal_access_token_prefix - end -end diff --git a/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb b/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb deleted file mode 100644 index a7f12fcf726..00000000000 --- a/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class ChangeServicesInheritFromIdForeignKey < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :cascade, name: 'fk_services_inherit_from_id' - remove_foreign_key_if_exists :services, name: 'fk_868a8e7ad6' - end - - def down - remove_foreign_key_if_exists :services, name: 'fk_services_inherit_from_id' - add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify, name: 'fk_868a8e7ad6' - end -end diff --git a/db/migrate/20201119164605_add_checksum_into_vulnerability_remediations.rb b/db/migrate/20201119164605_add_checksum_into_vulnerability_remediations.rb deleted file mode 100644 index a9ac1ed0676..00000000000 --- a/db/migrate/20201119164605_add_checksum_into_vulnerability_remediations.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddChecksumIntoVulnerabilityRemediations < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :vulnerability_remediations, :checksum, :binary, null: false, comment: 'Stores the SHA256 checksum of the attached diff file' # rubocop:disable Rails/NotNullColumn - - add_index :vulnerability_remediations, :checksum, unique: true # rubocop:disable Migration/AddIndex (Table is empty) - end -end diff --git a/db/migrate/20201119213406_change_terraform_versioning_enabled_default.rb b/db/migrate/20201119213406_change_terraform_versioning_enabled_default.rb deleted file mode 100644 index 490fe481589..00000000000 --- a/db/migrate/20201119213406_change_terraform_versioning_enabled_default.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class ChangeTerraformVersioningEnabledDefault < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_column_default :terraform_states, :versioning_enabled, from: false, to: true - end -end diff --git a/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb b/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb deleted file mode 100644 index a059099dbc4..00000000000 --- a/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class AddKrokiFormatsToApplicationSettingsTable < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - change_table :application_settings do |t| - t.jsonb :kroki_formats, null: false, default: {} - end - end -end diff --git a/db/migrate/20201120125953_replace_unused_labels_index.rb b/db/migrate/20201120125953_replace_unused_labels_index.rb deleted file mode 100644 index afddbce618d..00000000000 --- a/db/migrate/20201120125953_replace_unused_labels_index.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class ReplaceUnusedLabelsIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - NEW_INDEX_NAME = 'index_labels_on_group_id_and_title_with_null_project_id' - OLD_INDEX_NAME = 'index_labels_on_group_id_and_title' - - def up - add_concurrent_index :labels, [:group_id, :title], where: 'project_id IS NULL', name: NEW_INDEX_NAME - remove_concurrent_index_by_name :labels, OLD_INDEX_NAME - end - - def down - add_concurrent_index :labels, [:group_id, :title], where: 'project_id = NULL::integer', name: OLD_INDEX_NAME - remove_concurrent_index_by_name :labels, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20201120144823_create_tokens_with_iv.rb b/db/migrate/20201120144823_create_tokens_with_iv.rb deleted file mode 100644 index f8dc75513fb..00000000000 --- a/db/migrate/20201120144823_create_tokens_with_iv.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class CreateTokensWithIv < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - create_table :token_with_ivs do |t| - t.binary :hashed_token, null: false - t.binary :hashed_plaintext_token, null: false - t.binary :iv, null: false - - t.index :hashed_token, name: 'index_token_with_ivs_on_hashed_token', unique: true, using: :btree - t.index :hashed_plaintext_token, name: 'index_token_with_ivs_on_hashed_plaintext_token', unique: true, using: :btree - end - end -end diff --git a/db/migrate/20201123081307_add_operations_project_feature_to_metrics.rb b/db/migrate/20201123081307_add_operations_project_feature_to_metrics.rb deleted file mode 100644 index 6801b49fae5..00000000000 --- a/db/migrate/20201123081307_add_operations_project_feature_to_metrics.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddOperationsProjectFeatureToMetrics < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_features, :operations_access_level, :integer, default: 20, null: false - end - end - - def down - with_lock_retries do - remove_column :project_features, :operations_access_level - end - end -end diff --git a/db/migrate/20201123161611_add_provisioned_by_group_to_user_details.rb b/db/migrate/20201123161611_add_provisioned_by_group_to_user_details.rb deleted file mode 100644 index 6e4d0e84509..00000000000 --- a/db/migrate/20201123161611_add_provisioned_by_group_to_user_details.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddProvisionedByGroupToUserDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_user_details_on_provisioned_by_group_id' - - disable_ddl_transaction! - - def up - unless column_exists?(:user_details, :provisioned_by_group_id) - with_lock_retries { add_column(:user_details, :provisioned_by_group_id, :integer, limit: 8) } - end - - add_concurrent_index :user_details, :provisioned_by_group_id, name: INDEX_NAME - add_concurrent_foreign_key :user_details, :namespaces, column: :provisioned_by_group_id, on_delete: :nullify - end - - def down - with_lock_retries { remove_foreign_key_without_error :user_details, column: :provisioned_by_group_id } - - remove_concurrent_index_by_name :user_details, INDEX_NAME - - if column_exists?(:user_details, :provisioned_by_group_id) - with_lock_retries { remove_column(:user_details, :provisioned_by_group_id) } - end - end -end diff --git a/db/migrate/20201124030537_create_incident_management_on_call_rotations.rb b/db/migrate/20201124030537_create_incident_management_on_call_rotations.rb deleted file mode 100644 index 18546d97fd5..00000000000 --- a/db/migrate/20201124030537_create_incident_management_on_call_rotations.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class CreateIncidentManagementOnCallRotations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:incident_management_oncall_rotations) - with_lock_retries do - create_table :incident_management_oncall_rotations do |t| - t.timestamps_with_timezone - t.references :oncall_schedule, index: false, null: false, foreign_key: { to_table: :incident_management_oncall_schedules, on_delete: :cascade } - t.integer :length, null: false - t.integer :length_unit, limit: 2, null: false - t.datetime_with_timezone :starts_at, null: false - t.text :name, null: false - - t.index %w(oncall_schedule_id id), name: 'index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_id', unique: true, using: :btree - t.index %w(oncall_schedule_id name), name: 'index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_name', unique: true, using: :btree - end - end - end - - add_text_limit :incident_management_oncall_rotations, :name, 200 - end - - def down - with_lock_retries do - drop_table :incident_management_oncall_rotations - end - end -end diff --git a/db/migrate/20201124075951_create_vulnerability_external_links.rb b/db/migrate/20201124075951_create_vulnerability_external_links.rb deleted file mode 100644 index 8200b15559b..00000000000 --- a/db/migrate/20201124075951_create_vulnerability_external_links.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -class CreateVulnerabilityExternalLinks < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :vulnerability_external_issue_links, if_not_exists: true do |t| - t.timestamps_with_timezone null: false - t.references :author, null: false, index: true, foreign_key: { to_table: :users, on_delete: :nullify }, type: :bigint - t.references :vulnerability, null: false, index: true, type: :bigint - t.integer :link_type, limit: 2, null: false, default: 1 # 'created' - t.integer :external_type, limit: 2, null: false, default: 1 # 'jira' - t.text :external_project_key, null: false - t.text :external_issue_key, null: false - - t.index %i[vulnerability_id external_type external_project_key external_issue_key], - name: 'idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue', - unique: true - t.index %i[vulnerability_id link_type], - name: 'idx_vulnerability_ext_issue_links_on_vulne_id_and_link_type', - where: 'link_type = 1', - unique: true # only one 'created' link per vulnerability is allowed - end - end - - add_concurrent_foreign_key :vulnerability_external_issue_links, :vulnerabilities, column: :vulnerability_id, on_delete: :cascade - - add_text_limit :vulnerability_external_issue_links, :external_project_key, 255 - add_text_limit :vulnerability_external_issue_links, :external_issue_key, 255 - end - - def down - with_lock_retries do - drop_table :vulnerability_external_issue_links - end - end -end diff --git a/db/migrate/20201125030847_create_dependency_proxy_manifests.rb b/db/migrate/20201125030847_create_dependency_proxy_manifests.rb deleted file mode 100644 index 6c1a3f23bf3..00000000000 --- a/db/migrate/20201125030847_create_dependency_proxy_manifests.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class CreateDependencyProxyManifests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :dependency_proxy_manifests, if_not_exists: true do |t| - t.timestamps_with_timezone - t.references :group, index: false, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }, type: :bigint - t.bigint :size - t.integer :file_store, limit: 2 - t.text :file_name, null: false - t.text :file, null: false - t.text :digest, null: false - - t.index [:group_id, :digest], name: 'index_dependency_proxy_manifests_on_group_id_and_digest' - end - end - - add_text_limit :dependency_proxy_manifests, :file_name, 255 - add_text_limit :dependency_proxy_manifests, :file, 255 - add_text_limit :dependency_proxy_manifests, :digest, 255 - end - - def down - drop_table :dependency_proxy_manifests - end -end diff --git a/db/migrate/20201125233219_add_incident_management_on_call_participants.rb b/db/migrate/20201125233219_add_incident_management_on_call_participants.rb deleted file mode 100644 index 2a9b1d8b276..00000000000 --- a/db/migrate/20201125233219_add_incident_management_on_call_participants.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class AddIncidentManagementOnCallParticipants < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - PARTICIPANT_ROTATION_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_rotation_id' - PARTICIPANT_USER_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_user_id' - UNIQUE_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id' - - disable_ddl_transaction! - - def up - unless table_exists?(:incident_management_oncall_participants) - with_lock_retries do - create_table :incident_management_oncall_participants do |t| - t.references :oncall_rotation, index: false, null: false, foreign_key: { to_table: :incident_management_oncall_rotations, on_delete: :cascade } - t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade } - t.integer :color_palette, limit: 2, null: false - t.integer :color_weight, limit: 2, null: false - t.index :user_id, name: PARTICIPANT_USER_INDEX_NAME - t.index :oncall_rotation_id, name: PARTICIPANT_ROTATION_INDEX_NAME - t.index [:user_id, :oncall_rotation_id], unique: true, name: UNIQUE_INDEX_NAME - end - end - end - end - - def down - drop_table :incident_management_oncall_participants - end -end diff --git a/db/migrate/20201126165919_add_epic_boards.rb b/db/migrate/20201126165919_add_epic_boards.rb deleted file mode 100644 index 432b839d6ea..00000000000 --- a/db/migrate/20201126165919_add_epic_boards.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class AddEpicBoards < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :boards_epic_boards do |t| - t.boolean :hide_backlog_list, default: false, null: false - t.boolean :hide_closed_list, default: false, null: false - t.references :group, index: true, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false - t.timestamps_with_timezone - t.text :name, default: 'Development', null: false - end - end - - add_text_limit :boards_epic_boards, :name, 255 - end - - def down - with_lock_retries do - drop_table :boards_epic_boards - end - end -end diff --git a/db/migrate/20201126172030_add_feed_token_off_to_settings.rb b/db/migrate/20201126172030_add_feed_token_off_to_settings.rb deleted file mode 100644 index 04e05c9bd43..00000000000 --- a/db/migrate/20201126172030_add_feed_token_off_to_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddFeedTokenOffToSettings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :application_settings, :disable_feed_token, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20201126190039_add_epic_board_labels.rb b/db/migrate/20201126190039_add_epic_board_labels.rb deleted file mode 100644 index 519e705ce14..00000000000 --- a/db/migrate/20201126190039_add_epic_board_labels.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddEpicBoardLabels < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - with_lock_retries do - create_table :boards_epic_board_labels do |t| - t.references :epic_board, index: true, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false - t.references :label, index: true, foreign_key: { on_delete: :cascade }, null: false - end - end - end - - def down - with_lock_retries do - drop_table :boards_epic_board_labels - end - end -end diff --git a/db/migrate/20201127104228_add_index_to_security_scans_on_created_at_and_id.rb b/db/migrate/20201127104228_add_index_to_security_scans_on_created_at_and_id.rb deleted file mode 100644 index c9bbe8ab77d..00000000000 --- a/db/migrate/20201127104228_add_index_to_security_scans_on_created_at_and_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToSecurityScansOnCreatedAtAndId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_security_scans_on_date_created_at_and_id' - - disable_ddl_transaction! - - def up - add_concurrent_index :security_scans, "date(timezone('UTC', created_at)), id", name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name(:security_scans, INDEX_NAME) - end -end diff --git a/db/migrate/20201127141433_add_other_role_to_user_details.rb b/db/migrate/20201127141433_add_other_role_to_user_details.rb deleted file mode 100644 index 586dbb033fd..00000000000 --- a/db/migrate/20201127141433_add_other_role_to_user_details.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class AddOtherRoleToUserDetails < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless column_exists?(:user_details, :other_role) - with_lock_retries do - add_column :user_details, :other_role, :text - end - end - - add_text_limit :user_details, :other_role, 100 - end - - def down - with_lock_retries do - remove_column :user_details, :other_role - end - end -end diff --git a/db/migrate/20201127170848_add_index_bloat_estimate_view.rb b/db/migrate/20201127170848_add_index_bloat_estimate_view.rb deleted file mode 100644 index ab268f8569e..00000000000 --- a/db/migrate/20201127170848_add_index_bloat_estimate_view.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -class AddIndexBloatEstimateView < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - execute(<<~SQL) - CREATE VIEW postgres_index_bloat_estimates AS - -- Originally from: https://github.com/ioguix/pgsql-bloat-estimation/blob/master/btree/btree_bloat.sql - -- WARNING: executed with a non-superuser role, the query inspect only index on tables you are granted to read. - -- WARNING: rows with is_na = 't' are known to have bad statistics ("name" type is not supported). - -- This query is compatible with PostgreSQL 8.2 and after - SELECT nspname || '.' || idxname as identifier, - CASE WHEN relpages > est_pages_ff - THEN bs*(relpages-est_pages_ff) - ELSE 0 - END::bigint AS bloat_size_bytes - FROM ( - SELECT - coalesce(1 + - ceil(reltuples/floor((bs-pageopqdata-pagehdr)*fillfactor/(100*(4+nulldatahdrwidth)::float))), 0 - ) AS est_pages_ff, - bs, nspname, tblname, idxname, relpages, is_na - FROM ( - SELECT maxalign, bs, nspname, tblname, idxname, reltuples, relpages, idxoid, fillfactor, - ( index_tuple_hdr_bm + - maxalign - CASE -- Add padding to the index tuple header to align on MAXALIGN - WHEN index_tuple_hdr_bm%maxalign = 0 THEN maxalign - ELSE index_tuple_hdr_bm%maxalign - END - + nulldatawidth + maxalign - CASE -- Add padding to the data to align on MAXALIGN - WHEN nulldatawidth = 0 THEN 0 - WHEN nulldatawidth::integer%maxalign = 0 THEN maxalign - ELSE nulldatawidth::integer%maxalign - END - )::numeric AS nulldatahdrwidth, pagehdr, pageopqdata, is_na - FROM ( - SELECT n.nspname, i.tblname, i.idxname, i.reltuples, i.relpages, - i.idxoid, i.fillfactor, current_setting('block_size')::numeric AS bs, - CASE -- MAXALIGN: 4 on 32bits, 8 on 64bits (and mingw32 ?) - WHEN version() ~ 'mingw32' OR version() ~ '64-bit|x86_64|ppc64|ia64|amd64' THEN 8 - ELSE 4 - END AS maxalign, - /* per page header, fixed size: 20 for 7.X, 24 for others */ - 24 AS pagehdr, - /* per page btree opaque data */ - 16 AS pageopqdata, - /* per tuple header: add IndexAttributeBitMapData if some cols are null-able */ - CASE WHEN max(coalesce(s.null_frac,0)) = 0 - THEN 2 -- IndexTupleData size - ELSE 2 + (( 32 + 8 - 1 ) / 8) -- IndexTupleData size + IndexAttributeBitMapData size ( max num filed per index + 8 - 1 /8) - END AS index_tuple_hdr_bm, - /* data len: we remove null values save space using it fractionnal part from stats */ - sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 1024)) AS nulldatawidth, - max( CASE WHEN i.atttypid = 'pg_catalog.name'::regtype THEN 1 ELSE 0 END ) > 0 AS is_na - FROM ( - SELECT ct.relname AS tblname, ct.relnamespace, ic.idxname, ic.attpos, ic.indkey, ic.indkey[ic.attpos], ic.reltuples, ic.relpages, ic.tbloid, ic.idxoid, ic.fillfactor, - coalesce(a1.attnum, a2.attnum) AS attnum, coalesce(a1.attname, a2.attname) AS attname, coalesce(a1.atttypid, a2.atttypid) AS atttypid, - CASE WHEN a1.attnum IS NULL - THEN ic.idxname - ELSE ct.relname - END AS attrelname - FROM ( - SELECT idxname, reltuples, relpages, tbloid, idxoid, fillfactor, indkey, - pg_catalog.generate_series(1,indnatts) AS attpos - FROM ( - SELECT ci.relname AS idxname, ci.reltuples, ci.relpages, i.indrelid AS tbloid, - i.indexrelid AS idxoid, - coalesce(substring( - array_to_string(ci.reloptions, ' ') - from 'fillfactor=([0-9]+)')::smallint, 90) AS fillfactor, - i.indnatts, - pg_catalog.string_to_array(pg_catalog.textin( - pg_catalog.int2vectorout(i.indkey)),' ')::int[] AS indkey - FROM pg_catalog.pg_index i - JOIN pg_catalog.pg_class ci ON ci.oid = i.indexrelid - WHERE ci.relam=(SELECT oid FROM pg_am WHERE amname = 'btree') - AND ci.relpages > 0 - ) AS idx_data - ) AS ic - JOIN pg_catalog.pg_class ct ON ct.oid = ic.tbloid - LEFT JOIN pg_catalog.pg_attribute a1 ON - ic.indkey[ic.attpos] <> 0 - AND a1.attrelid = ic.tbloid - AND a1.attnum = ic.indkey[ic.attpos] - LEFT JOIN pg_catalog.pg_attribute a2 ON - ic.indkey[ic.attpos] = 0 - AND a2.attrelid = ic.idxoid - AND a2.attnum = ic.attpos - ) i - JOIN pg_catalog.pg_namespace n ON n.oid = i.relnamespace - JOIN pg_catalog.pg_stats s ON s.schemaname = n.nspname - AND s.tablename = i.attrelname - AND s.attname = i.attname - GROUP BY 1,2,3,4,5,6,7,8,9,10,11 - ) AS rows_data_stats - ) AS rows_hdr_pdg_stats - ) AS relation_stats - WHERE nspname IN ("current_schema"(), 'gitlab_partitions_dynamic', 'gitlab_partitions_static') AND NOT is_na - ORDER BY nspname, tblname, idxname; - SQL - end - - def down - execute(<<~SQL) - DROP VIEW postgres_index_bloat_estimates - SQL - end -end diff --git a/db/migrate/20201128210000_add_service_desk_reply_to_is_not_null_index_on_issues_fix.rb b/db/migrate/20201128210000_add_service_desk_reply_to_is_not_null_index_on_issues_fix.rb deleted file mode 100644 index 52d24de60d5..00000000000 --- a/db/migrate/20201128210000_add_service_desk_reply_to_is_not_null_index_on_issues_fix.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddServiceDeskReplyToIsNotNullIndexOnIssuesFix < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'idx_on_issues_where_service_desk_reply_to_is_not_null' - - disable_ddl_transaction! - - def up - add_concurrent_index(:issues, [:id], name: INDEX_NAME, where: 'service_desk_reply_to IS NOT NULL') - end - - def down - remove_concurrent_index_by_name(:issues, INDEX_NAME) - end -end diff --git a/db/migrate/20201201033202_add_verification_indexes_for_package_files.rb b/db/migrate/20201201033202_add_verification_indexes_for_package_files.rb deleted file mode 100644 index b7f55101682..00000000000 --- a/db/migrate/20201201033202_add_verification_indexes_for_package_files.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddVerificationIndexesForPackageFiles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - PENDING_VERIFICATION_INDEX_NAME = "packages_packages_pending_verification" - FAILED_VERIFICATION_INDEX_NAME = "packages_packages_failed_verification" - NEEDS_VERIFICATION_INDEX_NAME = "packages_packages_needs_verification" - - disable_ddl_transaction! - - def up - add_concurrent_index :packages_package_files, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME - add_concurrent_index :packages_package_files, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME - add_concurrent_index :packages_package_files, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME - end - - def down - remove_concurrent_index_by_name :packages_package_files, PENDING_VERIFICATION_INDEX_NAME - remove_concurrent_index_by_name :packages_package_files, FAILED_VERIFICATION_INDEX_NAME - remove_concurrent_index_by_name :packages_package_files, NEEDS_VERIFICATION_INDEX_NAME - end -end diff --git a/db/migrate/20201201034258_add_index_for_non_system_noteables.rb b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb deleted file mode 100644 index 5927463e767..00000000000 --- a/db/migrate/20201201034258_add_index_for_non_system_noteables.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddIndexForNonSystemNoteables < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - LEGACY_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type" - NEW_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type_and_system" - - def up - add_concurrent_index :notes, [:noteable_id, :noteable_type, :system], name: NEW_INDEX_NAME - - remove_concurrent_index_by_name :notes, LEGACY_INDEX_NAME - end - - def down - add_concurrent_index :notes, [:noteable_id, :noteable_type], name: LEGACY_INDEX_NAME - - remove_concurrent_index_by_name :notes, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20201201161655_add_primary_key_to_elastic_search_indexed_projects.rb b/db/migrate/20201201161655_add_primary_key_to_elastic_search_indexed_projects.rb deleted file mode 100644 index cf7221693f9..00000000000 --- a/db/migrate/20201201161655_add_primary_key_to_elastic_search_indexed_projects.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class AddPrimaryKeyToElasticSearchIndexedProjects < ActiveRecord::Migration[6.0] - DOWNTIME = false - - UNIQUE_INDEX_NAME = 'index_elasticsearch_indexed_projects_on_project_id' - PRIMARY_KEY_NAME = 'elasticsearch_indexed_projects_pkey' - - def up - execute(<<~SQL) - DELETE FROM elasticsearch_indexed_projects - WHERE project_id IS NULL - SQL - - execute(<<~SQL) - ALTER TABLE elasticsearch_indexed_projects - ALTER COLUMN project_id SET NOT NULL, - ADD CONSTRAINT #{PRIMARY_KEY_NAME} PRIMARY KEY USING INDEX #{UNIQUE_INDEX_NAME} - SQL - end - - def down - add_index :elasticsearch_indexed_projects, :project_id, unique: true, name: UNIQUE_INDEX_NAME # rubocop:disable Migration/AddIndex - - execute(<<~SQL) - ALTER TABLE elasticsearch_indexed_projects - DROP CONSTRAINT #{PRIMARY_KEY_NAME}, - ALTER COLUMN project_id DROP NOT NULL - SQL - end -end diff --git a/db/migrate/20201201163227_add_finding_uuid_to_vulnerability_feedback.rb b/db/migrate/20201201163227_add_finding_uuid_to_vulnerability_feedback.rb deleted file mode 100644 index a2e13806000..00000000000 --- a/db/migrate/20201201163227_add_finding_uuid_to_vulnerability_feedback.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddFindingUuidToVulnerabilityFeedback < ActiveRecord::Migration[6.0] - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def change - add_column :vulnerability_feedback, :finding_uuid, :uuid - end -end diff --git a/db/migrate/20201201175656_add_index_vulnerabilities_on_project_id_and_state_and_severity.rb b/db/migrate/20201201175656_add_index_vulnerabilities_on_project_id_and_state_and_severity.rb deleted file mode 100644 index d0e8920d7a5..00000000000 --- a/db/migrate/20201201175656_add_index_vulnerabilities_on_project_id_and_state_and_severity.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexVulnerabilitiesOnProjectIdAndStateAndSeverity < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_vulnerabilities_on_project_id_and_state_and_severity' - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerabilities, [:project_id, :state, :severity], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME - end -end diff --git a/db/migrate/20201201190002_add_other_context_to_experiment_user.rb b/db/migrate/20201201190002_add_other_context_to_experiment_user.rb deleted file mode 100644 index c901f049e75..00000000000 --- a/db/migrate/20201201190002_add_other_context_to_experiment_user.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddOtherContextToExperimentUser < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :experiment_users, :context, :jsonb, default: {}, null: false - end - end - - def down - with_lock_retries do - remove_column :experiment_users, :context - end - end -end diff --git a/db/migrate/20201201192112_add_primary_key_to_elastic_search_indexed_namespaces.rb b/db/migrate/20201201192112_add_primary_key_to_elastic_search_indexed_namespaces.rb deleted file mode 100644 index 610cd2828ca..00000000000 --- a/db/migrate/20201201192112_add_primary_key_to_elastic_search_indexed_namespaces.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class AddPrimaryKeyToElasticSearchIndexedNamespaces < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - UNIQUE_INDEX_NAME = 'index_elasticsearch_indexed_namespaces_on_namespace_id' - PRIMARY_KEY_NAME = 'elasticsearch_indexed_namespaces_pkey' - - disable_ddl_transaction! - - def up - with_lock_retries do - execute(<<~SQL) - LOCK TABLE elasticsearch_indexed_namespaces IN ACCESS EXCLUSIVE MODE; - - DELETE FROM elasticsearch_indexed_namespaces - WHERE namespace_id IS NULL; - - ALTER TABLE elasticsearch_indexed_namespaces - ADD CONSTRAINT #{PRIMARY_KEY_NAME} PRIMARY KEY USING INDEX #{UNIQUE_INDEX_NAME}; - SQL - end - end - - def down - add_concurrent_index :elasticsearch_indexed_namespaces, :namespace_id, unique: true, name: UNIQUE_INDEX_NAME - - with_lock_retries do - execute(<<~SQL) - ALTER TABLE elasticsearch_indexed_namespaces - DROP CONSTRAINT #{PRIMARY_KEY_NAME}, - ALTER COLUMN namespace_id DROP NOT NULL - SQL - end - end -end diff --git a/db/migrate/20201202003042_add_epic_board_positions.rb b/db/migrate/20201202003042_add_epic_board_positions.rb deleted file mode 100644 index 528d5ed3af1..00000000000 --- a/db/migrate/20201202003042_add_epic_board_positions.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class AddEpicBoardPositions < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - create_table :boards_epic_board_positions do |t| - t.references :epic_board, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false, index: false - t.references :epic, foreign_key: { on_delete: :cascade }, null: false, index: true - t.integer :relative_position - - t.timestamps_with_timezone null: false - - t.index [:epic_board_id, :epic_id], unique: true, name: :index_boards_epic_board_positions_on_epic_board_id_and_epic_id - end - end - end - - def down - with_lock_retries do - drop_table :boards_epic_board_positions - end - end -end diff --git a/db/migrate/20201202025644_add_column_to_security_findings.rb b/db/migrate/20201202025644_add_column_to_security_findings.rb deleted file mode 100644 index 0b63b79d949..00000000000 --- a/db/migrate/20201202025644_add_column_to_security_findings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true -# -class AddColumnToSecurityFindings < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :security_findings, :uuid, :uuid - end -end diff --git a/db/migrate/20201202025937_add_index_to_security_findings_uuid.rb b/db/migrate/20201202025937_add_index_to_security_findings_uuid.rb deleted file mode 100644 index 4c33809fbfc..00000000000 --- a/db/migrate/20201202025937_add_index_to_security_findings_uuid.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToSecurityFindingsUuid < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_security_findings_on_uuid' - - disable_ddl_transaction! - - def up - add_concurrent_index :security_findings, :uuid, name: INDEX_NAME, unique: true - end - - def down - remove_concurrent_index_by_name :security_findings, INDEX_NAME - end -end diff --git a/db/migrate/20201202133606_add_sorted_to_merge_request_diffs.rb b/db/migrate/20201202133606_add_sorted_to_merge_request_diffs.rb deleted file mode 100644 index 4c0d28d70a1..00000000000 --- a/db/migrate/20201202133606_add_sorted_to_merge_request_diffs.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddSortedToMergeRequestDiffs < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :merge_request_diffs, :sorted, :boolean, null: false, default: false - end - end - - def down - with_lock_retries do - remove_column :merge_request_diffs, :sorted - end - end -end diff --git a/db/migrate/20201202142751_drop_index_vulnerabilities_on_project_id.rb b/db/migrate/20201202142751_drop_index_vulnerabilities_on_project_id.rb deleted file mode 100644 index c1ca32a1978..00000000000 --- a/db/migrate/20201202142751_drop_index_vulnerabilities_on_project_id.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class DropIndexVulnerabilitiesOnProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = 'index_vulnerabilities_on_project_id' - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME - end - - def down - add_concurrent_index :vulnerabilities, :project_id, name: INDEX_NAME - end -end diff --git a/db/migrate/20201202150001_add_details_to_vulnerability_findings.rb b/db/migrate/20201202150001_add_details_to_vulnerability_findings.rb deleted file mode 100644 index b7639bdfaa3..00000000000 --- a/db/migrate/20201202150001_add_details_to_vulnerability_findings.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDetailsToVulnerabilityFindings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :vulnerability_occurrences, :details, :jsonb, default: {}, null: false - end - end - - def down - with_lock_retries do - remove_column :vulnerability_occurrences, :details - end - end -end diff --git a/db/migrate/20201202155913_add_primary_key_to_merge_request_context_commit_diff_files.rb b/db/migrate/20201202155913_add_primary_key_to_merge_request_context_commit_diff_files.rb deleted file mode 100644 index 90c7b2731c8..00000000000 --- a/db/migrate/20201202155913_add_primary_key_to_merge_request_context_commit_diff_files.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class AddPrimaryKeyToMergeRequestContextCommitDiffFiles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - execute(<<~SQL) - DELETE FROM merge_request_context_commit_diff_files - WHERE merge_request_context_commit_id IS NULL; - - DELETE FROM merge_request_context_commit_diff_files df1 - USING merge_request_context_commit_diff_files df2 - WHERE df1.ctid < df2.ctid - AND df1.merge_request_context_commit_id = df2.merge_request_context_commit_id - AND df1.relative_order = df2.relative_order; - - ALTER TABLE merge_request_context_commit_diff_files - ADD CONSTRAINT merge_request_context_commit_diff_files_pkey PRIMARY KEY (merge_request_context_commit_id, relative_order); - SQL - end - - def down - execute(<<~SQL) - ALTER TABLE merge_request_context_commit_diff_files - DROP CONSTRAINT merge_request_context_commit_diff_files_pkey, - ALTER COLUMN merge_request_context_commit_id DROP NOT NULL - SQL - end -end diff --git a/db/migrate/20201202160105_add_group_file_name_index_to_dependency_proxy_manifests.rb b/db/migrate/20201202160105_add_group_file_name_index_to_dependency_proxy_manifests.rb deleted file mode 100644 index a0bafeedaec..00000000000 --- a/db/migrate/20201202160105_add_group_file_name_index_to_dependency_proxy_manifests.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class AddGroupFileNameIndexToDependencyProxyManifests < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - NEW_INDEX = 'index_dependency_proxy_manifests_on_group_id_and_file_name' - OLD_INDEX = 'index_dependency_proxy_manifests_on_group_id_and_digest' - - def up - add_concurrent_index :dependency_proxy_manifests, [:group_id, :file_name], name: NEW_INDEX, unique: true - remove_concurrent_index_by_name :dependency_proxy_manifests, OLD_INDEX - end - - def down - add_concurrent_index :dependency_proxy_manifests, [:group_id, :digest], name: OLD_INDEX - remove_concurrent_index_by_name :dependency_proxy_manifests, NEW_INDEX - end -end diff --git a/db/migrate/20201202161021_remove_redundant_index_on_merge_request_context_commit_diff_files.rb b/db/migrate/20201202161021_remove_redundant_index_on_merge_request_context_commit_diff_files.rb deleted file mode 100644 index a9c0a079955..00000000000 --- a/db/migrate/20201202161021_remove_redundant_index_on_merge_request_context_commit_diff_files.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class RemoveRedundantIndexOnMergeRequestContextCommitDiffFiles < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name :merge_request_context_commit_diff_files, 'idx_mr_cc_diff_files_on_mr_cc_id' - end - - def down - # no-op: this index is not tracked in structure.sql, and is redundant due to idx_mr_cc_diff_files_on_mr_cc_id_and_sha - end -end diff --git a/db/migrate/20201203123524_add_domain_enum_to_alerts.rb b/db/migrate/20201203123524_add_domain_enum_to_alerts.rb deleted file mode 100644 index f1dec91a346..00000000000 --- a/db/migrate/20201203123524_add_domain_enum_to_alerts.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddDomainEnumToAlerts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :alert_management_alerts, :domain, :integer, limit: 2, default: 0 - end - end - - def down - with_lock_retries do - remove_column :alert_management_alerts, :domain, :integer, limit: 2 - end - end -end diff --git a/db/migrate/20201203144655_add_allow_to_edit_commit_to_project_settings.rb b/db/migrate/20201203144655_add_allow_to_edit_commit_to_project_settings.rb deleted file mode 100644 index fb2f7366955..00000000000 --- a/db/migrate/20201203144655_add_allow_to_edit_commit_to_project_settings.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class AddAllowToEditCommitToProjectSettings < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - # no-op - end - - def down - # no-op - end -end diff --git a/db/migrate/20201203171631_add_index_to_domain.rb b/db/migrate/20201203171631_add_index_to_domain.rb deleted file mode 100644 index dc7b9539e95..00000000000 --- a/db/migrate/20201203171631_add_index_to_domain.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToDomain < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - DOWNTIME = false - INDEX_NAME = 'index_alert_management_alerts_on_domain' - - disable_ddl_transaction! - - def up - add_concurrent_index :alert_management_alerts, :domain, name: INDEX_NAME - end - - def down - remove_concurrent_index :alert_management_alerts, :domain, name: INDEX_NAME - end -end diff --git a/db/migrate/20201204085522_add_project_id_into_vulnerability_remediations.rb b/db/migrate/20201204085522_add_project_id_into_vulnerability_remediations.rb deleted file mode 100644 index 6a136ab0389..00000000000 --- a/db/migrate/20201204085522_add_project_id_into_vulnerability_remediations.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddProjectIdIntoVulnerabilityRemediations < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - connection.execute('DELETE FROM vulnerability_remediations') - - add_column :vulnerability_remediations, :project_id, :bigint, null: false # rubocop:disable Rails/NotNullColumn - end - - def down - with_lock_retries do - remove_column :vulnerability_remediations, :project_id - end - end -end diff --git a/db/migrate/20201204090855_add_compound_index_to_vulnerability_remediations_table.rb b/db/migrate/20201204090855_add_compound_index_to_vulnerability_remediations_table.rb deleted file mode 100644 index 0b4b6e552aa..00000000000 --- a/db/migrate/20201204090855_add_compound_index_to_vulnerability_remediations_table.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -class AddCompoundIndexToVulnerabilityRemediationsTable < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - NEW_INDEX_NAME = 'index_vulnerability_remediations_on_project_id_and_checksum' - OLD_INDEX_NAME = 'index_vulnerability_remediations_on_checksum' - - disable_ddl_transaction! - - def up - add_concurrent_index :vulnerability_remediations, [:project_id, :checksum], unique: true, name: NEW_INDEX_NAME - add_concurrent_foreign_key :vulnerability_remediations, :projects, column: :project_id - - remove_concurrent_index_by_name :vulnerability_remediations, OLD_INDEX_NAME - end - - def down - add_concurrent_index :vulnerability_remediations, :checksum, unique: true, name: OLD_INDEX_NAME - - remove_concurrent_index_by_name :vulnerability_remediations, NEW_INDEX_NAME - - with_lock_retries do - remove_foreign_key_if_exists :vulnerability_remediations, column: :project_id - end - end -end diff --git a/db/migrate/20201204105300_create_packages_debian_file_metadata.rb b/db/migrate/20201204105300_create_packages_debian_file_metadata.rb deleted file mode 100644 index 2bba1b6f38e..00000000000 --- a/db/migrate/20201204105300_create_packages_debian_file_metadata.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianFileMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - unless table_exists?(:packages_debian_file_metadata) - create_table :packages_debian_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.integer :file_type, limit: 2, null: false - t.text :component - t.text :architecture - t.jsonb :fields - end - end - - add_text_limit :packages_debian_file_metadata, :component, 255 - add_text_limit :packages_debian_file_metadata, :architecture, 255 - end - - def down - drop_table :packages_debian_file_metadata - end -end diff --git a/db/migrate/20201204110700_create_packages_debian_project_distributions.rb b/db/migrate/20201204110700_create_packages_debian_project_distributions.rb deleted file mode 100644 index 5fe45c6236f..00000000000 --- a/db/migrate/20201204110700_create_packages_debian_project_distributions.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianProjectDistributions < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - UNIQUE_CODENAME = 'uniq_pkgs_debian_project_distributions_project_id_and_codename' - UNIQUE_SUITE = 'uniq_pkgs_debian_project_distributions_project_id_and_suite' - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:packages_debian_project_distributions) - create_table :packages_debian_project_distributions do |t| - t.timestamps_with_timezone - t.references :project, foreign_key: { to_table: :projects, on_delete: :restrict }, null: false - t.references :creator, foreign_key: { to_table: :users, on_delete: :nullify } - t.integer :valid_time_duration_seconds - t.integer :file_store, limit: 2, default: 1, null: false - t.boolean :automatic, default: true, null: false - t.boolean :automatic_upgrades, default: false, null: false - t.text :codename, null: false - t.text :suite - t.text :origin - t.text :label - t.text :version - t.text :description - t.text :encrypted_signing_keys - t.text :encrypted_signing_keys_iv - t.text :file - t.text :file_signature - - t.index %w(project_id codename), - name: UNIQUE_CODENAME, - unique: true, - using: :btree - t.index %w(project_id suite), - name: UNIQUE_SUITE, - unique: true, - using: :btree - end - end - end - - add_text_limit :packages_debian_project_distributions, :codename, 255 - add_text_limit :packages_debian_project_distributions, :suite, 255 - add_text_limit :packages_debian_project_distributions, :origin, 255 - add_text_limit :packages_debian_project_distributions, :label, 255 - add_text_limit :packages_debian_project_distributions, :version, 255 - add_text_limit :packages_debian_project_distributions, :description, 255 - add_text_limit :packages_debian_project_distributions, :encrypted_signing_keys, 2048 - add_text_limit :packages_debian_project_distributions, :encrypted_signing_keys_iv, 255 - add_text_limit :packages_debian_project_distributions, :file, 255 - add_text_limit :packages_debian_project_distributions, :file_signature, 4096 - end - - def down - drop_table :packages_debian_project_distributions - end -end diff --git a/db/migrate/20201204110800_create_packages_debian_group_distributions.rb b/db/migrate/20201204110800_create_packages_debian_group_distributions.rb deleted file mode 100644 index 9ad9a59b3e9..00000000000 --- a/db/migrate/20201204110800_create_packages_debian_group_distributions.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianGroupDistributions < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - UNIQUE_CODENAME = 'uniq_pkgs_debian_group_distributions_group_id_and_codename' - UNIQUE_SUITE = 'uniq_pkgs_debian_group_distributions_group_id_and_suite' - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:packages_debian_group_distributions) - create_table :packages_debian_group_distributions do |t| - t.timestamps_with_timezone - t.references :group, foreign_key: { to_table: :namespaces, on_delete: :restrict }, null: false - t.references :creator, foreign_key: { to_table: :users, on_delete: :nullify } - t.integer :valid_time_duration_seconds - t.integer :file_store, limit: 2, default: 1, null: false - t.boolean :automatic, default: true, null: false - t.boolean :automatic_upgrades, default: false, null: false - t.text :codename, null: false - t.text :suite - t.text :origin - t.text :label - t.text :version - t.text :description - t.text :encrypted_signing_keys - t.text :encrypted_signing_keys_iv - t.text :file - t.text :file_signature - - t.index %w(group_id codename), - name: UNIQUE_CODENAME, - unique: true, - using: :btree - t.index %w(group_id suite), - name: UNIQUE_SUITE, - unique: true, - using: :btree - end - end - end - - add_text_limit :packages_debian_group_distributions, :codename, 255 - add_text_limit :packages_debian_group_distributions, :suite, 255 - add_text_limit :packages_debian_group_distributions, :origin, 255 - add_text_limit :packages_debian_group_distributions, :label, 255 - add_text_limit :packages_debian_group_distributions, :version, 255 - add_text_limit :packages_debian_group_distributions, :description, 255 - add_text_limit :packages_debian_group_distributions, :encrypted_signing_keys, 2048 - add_text_limit :packages_debian_group_distributions, :encrypted_signing_keys_iv, 255 - add_text_limit :packages_debian_group_distributions, :file, 255 - add_text_limit :packages_debian_group_distributions, :file_signature, 4096 - end - - def down - drop_table :packages_debian_group_distributions - end -end diff --git a/db/migrate/20201204111000_create_packages_debian_project_architectures.rb b/db/migrate/20201204111000_create_packages_debian_project_architectures.rb deleted file mode 100644 index f684a413873..00000000000 --- a/db/migrate/20201204111000_create_packages_debian_project_architectures.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianProjectArchitectures < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'idx_pkgs_deb_proj_architectures_on_distribution_id' - UNIQUE_NAME = 'uniq_pkgs_deb_proj_architectures_on_distribution_id_and_name' - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:packages_debian_project_architectures) - create_table :packages_debian_project_architectures do |t| - t.timestamps_with_timezone - t.references :distribution, - foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade }, - null: false, - index: { name: INDEX_NAME } - t.text :name, null: false - - t.index %w(distribution_id name), - name: UNIQUE_NAME, - unique: true, - using: :btree - end - end - end - - add_text_limit :packages_debian_project_architectures, :name, 255 - end - - def down - drop_table :packages_debian_project_architectures - end -end diff --git a/db/migrate/20201204111100_create_packages_debian_group_architectures.rb b/db/migrate/20201204111100_create_packages_debian_group_architectures.rb deleted file mode 100644 index 8a001414c45..00000000000 --- a/db/migrate/20201204111100_create_packages_debian_group_architectures.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianGroupArchitectures < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_NAME = 'idx_pkgs_deb_grp_architectures_on_distribution_id' - UNIQUE_NAME = 'uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name' - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:packages_debian_group_architectures) - create_table :packages_debian_group_architectures do |t| - t.timestamps_with_timezone - t.references :distribution, - foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade }, - null: false, - index: { name: INDEX_NAME } - t.text :name, null: false - - t.index %w(distribution_id name), - name: UNIQUE_NAME, - unique: true, - using: :btree - end - end - end - - add_text_limit :packages_debian_group_architectures, :name, 255 - end - - def down - drop_table :packages_debian_group_architectures - end -end diff --git a/db/migrate/20201204111200_create_packages_debian_project_components.rb b/db/migrate/20201204111200_create_packages_debian_project_components.rb deleted file mode 100644 index 76946967357..00000000000 --- a/db/migrate/20201204111200_create_packages_debian_project_components.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianProjectComponents < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - UNIQUE_NAME = 'uniq_pkgs_deb_proj_components_on_distribution_id_and_name' - - disable_ddl_transaction! - - def up - unless table_exists?(:packages_debian_project_components) - create_table :packages_debian_project_components do |t| - t.timestamps_with_timezone - t.references :distribution, - foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade }, - null: false, - index: false - t.text :name, null: false - - t.index %w(distribution_id name), - name: UNIQUE_NAME, - unique: true, - using: :btree - end - end - - add_text_limit :packages_debian_project_components, :name, 255 - end - - def down - drop_table :packages_debian_project_components - end -end diff --git a/db/migrate/20201204111300_create_packages_debian_group_components.rb b/db/migrate/20201204111300_create_packages_debian_group_components.rb deleted file mode 100644 index c69f8d10c2b..00000000000 --- a/db/migrate/20201204111300_create_packages_debian_group_components.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianGroupComponents < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - UNIQUE_NAME = 'uniq_pkgs_deb_grp_components_on_distribution_id_and_name' - - disable_ddl_transaction! - - def up - unless table_exists?(:packages_debian_group_components) - create_table :packages_debian_group_components do |t| - t.timestamps_with_timezone - t.references :distribution, - foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade }, - null: false, - index: false - t.text :name, null: false - - t.index %w(distribution_id name), - name: UNIQUE_NAME, - unique: true, - using: :btree - end - end - - add_text_limit :packages_debian_group_components, :name, 255 - end - - def down - drop_table :packages_debian_group_components - end -end diff --git a/db/migrate/20201204111400_create_packages_debian_project_component_files.rb b/db/migrate/20201204111400_create_packages_debian_project_component_files.rb deleted file mode 100644 index 74ee1e9c4cf..00000000000 --- a/db/migrate/20201204111400_create_packages_debian_project_component_files.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianProjectComponentFiles < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_ARCHITECTURE = 'idx_packages_debian_project_component_files_on_architecture_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:packages_debian_project_component_files) - create_table :packages_debian_project_component_files do |t| - t.timestamps_with_timezone - t.references :component, - foreign_key: { to_table: :packages_debian_project_components, on_delete: :restrict }, - null: false, - index: true - t.references :architecture, - foreign_key: { to_table: :packages_debian_project_architectures, on_delete: :restrict }, - index: { name: INDEX_ARCHITECTURE } - t.integer :size, null: false - t.integer :file_type, limit: 2, null: false - t.integer :compression_type, limit: 2 - t.integer :file_store, limit: 2, default: 1, null: false - t.text :file, null: false - t.binary :file_md5, null: false - t.binary :file_sha256, null: false - end - end - end - - add_text_limit :packages_debian_project_component_files, :file, 255 - end - - def down - drop_table :packages_debian_project_component_files - end -end diff --git a/db/migrate/20201204111500_create_packages_debian_group_component_files.rb b/db/migrate/20201204111500_create_packages_debian_group_component_files.rb deleted file mode 100644 index 2592d5b108a..00000000000 --- a/db/migrate/20201204111500_create_packages_debian_group_component_files.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianGroupComponentFiles < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - INDEX_ARCHITECTURE = 'idx_packages_debian_group_component_files_on_architecture_id' - - disable_ddl_transaction! - - def up - with_lock_retries do - unless table_exists?(:packages_debian_group_component_files) - create_table :packages_debian_group_component_files do |t| - t.timestamps_with_timezone - t.references :component, - foreign_key: { to_table: :packages_debian_group_components, on_delete: :restrict }, - null: false, - index: true - t.references :architecture, - foreign_key: { to_table: :packages_debian_group_architectures, on_delete: :restrict }, - index: { name: INDEX_ARCHITECTURE } - t.integer :size, null: false - t.integer :file_type, limit: 2, null: false - t.integer :compression_type, limit: 2 - t.integer :file_store, limit: 2, default: 1, null: false - t.text :file, null: false - t.binary :file_md5, null: false - t.binary :file_sha256, null: false - end - end - end - - add_text_limit :packages_debian_group_component_files, :file, 255 - end - - def down - drop_table :packages_debian_group_component_files - end -end diff --git a/db/migrate/20201204111600_create_packages_debian_publications.rb b/db/migrate/20201204111600_create_packages_debian_publications.rb deleted file mode 100644 index 2fd26c2c367..00000000000 --- a/db/migrate/20201204111600_create_packages_debian_publications.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class CreatePackagesDebianPublications < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - create_table :packages_debian_publications do |t| - t.references :package, - index: { unique: true }, - null: false, - foreign_key: { to_table: :packages_packages, on_delete: :cascade } - t.references :distribution, - null: false, - foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade } - end - end -end diff --git a/db/migrate/20201204141038_add_trace_bytesize_to_ci_build_pending_states.rb b/db/migrate/20201204141038_add_trace_bytesize_to_ci_build_pending_states.rb deleted file mode 100644 index c866493e8d8..00000000000 --- a/db/migrate/20201204141038_add_trace_bytesize_to_ci_build_pending_states.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddTraceBytesizeToCiBuildPendingStates < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :ci_build_pending_states, :trace_bytesize, :bigint - end -end diff --git a/db/migrate/20201204193952_keep_latest_artifact_project_level.rb b/db/migrate/20201204193952_keep_latest_artifact_project_level.rb deleted file mode 100644 index 3fc9fad1dc6..00000000000 --- a/db/migrate/20201204193952_keep_latest_artifact_project_level.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class KeepLatestArtifactProjectLevel < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :project_ci_cd_settings, :keep_latest_artifact, :boolean, default: true, null: false - end - end - - def down - with_lock_retries do - remove_column :project_ci_cd_settings, :keep_latest_artifact - end - end -end diff --git a/db/migrate/20201204205814_add_member_events_to_web_hooks.rb b/db/migrate/20201204205814_add_member_events_to_web_hooks.rb deleted file mode 100644 index edb374f1bdd..00000000000 --- a/db/migrate/20201204205814_add_member_events_to_web_hooks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddMemberEventsToWebHooks < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :web_hooks, :member_events, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20201204215353_add_pull_mirror_interval_to_plan_limits.rb b/db/migrate/20201204215353_add_pull_mirror_interval_to_plan_limits.rb deleted file mode 100644 index 3484e4c8afa..00000000000 --- a/db/migrate/20201204215353_add_pull_mirror_interval_to_plan_limits.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddPullMirrorIntervalToPlanLimits < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def change - add_column :plan_limits, :pull_mirror_interval_seconds, :integer, default: 300, null: false - end -end diff --git a/db/migrate/20201208081429_update_internal_ids_last_value_for_epics_renamed.rb b/db/migrate/20201208081429_update_internal_ids_last_value_for_epics_renamed.rb deleted file mode 100644 index fadc365d53c..00000000000 --- a/db/migrate/20201208081429_update_internal_ids_last_value_for_epics_renamed.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class UpdateInternalIdsLastValueForEpicsRenamed < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - ApplicationRecord.connection.execute(<<-SQL.squish) - UPDATE internal_ids - SET last_value = epics_max_iids.maximum_iid - FROM - ( - SELECT - MAX(epics.iid) AS maximum_iid, - epics.group_id AS epics_group_id - FROM epics - GROUP BY epics.group_id - ) epics_max_iids - WHERE internal_ids.last_value < epics_max_iids.maximum_iid - AND namespace_id = epics_max_iids.epics_group_id - AND internal_ids.usage = 4 - SQL - end - - def down - # no-op - end -end diff --git a/db/migrate/20201208143911_add_approvals_created_at_index.rb b/db/migrate/20201208143911_add_approvals_created_at_index.rb deleted file mode 100644 index cfec6b257c2..00000000000 --- a/db/migrate/20201208143911_add_approvals_created_at_index.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddApprovalsCreatedAtIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - INDEX_NAME = 'index_approvals_on_merge_request_id_and_created_at' - - def up - add_concurrent_index :approvals, [:merge_request_id, :created_at], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :approvals, INDEX_NAME - end -end diff --git a/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb b/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb deleted file mode 100644 index ea63d2d1ed3..00000000000 --- a/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class RemoveTemporaryBlockingIssuesIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocking_type_links') - remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocked_by_type_links') - remove_concurrent_index_by_name(:issues, 'tmp_idx_index_issues_with_outdate_blocking_count') - end - - def down - add_concurrent_index :issue_links, [:source_id], where: 'link_type = 1', name: 'tmp_idx_blocking_type_links' - add_concurrent_index :issue_links, [:target_id], where: 'link_type = 2', name: 'tmp_idx_blocked_by_type_links' - add_concurrent_index :issues, :id, where: '(state_id = 1 AND blocking_issues_count = 0)', name: 'tmp_idx_index_issues_with_outdate_blocking_count' - end -end diff --git a/db/migrate/20201208210209_create_incident_management_oncall_shifts.rb b/db/migrate/20201208210209_create_incident_management_oncall_shifts.rb deleted file mode 100644 index 49cb32ffee0..00000000000 --- a/db/migrate/20201208210209_create_incident_management_oncall_shifts.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class CreateIncidentManagementOncallShifts < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - unless table_exists?(:incident_management_oncall_shifts) - with_lock_retries do - create_table :incident_management_oncall_shifts do |t| - t.references :rotation, null: false, foreign_key: { to_table: :incident_management_oncall_rotations, on_delete: :cascade } - t.references :participant, null: false, foreign_key: { to_table: :incident_management_oncall_participants, on_delete: :cascade } - t.datetime_with_timezone :starts_at, null: false - t.datetime_with_timezone :ends_at, null: false - end - - execute <<~SQL - ALTER TABLE incident_management_oncall_shifts - ADD CONSTRAINT inc_mgmnt_no_overlapping_oncall_shifts - EXCLUDE USING gist - ( rotation_id WITH =, - tstzrange(starts_at, ends_at, '[)') WITH && - ) - SQL - end - end - end - - def down - with_lock_retries do - drop_table :incident_management_oncall_shifts - end - end -end diff --git a/db/migrate/20201209154746_expand_ci_pipelines_index_on_ci_ref_id.rb b/db/migrate/20201209154746_expand_ci_pipelines_index_on_ci_ref_id.rb deleted file mode 100644 index b88763a30f9..00000000000 --- a/db/migrate/20201209154746_expand_ci_pipelines_index_on_ci_ref_id.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class ExpandCiPipelinesIndexOnCiRefId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - NEW_NAME = 'index_ci_pipelines_on_ci_ref_id_and_more' - OLD_NAME = 'index_ci_pipelines_on_ci_ref_id' - - def up - add_concurrent_index :ci_pipelines, %i[ci_ref_id id source status], order: { id: :desc }, where: 'ci_ref_id IS NOT NULL', name: NEW_NAME - - remove_concurrent_index_by_name :ci_pipelines, OLD_NAME - end - - def down - add_concurrent_index :ci_pipelines, :ci_ref_id, where: 'ci_ref_id IS NOT NULL', name: OLD_NAME - - remove_concurrent_index_by_name :ci_pipelines, NEW_NAME - end -end diff --git a/db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb b/db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb deleted file mode 100644 index 9cbf68fd63a..00000000000 --- a/db/migrate/20201209163113_recreate_index_issue_email_participants_on_issue_id_and_email.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class RecreateIndexIssueEmailParticipantsOnIssueIdAndEmail < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - OLD_INDEX_NAME = 'index_issue_email_participants_on_issue_id_and_email' - NEW_INDEX_NAME = 'index_issue_email_participants_on_issue_id_and_lower_email' - - def up - # This table is currently empty, so no need to worry about unique index violations - add_concurrent_index :issue_email_participants, 'issue_id, lower(email)', unique: true, name: NEW_INDEX_NAME - remove_concurrent_index_by_name :issue_email_participants, OLD_INDEX_NAME - end - - def down - add_concurrent_index :issue_email_participants, [:issue_id, :email], unique: true, name: OLD_INDEX_NAME - remove_concurrent_index_by_name :issue_email_participants, NEW_INDEX_NAME - end -end diff --git a/db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb b/db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb deleted file mode 100644 index 48292cce55b..00000000000 --- a/db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class AddCodeChallengeToOauthAccessGrants < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_column(:oauth_access_grants, :code_challenge, :text, null: true) unless column_exists?(:oauth_access_grants, :code_challenge) - # If `code_challenge_method` is 'plain' the length is at most 128 characters as per the spec - # https://tools.ietf.org/html/rfc7636#section-4.1 - # Otherwise the max length of base64(SHA256(code_verifier)) is 44 characters - add_text_limit(:oauth_access_grants, :code_challenge, 128, constraint_name: 'oauth_access_grants_code_challenge') - - add_column(:oauth_access_grants, :code_challenge_method, :text, null: true) unless column_exists?(:oauth_access_grants, :code_challenge_method) - # Values are either 'plain' or 'S256' - add_text_limit(:oauth_access_grants, :code_challenge_method, 5, constraint_name: 'oauth_access_grants_code_challenge_method') - end - - def down - remove_column(:oauth_access_grants, :code_challenge) - remove_column(:oauth_access_grants, :code_challenge_method) - end -end diff --git a/db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb b/db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb deleted file mode 100644 index 62d0cdae8bc..00000000000 --- a/db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddVersionShaCacheToComposerMetadata < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - with_lock_retries do - add_column :packages_composer_metadata, :version_cache_sha, :binary, null: true - end - end - - def down - with_lock_retries do - remove_column :packages_composer_metadata, :version_cache_sha, :binary - end - end -end diff --git a/db/migrate/20201210101250_add_index_projects_on_import_type_and_creator_id.rb b/db/migrate/20201210101250_add_index_projects_on_import_type_and_creator_id.rb deleted file mode 100644 index 5eb8f1d658e..00000000000 --- a/db/migrate/20201210101250_add_index_projects_on_import_type_and_creator_id.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexProjectsOnImportTypeAndCreatorId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :projects, [:creator_id, :import_type, :created_at], - where: 'import_type IS NOT NULL', - name: 'index_projects_on_creator_id_import_type_and_created_at_partial' - end - - def down - remove_concurrent_index_by_name :projects, 'index_projects_on_creator_id_import_type_and_created_at_partial' - end -end diff --git a/db/migrate/20201210175044_add_index_to_snippet_on_project_id.rb b/db/migrate/20201210175044_add_index_to_snippet_on_project_id.rb deleted file mode 100644 index 6de4a840409..00000000000 --- a/db/migrate/20201210175044_add_index_to_snippet_on_project_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToSnippetOnProjectId < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - INDEX_NAME = "index_snippet_on_id_and_project_id" - DOWNTIME = false - - disable_ddl_transaction! - - def up - add_concurrent_index :snippets, [:id, :project_id], name: INDEX_NAME - end - - def down - remove_concurrent_index_by_name :snippets, INDEX_NAME - end -end diff --git a/db/migrate/20201211042306_add_deployments_finder_by_finished_at_index.rb b/db/migrate/20201211042306_add_deployments_finder_by_finished_at_index.rb deleted file mode 100644 index f937ff7a436..00000000000 --- a/db/migrate/20201211042306_add_deployments_finder_by_finished_at_index.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class AddDeploymentsFinderByFinishedAtIndex < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - INDEX_NAME = "index_deployments_on_project_and_finished" - - disable_ddl_transaction! - - def up - add_concurrent_index :deployments, - [:project_id, :finished_at], - where: 'status = 2', - name: INDEX_NAME - end - - def down - remove_concurrent_index :deployments, - [:project_id, :finished_at], - where: 'status = 2', - name: INDEX_NAME - end -end diff --git a/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb b/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb index 3d81db87143..5db39334550 100644 --- a/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb +++ b/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb @@ -20,7 +20,6 @@ class AssociateExistingDastBuildsWithVariables < ActiveRecord::Migration[6.1] class Build < ApplicationRecord self.table_name = 'ci_builds' self.inheritance_column = :_type_disabled - self.gitlab_schema = :gitlab_ci default_scope { where(name: :dast, stage: :dast) } # rubocop:disable Cop/DefaultScope end diff --git a/db/migrate/20211004122540_create_member_tasks.rb b/db/migrate/20211004122540_create_member_tasks.rb new file mode 100644 index 00000000000..e1141873bcb --- /dev/null +++ b/db/migrate/20211004122540_create_member_tasks.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class CreateMemberTasks < Gitlab::Database::Migration[1.0] + def change + create_table :member_tasks do |t| + t.references :member, index: true, null: false + t.references :project, index: true, null: false + t.timestamps_with_timezone null: false + t.integer :tasks, limit: 2, array: true, null: false, default: [] + t.index [:member_id, :project_id], unique: true + end + end +end diff --git a/db/migrate/20211005112404_add_member_id_foreign_key_to_member_tasks.rb b/db/migrate/20211005112404_add_member_id_foreign_key_to_member_tasks.rb new file mode 100644 index 00000000000..f3447918ad3 --- /dev/null +++ b/db/migrate/20211005112404_add_member_id_foreign_key_to_member_tasks.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddMemberIdForeignKeyToMemberTasks < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :member_tasks, :members, column: :member_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :member_tasks, column: :member_id + end + end +end diff --git a/db/migrate/20211005112645_add_project_id_foreign_key_to_member_tasks.rb b/db/migrate/20211005112645_add_project_id_foreign_key_to_member_tasks.rb new file mode 100644 index 00000000000..ead6bb88e60 --- /dev/null +++ b/db/migrate/20211005112645_add_project_id_foreign_key_to_member_tasks.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddProjectIdForeignKeyToMemberTasks < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :member_tasks, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :member_tasks, column: :project_id + end + end +end diff --git a/db/migrate/20211008193137_add_health_status_column_on_clusters_integration_prometheus.rb b/db/migrate/20211008193137_add_health_status_column_on_clusters_integration_prometheus.rb new file mode 100644 index 00000000000..a69d12d4e52 --- /dev/null +++ b/db/migrate/20211008193137_add_health_status_column_on_clusters_integration_prometheus.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddHealthStatusColumnOnClustersIntegrationPrometheus < Gitlab::Database::Migration[1.0] + def change + # For now, health checks will only run on monitor demo projects + add_column :clusters_integration_prometheus, :health_status, :smallint, limit: 2, default: 0, null: false + end +end diff --git a/db/migrate/20211011004242_create_content_blocked_states.rb b/db/migrate/20211011004242_create_content_blocked_states.rb new file mode 100644 index 00000000000..d70717f9786 --- /dev/null +++ b/db/migrate/20211011004242_create_content_blocked_states.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateContentBlockedStates < Gitlab::Database::Migration[1.0] + def change + create_table :content_blocked_states, comment: 'JiHu-specific table' do |t| + t.timestamps_with_timezone null: false + t.binary :commit_sha, null: false + t.binary :blob_sha, null: false + t.text :path, null: false, limit: 2048 + t.text :container_identifier, null: false, limit: 255 + + t.index [:container_identifier, :commit_sha, :path], name: 'index_content_blocked_states_on_container_id_commit_sha_path', unique: true + end + end +end diff --git a/db/migrate/20211012015903_next_traversal_ids_sibling_function.rb b/db/migrate/20211012015903_next_traversal_ids_sibling_function.rb new file mode 100644 index 00000000000..f32b8fc5a65 --- /dev/null +++ b/db/migrate/20211012015903_next_traversal_ids_sibling_function.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class NextTraversalIdsSiblingFunction < Gitlab::Database::Migration[1.0] + include Gitlab::Database::SchemaHelpers + + FUNCTION_NAME = 'next_traversal_ids_sibling' + + def up + # Given array [1,2,3,4,5], concatenate the first part of the array [1,2,3,4] + # with the last element in the array (5) after being incremented ([6]). + # + # [1,2,3,4,5] => [1,2,3,4,6] + execute(<<~SQL) + CREATE OR REPLACE FUNCTION #{FUNCTION_NAME}(traversal_ids INT[]) RETURNS INT[] + AS $$ + BEGIN + return traversal_ids[1:array_length(traversal_ids, 1)-1] || + ARRAY[traversal_ids[array_length(traversal_ids, 1)]+1]; + END; + $$ + LANGUAGE plpgsql + IMMUTABLE + RETURNS NULL ON NULL INPUT; + SQL + end + + def down + execute("DROP FUNCTION #{FUNCTION_NAME}(traversal_ids INT[])") + end +end diff --git a/db/migrate/20211012134316_clean_up_migrate_merge_request_diff_commit_users.rb b/db/migrate/20211012134316_clean_up_migrate_merge_request_diff_commit_users.rb new file mode 100644 index 00000000000..443dbe37c0b --- /dev/null +++ b/db/migrate/20211012134316_clean_up_migrate_merge_request_diff_commit_users.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CleanUpMigrateMergeRequestDiffCommitUsers < Gitlab::Database::Migration[1.0] + def up + jobs = Gitlab::Database::BackgroundMigrationJob + .for_migration_class('MigrateMergeRequestDiffCommitUsers') + .pending + .to_a + + return if jobs.empty? + + say("#{jobs.length} MigrateMergeRequestDiffCommitUsers are still pending") + + # Normally we don't process background migrations in a regular migration, as + # this could take a while to complete and thus block a deployment. + # + # In this case the jobs have all been processed for GitLab.com at the time + # of writing. In addition, it's been a few releases since this migration was + # introduced. As a result, self-hosted instances should have their + # migrations finished a long time ago. + # + # For these reasons we clean up any pending jobs (just in case) before + # deploying the code. This also allows us to immediately start using the new + # setup only, instead of having to support both the old and new approach for + # at least one more release. + jobs.each do |job| + Gitlab::BackgroundMigration::MigrateMergeRequestDiffCommitUsers + .new + .perform(*job.arguments) + end + end + + def down + end +end diff --git a/db/migrate/20211013014228_add_content_validation_endpoint_to_application_settings.rb b/db/migrate/20211013014228_add_content_validation_endpoint_to_application_settings.rb new file mode 100644 index 00000000000..9a79fdca192 --- /dev/null +++ b/db/migrate/20211013014228_add_content_validation_endpoint_to_application_settings.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddContentValidationEndpointToApplicationSettings < Gitlab::Database::Migration[1.0] + def up + # rubocop:disable Migration/AddLimitToTextColumns + add_column :application_settings, :content_validation_endpoint_url, :text, comment: 'JiHu-specific column' + # rubocop:disable Migration/AddLimitToTextColumns + + add_column :application_settings, :encrypted_content_validation_api_key, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :encrypted_content_validation_api_key_iv, :binary, comment: 'JiHu-specific column' + add_column :application_settings, :content_validation_endpoint_enabled, :boolean, null: false, default: false, comment: 'JiHu-specific column' + end + + def down + remove_column :application_settings, :content_validation_endpoint_url + remove_column :application_settings, :encrypted_content_validation_api_key + remove_column :application_settings, :encrypted_content_validation_api_key_iv + remove_column :application_settings, :content_validation_endpoint_enabled + end +end diff --git a/db/migrate/20211013080714_add_network_to_user_credit_card_validations.rb b/db/migrate/20211013080714_add_network_to_user_credit_card_validations.rb new file mode 100644 index 00000000000..eee4cbad796 --- /dev/null +++ b/db/migrate/20211013080714_add_network_to_user_credit_card_validations.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddNetworkToUserCreditCardValidations < Gitlab::Database::Migration[1.0] + # rubocop:disable Migration/AddLimitToTextColumns + def change + add_column :user_credit_card_validations, :network, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20211013080715_limit_network_on_user_credit_card_validations.rb b/db/migrate/20211013080715_limit_network_on_user_credit_card_validations.rb new file mode 100644 index 00000000000..38a019e718d --- /dev/null +++ b/db/migrate/20211013080715_limit_network_on_user_credit_card_validations.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class LimitNetworkOnUserCreditCardValidations < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_text_limit :user_credit_card_validations, :network, 32 + end + + def down + remove_text_limit :user_credit_card_validations, :network + end +end diff --git a/db/migrate/20211013080716_index_include_network_on_user_credit_card_validations.rb b/db/migrate/20211013080716_index_include_network_on_user_credit_card_validations.rb new file mode 100644 index 00000000000..849dbab77db --- /dev/null +++ b/db/migrate/20211013080716_index_include_network_on_user_credit_card_validations.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class IndexIncludeNetworkOnUserCreditCardValidations < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_user_credit_card_validations_meta_data_partial_match' + + def up + add_concurrent_index :user_credit_card_validations, + [:expiration_date, :last_digits, :network, :credit_card_validated_at], + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :user_credit_card_validations, INDEX_NAME + end +end diff --git a/db/migrate/20211013192749_add_states_into_approval_project_rules.rb b/db/migrate/20211013192749_add_states_into_approval_project_rules.rb new file mode 100644 index 00000000000..98fefbab12c --- /dev/null +++ b/db/migrate/20211013192749_add_states_into_approval_project_rules.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddStatesIntoApprovalProjectRules < Gitlab::Database::Migration[1.0] + def up + add_column :approval_project_rules, :vulnerability_states, :text, array: true, null: false, default: ['newly_detected'] + end + + def down + remove_column :approval_project_rules, :vulnerability_states + end +end diff --git a/db/migrate/20211015021114_add_merge_commit_template_to_project_settings.rb b/db/migrate/20211015021114_add_merge_commit_template_to_project_settings.rb new file mode 100644 index 00000000000..adf2fdb2da7 --- /dev/null +++ b/db/migrate/20211015021114_add_merge_commit_template_to_project_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddMergeCommitTemplateToProjectSettings < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + def change + add_column :project_settings, :merge_commit_template, :text # rubocop:disable Migration/AddLimitToTextColumns + end +end diff --git a/db/migrate/20211015024135_add_merge_commit_template_limit_to_project_settings.rb b/db/migrate/20211015024135_add_merge_commit_template_limit_to_project_settings.rb new file mode 100644 index 00000000000..972872b8d2a --- /dev/null +++ b/db/migrate/20211015024135_add_merge_commit_template_limit_to_project_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddMergeCommitTemplateLimitToProjectSettings < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_text_limit :project_settings, :merge_commit_template, 500 + end + + def down + remove_text_limit :project_settings, :merge_commit_template + end +end diff --git a/db/migrate/20211018101034_add_tmp_project_id_column_to_namespaces.rb b/db/migrate/20211018101034_add_tmp_project_id_column_to_namespaces.rb new file mode 100644 index 00000000000..cc73cb5047b --- /dev/null +++ b/db/migrate/20211018101034_add_tmp_project_id_column_to_namespaces.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddTmpProjectIdColumnToNamespaces < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + def change + # this is a temporary column to be able to batch insert records into namespaces table and then be able to link these + # to projects table. + add_column :namespaces, :tmp_project_id, :integer # rubocop: disable Migration/AddColumnsToWideTables + end +end diff --git a/db/migrate/20211018161447_fix_double_entries_in_postgres_index_view.rb b/db/migrate/20211018161447_fix_double_entries_in_postgres_index_view.rb new file mode 100644 index 00000000000..574f54bc60e --- /dev/null +++ b/db/migrate/20211018161447_fix_double_entries_in_postgres_index_view.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +class FixDoubleEntriesInPostgresIndexView < Gitlab::Database::Migration[1.0] + def up + execute(<<~SQL) + DROP VIEW IF EXISTS postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || i.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + i.relname AS name, + pg_indexes.tablename, + a.amname AS type, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + i.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL AS expression, + pg_index.indpred IS NOT NULL AS partial, + pg_indexes.indexdef AS definition, + pg_relation_size(i.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class i ON i.oid = pg_index.indexrelid + JOIN pg_namespace ON i.relnamespace = pg_namespace.oid + JOIN pg_indexes ON i.relname = pg_indexes.indexname AND pg_namespace.nspname = pg_indexes.schemaname + JOIN pg_am a ON i.relam = a.oid + WHERE pg_namespace.nspname <> 'pg_catalog'::name AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end + + def down + execute(<<~SQL) + DROP VIEW IF EXISTS postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || i.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + i.relname AS name, + pg_indexes.tablename, + a.amname AS type, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + i.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL AS expression, + pg_index.indpred IS NOT NULL AS partial, + pg_indexes.indexdef AS definition, + pg_relation_size(i.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class i ON i.oid = pg_index.indexrelid + JOIN pg_namespace ON i.relnamespace = pg_namespace.oid + JOIN pg_indexes ON i.relname = pg_indexes.indexname + JOIN pg_am a ON i.relam = a.oid + WHERE pg_namespace.nspname <> 'pg_catalog'::name AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end +end diff --git a/db/migrate/20211019153615_add_state_to_merge_request_assignees.rb b/db/migrate/20211019153615_add_state_to_merge_request_assignees.rb new file mode 100644 index 00000000000..0eb8d0989a5 --- /dev/null +++ b/db/migrate/20211019153615_add_state_to_merge_request_assignees.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +class AddStateToMergeRequestAssignees < Gitlab::Database::Migration[1.0] + REVIEW_DEFAULT_STATE = 0 + + def change + add_column :merge_request_assignees, :state, :smallint, default: REVIEW_DEFAULT_STATE, null: false + end +end diff --git a/db/migrate/20211020030948_add_runtime_runner_features_to_ci_builds_metadata.rb b/db/migrate/20211020030948_add_runtime_runner_features_to_ci_builds_metadata.rb new file mode 100644 index 00000000000..970c018df46 --- /dev/null +++ b/db/migrate/20211020030948_add_runtime_runner_features_to_ci_builds_metadata.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRuntimeRunnerFeaturesToCiBuildsMetadata < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + def change + add_column :ci_builds_metadata, :runtime_runner_features, :jsonb, default: {}, null: false + end +end diff --git a/db/migrate/20211020095357_add_group_traversal_id_index.rb b/db/migrate/20211020095357_add_group_traversal_id_index.rb new file mode 100644 index 00000000000..e4739ff217e --- /dev/null +++ b/db/migrate/20211020095357_add_group_traversal_id_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddGroupTraversalIdIndex < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_namespaces_on_traversal_ids_for_groups' + + disable_ddl_transaction! + + def up + add_concurrent_index :namespaces, :traversal_ids, using: :gin, where: "type='Group'", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :namespaces, INDEX_NAME + end +end diff --git a/db/migrate/20211021125908_add_sentry_settings_to_application_settings.rb b/db/migrate/20211021125908_add_sentry_settings_to_application_settings.rb new file mode 100644 index 00000000000..d8b40893b47 --- /dev/null +++ b/db/migrate/20211021125908_add_sentry_settings_to_application_settings.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddSentrySettingsToApplicationSettings < Gitlab::Database::Migration[1.0] + # rubocop:disable Migration/AddLimitToTextColumns + def change + add_column :application_settings, :sentry_enabled, :boolean, default: false, null: false + add_column :application_settings, :sentry_dsn, :text + add_column :application_settings, :sentry_clientside_dsn, :text + add_column :application_settings, :sentry_environment, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20211021134458_add_limits_to_sentry_settings_on_application_settings.rb b/db/migrate/20211021134458_add_limits_to_sentry_settings_on_application_settings.rb new file mode 100644 index 00000000000..34d18741788 --- /dev/null +++ b/db/migrate/20211021134458_add_limits_to_sentry_settings_on_application_settings.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddLimitsToSentrySettingsOnApplicationSettings < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :sentry_dsn, 255 + add_text_limit :application_settings, :sentry_clientside_dsn, 255 + add_text_limit :application_settings, :sentry_environment, 255 + end + + def down + remove_text_limit :application_settings, :sentry_dsn + remove_text_limit :application_settings, :sentry_clientside_dsn + remove_text_limit :application_settings, :sentry_environment + end +end diff --git a/db/migrate/20211025103744_add_state_id_to_vsa_issue_stage_events.rb b/db/migrate/20211025103744_add_state_id_to_vsa_issue_stage_events.rb new file mode 100644 index 00000000000..345cd1785ea --- /dev/null +++ b/db/migrate/20211025103744_add_state_id_to_vsa_issue_stage_events.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddStateIdToVsaIssueStageEvents < Gitlab::Database::Migration[1.0] + def change + add_column :analytics_cycle_analytics_issue_stage_events, :state_id, :smallint, default: 1, null: false + end +end diff --git a/db/migrate/20211025103758_add_state_id_to_vsa_merge_request_stage_events.rb b/db/migrate/20211025103758_add_state_id_to_vsa_merge_request_stage_events.rb new file mode 100644 index 00000000000..be28d56e19d --- /dev/null +++ b/db/migrate/20211025103758_add_state_id_to_vsa_merge_request_stage_events.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddStateIdToVsaMergeRequestStageEvents < Gitlab::Database::Migration[1.0] + def change + add_column :analytics_cycle_analytics_merge_request_stage_events, :state_id, :smallint, default: 1, null: false + end +end diff --git a/db/migrate/20211026143238_remove_index_releases_on_author_id.rb b/db/migrate/20211026143238_remove_index_releases_on_author_id.rb new file mode 100644 index 00000000000..7cd086dbf7d --- /dev/null +++ b/db/migrate/20211026143238_remove_index_releases_on_author_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveIndexReleasesOnAuthorId < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_releases_on_author_id' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :releases, INDEX_NAME + end + + def down + add_concurrent_index :releases, [:author_id], name: INDEX_NAME + end +end diff --git a/db/migrate/20211027203950_add_updated_index_for_dormant_users.rb b/db/migrate/20211027203950_add_updated_index_for_dormant_users.rb new file mode 100644 index 00000000000..8b004af06c0 --- /dev/null +++ b/db/migrate/20211027203950_add_updated_index_for_dormant_users.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddUpdatedIndexForDormantUsers < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_users_on_id_and_last_activity_on_for_active_human_service' + + disable_ddl_transaction! + + def up + index_condition = "state = 'active' AND (users.user_type IS NULL OR users.user_type = 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/20211028132247_create_packages_npm_metadata.rb b/db/migrate/20211028132247_create_packages_npm_metadata.rb new file mode 100644 index 00000000000..cbe5429fca1 --- /dev/null +++ b/db/migrate/20211028132247_create_packages_npm_metadata.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class CreatePackagesNpmMetadata < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :packages_npm_metadata, id: false do |t| + t.references :package, primary_key: true, default: nil, index: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint + t.jsonb :package_json, default: {}, null: false + + t.check_constraint 'char_length(package_json::text) < 20000' + end + end + end + + def down + with_lock_retries do + drop_table :packages_npm_metadata + end + end +end diff --git a/db/migrate/20211028212259_add_default_to_personal_access_tokens_prefix.rb b/db/migrate/20211028212259_add_default_to_personal_access_tokens_prefix.rb new file mode 100644 index 00000000000..d9949863a92 --- /dev/null +++ b/db/migrate/20211028212259_add_default_to_personal_access_tokens_prefix.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddDefaultToPersonalAccessTokensPrefix < Gitlab::Database::Migration[1.0] + def change + change_column_default(:application_settings, :personal_access_token_prefix, from: nil, to: 'glpat-') + end +end diff --git a/db/migrate/20211101132310_add_reindexing_queue.rb b/db/migrate/20211101132310_add_reindexing_queue.rb new file mode 100644 index 00000000000..d9d1f9dce89 --- /dev/null +++ b/db/migrate/20211101132310_add_reindexing_queue.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddReindexingQueue < Gitlab::Database::Migration[1.0] + def change + create_table :postgres_reindex_queued_actions do |t| + t.text :index_identifier, null: false, limit: 255 + t.integer :state, limit: 2, null: false, default: 0 + t.timestamps_with_timezone null: false + + t.index :state + end + + change_column_default :postgres_reindex_queued_actions, :created_at, from: nil, to: -> { 'NOW()' } + change_column_default :postgres_reindex_queued_actions, :updated_at, from: nil, to: -> { 'NOW()' } + end +end diff --git a/db/migrate/20211103062728_add_with_highest_role_minimal_access_to_users_statistics.rb b/db/migrate/20211103062728_add_with_highest_role_minimal_access_to_users_statistics.rb new file mode 100644 index 00000000000..43cd7afbf06 --- /dev/null +++ b/db/migrate/20211103062728_add_with_highest_role_minimal_access_to_users_statistics.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddWithHighestRoleMinimalAccessToUsersStatistics < Gitlab::Database::Migration[1.0] + def change + add_column :users_statistics, :with_highest_role_minimal_access, :integer, null: false, default: 0 + end +end diff --git a/db/migrate/20211104012209_add_text_limit_to_application_settings_content_validation_endpoint_url.rb b/db/migrate/20211104012209_add_text_limit_to_application_settings_content_validation_endpoint_url.rb new file mode 100644 index 00000000000..4062fd1be01 --- /dev/null +++ b/db/migrate/20211104012209_add_text_limit_to_application_settings_content_validation_endpoint_url.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToApplicationSettingsContentValidationEndpointUrl < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :content_validation_endpoint_url, 255 + end + + def down + remove_text_limit :application_settings, :content_validation_endpoint_url + end +end diff --git a/db/migrate/20211105010101_add_archived_column_to_deployments.rb b/db/migrate/20211105010101_add_archived_column_to_deployments.rb new file mode 100644 index 00000000000..f9ac81915b4 --- /dev/null +++ b/db/migrate/20211105010101_add_archived_column_to_deployments.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddArchivedColumnToDeployments < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + def change + add_column :deployments, :archived, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20211105125756_add_read_at_to_dependency_proxy_manifests.rb b/db/migrate/20211105125756_add_read_at_to_dependency_proxy_manifests.rb new file mode 100644 index 00000000000..a594674f470 --- /dev/null +++ b/db/migrate/20211105125756_add_read_at_to_dependency_proxy_manifests.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddReadAtToDependencyProxyManifests < Gitlab::Database::Migration[1.0] + def change + add_column :dependency_proxy_manifests, :read_at, :datetime_with_timezone, null: false, default: -> { 'NOW()' } + end +end diff --git a/db/migrate/20211105125813_add_read_at_to_dependency_proxy_blobs.rb b/db/migrate/20211105125813_add_read_at_to_dependency_proxy_blobs.rb new file mode 100644 index 00000000000..1808a541498 --- /dev/null +++ b/db/migrate/20211105125813_add_read_at_to_dependency_proxy_blobs.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddReadAtToDependencyProxyBlobs < Gitlab::Database::Migration[1.0] + def change + add_column :dependency_proxy_blobs, :read_at, :datetime_with_timezone, null: false, default: -> { 'NOW()' } + end +end diff --git a/db/migrate/20211105160316_create_dotenv_application_limits.rb b/db/migrate/20211105160316_create_dotenv_application_limits.rb new file mode 100644 index 00000000000..3ea94fd60fc --- /dev/null +++ b/db/migrate/20211105160316_create_dotenv_application_limits.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class CreateDotenvApplicationLimits < Gitlab::Database::Migration[1.0] + def change + add_column(:plan_limits, :dotenv_variables, :integer, default: 20, null: false) + add_column(:plan_limits, :dotenv_size, :integer, default: 5.kilobytes, null: false) + end +end diff --git a/db/migrate/20211105161404_insert_dotenv_application_limits.rb b/db/migrate/20211105161404_insert_dotenv_application_limits.rb new file mode 100644 index 00000000000..2749cf4a019 --- /dev/null +++ b/db/migrate/20211105161404_insert_dotenv_application_limits.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class InsertDotenvApplicationLimits < Gitlab::Database::Migration[1.0] + def up + create_or_update_plan_limit('dotenv_variables', 'default', 150) + create_or_update_plan_limit('dotenv_variables', 'free', 50) + create_or_update_plan_limit('dotenv_variables', 'opensource', 150) + create_or_update_plan_limit('dotenv_variables', 'premium', 100) + create_or_update_plan_limit('dotenv_variables', 'premium_trial', 100) + create_or_update_plan_limit('dotenv_variables', 'ultimate', 150) + create_or_update_plan_limit('dotenv_variables', 'ultimate_trial', 150) + + create_or_update_plan_limit('dotenv_size', 'default', 5.kilobytes) + end + + def down + create_or_update_plan_limit('dotenv_variables', 'default', 20) + create_or_update_plan_limit('dotenv_variables', 'free', 20) + create_or_update_plan_limit('dotenv_variables', 'opensource', 20) + create_or_update_plan_limit('dotenv_variables', 'premium', 20) + create_or_update_plan_limit('dotenv_variables', 'premium_trial', 20) + create_or_update_plan_limit('dotenv_variables', 'ultimate', 20) + create_or_update_plan_limit('dotenv_variables', 'ultimate_trial', 20) + + create_or_update_plan_limit('dotenv_size', 'default', 5.kilobytes) + end +end diff --git a/db/migrate/20211108154510_create_pipeline_triggers_application_limits.rb b/db/migrate/20211108154510_create_pipeline_triggers_application_limits.rb new file mode 100644 index 00000000000..38671c75e0c --- /dev/null +++ b/db/migrate/20211108154510_create_pipeline_triggers_application_limits.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class CreatePipelineTriggersApplicationLimits < Gitlab::Database::Migration[1.0] + def change + add_column(:plan_limits, :pipeline_triggers, :integer, default: 25_000, null: false) + end +end diff --git a/db/migrate/20211108154841_insert_pipeline_triggers_application_limits.rb b/db/migrate/20211108154841_insert_pipeline_triggers_application_limits.rb new file mode 100644 index 00000000000..c1341fad729 --- /dev/null +++ b/db/migrate/20211108154841_insert_pipeline_triggers_application_limits.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class InsertPipelineTriggersApplicationLimits < Gitlab::Database::Migration[1.0] + def up + create_or_update_plan_limit('pipeline_triggers', 'default', 0) + create_or_update_plan_limit('pipeline_triggers', 'free', 25_000) + create_or_update_plan_limit('pipeline_triggers', 'opensource', 0) + create_or_update_plan_limit('pipeline_triggers', 'premium', 0) + create_or_update_plan_limit('pipeline_triggers', 'premium_trial', 0) + create_or_update_plan_limit('pipeline_triggers', 'ultimate', 0) + create_or_update_plan_limit('pipeline_triggers', 'ultimate_trial', 0) + end + + def down + create_or_update_plan_limit('pipeline_triggers', 'default', 0) + create_or_update_plan_limit('pipeline_triggers', 'free', 0) + create_or_update_plan_limit('pipeline_triggers', 'opensource', 0) + create_or_update_plan_limit('pipeline_triggers', 'premium', 0) + create_or_update_plan_limit('pipeline_triggers', 'premium_trial', 0) + create_or_update_plan_limit('pipeline_triggers', 'ultimate', 0) + create_or_update_plan_limit('pipeline_triggers', 'ultimate_trial', 0) + end +end diff --git a/db/migrate/20211108203248_update_dependency_proxy_indexes_with_read_at.rb b/db/migrate/20211108203248_update_dependency_proxy_indexes_with_read_at.rb new file mode 100644 index 00000000000..ac0f0ddca17 --- /dev/null +++ b/db/migrate/20211108203248_update_dependency_proxy_indexes_with_read_at.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class UpdateDependencyProxyIndexesWithReadAt < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + NEW_BLOB_INDEX = 'index_dependency_proxy_blobs_on_group_id_status_read_at_id' + OLD_BLOB_INDEX = 'index_dependency_proxy_blobs_on_group_id_status_and_id' + + NEW_MANIFEST_INDEX = 'index_dependency_proxy_manifests_on_group_id_status_read_at_id' + OLD_MANIFEST_INDEX = 'index_dependency_proxy_manifests_on_group_id_status_and_id' + + def up + add_concurrent_index :dependency_proxy_blobs, [:group_id, :status, :read_at, :id], name: NEW_BLOB_INDEX + add_concurrent_index :dependency_proxy_manifests, [:group_id, :status, :read_at, :id], name: NEW_MANIFEST_INDEX + + remove_concurrent_index_by_name :dependency_proxy_blobs, OLD_BLOB_INDEX + remove_concurrent_index_by_name :dependency_proxy_manifests, OLD_MANIFEST_INDEX + end + + def down + add_concurrent_index :dependency_proxy_blobs, [:group_id, :status, :id], name: OLD_BLOB_INDEX + add_concurrent_index :dependency_proxy_manifests, [:group_id, :status, :id], name: OLD_MANIFEST_INDEX + + remove_concurrent_index_by_name :dependency_proxy_blobs, NEW_BLOB_INDEX + remove_concurrent_index_by_name :dependency_proxy_manifests, NEW_MANIFEST_INDEX + end +end diff --git a/db/migrate/20211108211434_remove_index_for_resource_group.rb b/db/migrate/20211108211434_remove_index_for_resource_group.rb new file mode 100644 index 00000000000..8b03f12d08b --- /dev/null +++ b/db/migrate/20211108211434_remove_index_for_resource_group.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveIndexForResourceGroup < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_for_resource_group' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :ci_builds, INDEX_NAME + end + + def down + # rubocop:disable Migration/PreventIndexCreation + add_concurrent_index :ci_builds, [:resource_group_id, :id], where: 'resource_group_id IS NOT NULL', name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation + end +end diff --git a/db/migrate/20211109100050_add_consume_after_to_loose_fk_deleted_records.rb b/db/migrate/20211109100050_add_consume_after_to_loose_fk_deleted_records.rb new file mode 100644 index 00000000000..6b8e8c0d4f3 --- /dev/null +++ b/db/migrate/20211109100050_add_consume_after_to_loose_fk_deleted_records.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddConsumeAfterToLooseFkDeletedRecords < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + def up + add_column :loose_foreign_keys_deleted_records, :consume_after, :datetime_with_timezone, default: -> { 'NOW()' } + end + + def down + remove_column :loose_foreign_keys_deleted_records, :consume_after + end +end diff --git a/db/migrate/20211109101010_support_partition_query_in_loose_fk_table.rb b/db/migrate/20211109101010_support_partition_query_in_loose_fk_table.rb new file mode 100644 index 00000000000..fccb1fc5cac --- /dev/null +++ b/db/migrate/20211109101010_support_partition_query_in_loose_fk_table.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class SupportPartitionQueryInLooseFkTable < Gitlab::Database::Migration[1.0] + include Gitlab::Database::PartitioningMigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_loose_foreign_keys_deleted_records_for_partitioned_query' + + def up + add_concurrent_partitioned_index :loose_foreign_keys_deleted_records, + %I[partition fully_qualified_table_name consume_after id], + where: 'status = 1', + name: INDEX_NAME + end + + def down + remove_concurrent_partitioned_index_by_name :loose_foreign_keys_deleted_records, INDEX_NAME + end +end diff --git a/db/migrate/20211110010101_add_index_on_unarchived_deployments.rb b/db/migrate/20211110010101_add_index_on_unarchived_deployments.rb new file mode 100644 index 00000000000..0bfafb94d0b --- /dev/null +++ b/db/migrate/20211110010101_add_index_on_unarchived_deployments.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIndexOnUnarchivedDeployments < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_deployments_on_archived_project_id_iid' + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, %i[archived project_id iid], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :deployments, INDEX_NAME + end +end diff --git a/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb b/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb new file mode 100644 index 00000000000..01507908e0f --- /dev/null +++ b/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddHasShimoToProjectSettings < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + def change + add_column :project_settings, :has_shimo, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20200214085940_clean_grafana_url.rb b/db/migrate/20211112155416_populate_default_value_for_personal_access_tokens_prefix.rb index 7dff6532516..8dd23e1a72e 100644 --- a/db/migrate/20200214085940_clean_grafana_url.rb +++ b/db/migrate/20211112155416_populate_default_value_for_personal_access_tokens_prefix.rb @@ -1,17 +1,15 @@ # frozen_string_literal: true -class CleanGrafanaUrl < ActiveRecord::Migration[6.0] - DOWNTIME = false - +class PopulateDefaultValueForPersonalAccessTokensPrefix < Gitlab::Database::Migration[1.0] def up execute( <<-SQL UPDATE application_settings SET - grafana_url = default + personal_access_token_prefix = default WHERE - position('javascript:' IN btrim(application_settings.grafana_url)) = 1 + personal_access_token_prefix IS NULL SQL ) end |