diff options
Diffstat (limited to 'db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb')
-rw-r--r-- | db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb b/db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb new file mode 100644 index 00000000000..9a983cc1278 --- /dev/null +++ b/db/post_migrate/20230802092922_add_unique_index_project_authorizations_on_unique_project_user.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUniqueIndexProjectAuthorizationsOnUniqueProjectUser < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'index_unique_project_authorizations_on_unique_project_user' + + disable_ddl_transaction! + + def up + add_concurrent_index :project_authorizations, + %i[project_id user_id], + unique: true, + where: "is_unique", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :project_authorizations, INDEX_NAME + end +end |