diff options
Diffstat (limited to 'db/migrate/20201103202213_update_packages_build_infos_index.rb')
-rw-r--r-- | db/migrate/20201103202213_update_packages_build_infos_index.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20201103202213_update_packages_build_infos_index.rb b/db/migrate/20201103202213_update_packages_build_infos_index.rb new file mode 100644 index 00000000000..d737517045b --- /dev/null +++ b/db/migrate/20201103202213_update_packages_build_infos_index.rb @@ -0,0 +1,22 @@ +# 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 |