The product code is unique and it should be enforced both on the application and database levels. Currently it is not enforced at all.
Lets not address archiving at the moment. I think to fix this bug we should simply mark the product code as globally unique.
I don't expect product codes to be unique just per program: the Orderable/product code's definition isn't program oriented from what I've seen.
Nick, Brandon and Mary Jo all talked and we are comfortable with Josh's suggestion (to make the product code globally unique for now).
for this ticket, we need to check if it is possible to create duplicate orderables - it shouldn't be. You have to this through Swagger.
I checked, and everything works correctly. One can't add a new orderable with a product code that is already used by a different orderable. When using a unique product code, one can add a new orderable.
Root cause: we lacked constraints in the db again - but I believe recently we put more attention to reviewing schema changes.
I appreciate moving this to done after a long time rotting in the column, but we have more important things in QA then this ticket.