diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-10 12:07:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-10 12:07:51 +0300 |
commit | 97d4d926630822d0e1a638206909679c962d2f0a (patch) | |
tree | ef885fdbd0f255f901a587fc3d01bdf115fa3a27 /db/migrate/20191206122926_update_index_for_pool_repositories.rb | |
parent | cfc792b9ca064990e6540cb742e80529ea669a81 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20191206122926_update_index_for_pool_repositories.rb')
-rw-r--r-- | db/migrate/20191206122926_update_index_for_pool_repositories.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20191206122926_update_index_for_pool_repositories.rb b/db/migrate/20191206122926_update_index_for_pool_repositories.rb new file mode 100644 index 00000000000..f88e8e94ee1 --- /dev/null +++ b/db/migrate/20191206122926_update_index_for_pool_repositories.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class UpdateIndexForPoolRepositories < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + # This index is less restrictive then the one we already have, no need to + # update data. + add_concurrent_index :pool_repositories, [:source_project_id, :shard_id], unique: true + remove_concurrent_index :pool_repositories, :source_project_id + end + + def down + # Not adding this index as a unique one, since while the new index existed + # we could have created multiple pool repositories for a project. In that + # case this rollback would fail. + add_concurrent_index :pool_repositories, :source_project_id + remove_concurrent_index :pool_repositories, [:source_project_id, :shard_id], unique: true + end +end |