Skip to content

Enforce one product per purchasable object - #3847

Open
cp-at-mit wants to merge 1 commit into
mainfrom
11729-should-not-allow-multiple-products-for-same-object-id-and-type
Open

Enforce one product per purchasable object#3847
cp-at-mit wants to merge 1 commit into
mainfrom
11729-should-not-allow-multiple-products-for-same-object-id-and-type

Conversation

@cp-at-mit

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://github.com/mitodl/hq/issues/11729

Description (What does it do?)

Updates Product uniqueness to always enforce a single product per (object_id, content_type) pair, instead of allowing duplicates when one is inactive. Adds a migration to replace the old conditional constraint and updates the model test to cover both active and inactive duplicate creation attempts.

How can this be tested?

Create a product, then attempt to create a second active product for the same object. This should not work even if the first product is deactivated.

Updates `Product` uniqueness to always enforce a single product per `(object_id, content_type)` pair, instead of allowing duplicates when one is inactive. Adds a migration to replace the old conditional constraint and updates the model test to cover both active and inactive duplicate creation attempts.
@github-actions

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@cp-at-mit
cp-at-mit marked this pull request as ready for review August 12, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant