Programming Phoenix LiveView: B5.0 - Rating schema missing constraint key (page 152)

|> unique_constraint(:product_id, name: :index_ratings_on_user_product)

should be:

|> unique_constraint([:user_id, :product_id], name: :index_ratings_on_user_product)

Nevermind, I read the docs and understand only the name of the index matters in this situation.