Skip to content

Commit

Permalink
The product_document_id_identifier_unique constraint is redundant
Browse files Browse the repository at this point in the history
as there is already a constraint to keep the identifier unique. If
that is already unique, then how could (product.document_id,
product.identifier) possibly be not unique?
  • Loading branch information
egli committed Sep 9, 2024
1 parent d507c2c commit 3508f5d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
ALTER TABLE documents_product DROP KEY product_document_id_identifier_unique;

--;;

ALTER TABLE documents_product DROP KEY product_identifier_unique;

--;;
Expand Down
5 changes: 0 additions & 5 deletions resources/migrations/20240619152403-constrain-products.up.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
-- (`product.document_id`, `product.identifier`) should be unique
ALTER TABLE documents_product ADD CONSTRAINT UNIQUE product_document_id_identifier_unique (document_id, identifier);

--;;

-- `product.identifier` should be unique
ALTER TABLE documents_product ADD CONSTRAINT UNIQUE product_identifier_unique (identifier);

Expand Down

0 comments on commit 3508f5d

Please sign in to comment.