Skip to content

Handle duplicate base_codes in PromotionMigrator#6441

Open
jarednorman wants to merge 1 commit intosolidusio:mainfrom
SuperGoodSoft:jared/duplicate-base-codes
Open

Handle duplicate base_codes in PromotionMigrator#6441
jarednorman wants to merge 1 commit intosolidusio:mainfrom
SuperGoodSoft:jared/duplicate-base-codes

Conversation

@jarednorman
Copy link
Copy Markdown
Member

This is just #6422, but with commits combined and reworded to not be so verbose. Credit to @NewAlexandria for the original change.

PromotionMigrator#copy_promotion_codes joined legacy and new
promotion_code_batches on base_code alone, which is not unique across
promotions; unrelated batches sharing a base_code multiplied rows in the
INSERT ... SELECT and triggered PG::UniqueViolation on
index_solidus_promotions_promotion_codes_on_value. Constrain the join on
promotion_id and created_at so each legacy code resolves to the correct
new batch for the promotion being migrated.
@jarednorman jarednorman requested a review from a team as a code owner April 17, 2026 02:54
@github-actions github-actions Bot added the changelog:solidus_promotions Changes to the solidus_promotions gem label Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.66%. Comparing base (7be98b7) to head (4d87b88).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6441   +/-   ##
=======================================
  Coverage   89.66%   89.66%           
=======================================
  Files         990      990           
  Lines       20792    20792           
=======================================
  Hits        18644    18644           
  Misses       2148     2148           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_promotions Changes to the solidus_promotions gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants