diff options
Diffstat (limited to 'db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb')
-rw-r--r-- | db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb b/db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb new file mode 100644 index 00000000000..1e65d5647e4 --- /dev/null +++ b/db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUniqueIndexDastSiteTokenProjectIdAndUrl < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_dast_site_token_on_project_id_and_url' + + def up + add_concurrent_index :dast_site_tokens, [:project_id, :url], name: INDEX_NAME, unique: true + end + + def down + remove_concurrent_index_by_name :dast_site_tokens, name: INDEX_NAME + end +end |