Skip to content

feat(cli): add db:migrate command, patch link-modules, fix product models#862

Open
vholik wants to merge 3 commits into
feat/product-module-types-and-modelsfrom
feat/cli-db-migrate-and-patches
Open

feat(cli): add db:migrate command, patch link-modules, fix product models#862
vholik wants to merge 3 commits into
feat/product-module-types-and-modelsfrom
feat/cli-db-migrate-and-patches

Conversation

@vholik
Copy link
Copy Markdown
Collaborator

@vholik vholik commented Apr 14, 2026

Summary

  • Add mercurjs db:migrate command that patches Medusa before running medusa db:migrate
  • Patch @medusajs/link-modules to strip product link definitions (product-sales-channel, product-shipping-profile, product-variant-inventory-item, product-variant-price-set) so Mercur's own links take precedence
  • Fix pivotTable duplication on inverse sides of manyToMany relationships in product module models (product-variant, product-category, product-rejection-reason, product)
  • Remove baseRepository manual resolution from ProductModuleService (not a registered container key in MedusaJS v2)
  • Remove old attribute API routes and workflows
  • Add product module and seller module migrations

Test plan

  • Run mercurjs db:migrate and verify product link tables are not created by Medusa's built-in links
  • Verify Mercur's own product links are created instead
  • Verify no pivotTable duplication errors on startup
  • Verify ProductModuleService initializes without baseRepository resolution error

🤖 Generated with Claude Code

vholik and others added 3 commits April 14, 2026 14:57
…t models

- Add `mercurjs db:migrate` command that patches Medusa and runs migrations
- Patch @medusajs/link-modules to strip product link definitions so Mercur's
  own product links take precedence
- Fix manyToMany pivotTable duplication in product module models
  (product-variant, product-category, product-rejection-reason)
- Remove baseRepository manual resolution from ProductModuleService
- Remove old attribute API routes and workflows
- Add product module migrations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Follow the same resolution chain the runtime uses to find the correct
@medusajs/link-modules copy in bun's cache, ensuring product link
definitions are actually stripped from the copy that gets loaded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ix M:N column order

Remove the product-seller link (no longer needed). Register the mercur
product module in withMercur so it overrides the default Medusa one,
preventing ENTITIES cache collision with the original ProductCategory
(which lacks the attributes relationship). Fix pivot table column
ordering in product_category_attribute migration snapshot.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vholik vholik requested a review from Si3r4dz April 14, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants