Remove Duplicated keys adding UNIQUE index to fingerprint

Merged Paco Guzman requested to merge 18697-uniqueness-key-validation into master

What does this MR do?

Add a unique index to the keys fingerprint column. We added three migrations:

  • Remove duplicates we kept the last key.
  • We remove the existing index only when exists (gitlab-ee)
  • Add the unique index for gitlab-ce and gitlab-ee

Why was this MR needed?

To remove a slow query

What are the relevant issue numbers?

#18697 (closed)

Does this MR meet the acceptance criteria?