chore(schema): remove abandoned Medusa integration columns from Drizzle (5 columns across 3 tables)

Second real-positive in the roadmap dead-code list (after helperProfiles
in 0b410106). Medusa was an e-commerce framework integration that
never fully landed; the columns sit in the schema with no consumers.

Verification:
  grep -rn "medusaProductId|medusaVariantId|medusaOrderId|medusaCartId"
  src/ → only the schema-file declarations + the two adjacent comments
  ("Medusa variant ID for cart API" at inventory.ts:152, "Values:
  'medusa', 'external_api', etc." at inventory.ts:347 which is a
  comment about valid source_type values, not a Medusa-specific column).
  No production code reads or writes these columns. No tests reference
  them.

Removed from Drizzle schema:
  inventory.ts (aiExtractedProducts):  medusaProductId
  inventory.ts (inventoryItems):       medusaProductId, medusaVariantId
  payments.ts  (orders):               medusaOrderId, medusaCartId
  payments.ts  (orderItems):           medusaVariantId

5 columns total. Each removal replaces the Drizzle declaration with a
short comment explaining the TS removal + the migration boundary (DB
columns stay until a future migration drops them — same shape as the
helperProfiles fix at 0b410106). The unrelated source_type values
comment at inventory.ts:347 stays — that's about acceptable string
values for the source_type column, not a Medusa-typed field.

This is the 2nd real-positive in 9 roadmap dead-code claims this
thread (helperProfiles + Medusa columns). The other 7 turned out to
be misleading framing — fully wired features whose imports were
invisible to Drizzle-symbol greps because they used raw SQL via
TABLE_NAMES, server-component DB queries, or live in directories the
audit didn't scan. The roadmap "Zero-risk dead-code deletes" section
is effectively unreliable as audit data.

7566 tests pass across 507 suites (verified earlier in 0b410106);
quick re-run on payment-webhook + marketplace + order-service +
admin/inventory shows 59 pass; tsc clean.

A future migration can drop the 5 DB columns + add the corresponding
schema-version bump — out of single-session scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Opus 4.7 committed 2026-05-26 08:28:11 +02:00
1 parent 0b41010653
commit 6f0852d87e
2 files changed
+15 -9

No files matched your search

+8 -5
View File
@@ -78,7 +78,10 @@ export const aiExtractedProducts = pgTable('ai_extracted_products', {
// Integration fields
kivitendoArticleNumber: text('kivitendo_article_number'),
medusaProductId: text('medusa_product_id'),
// medusa_product_id (TS removed 2026-05-26): abandoned Medusa
// integration, no consumers anywhere in src/. Column stays in DB
// until a future migration drops it. See payments.ts + below in
// inventoryItems for the parallel removals.
marketplaceListingId: text('marketplace_listing_id'),
// Added by 012: short description
@@ -145,13 +148,13 @@ export const inventoryItems = pgTable('inventory_items', {
minSellingPriceChf: decimal('min_selling_price_chf', { precision: 10, scale: 2 }),
// Marketplace integration
medusaProductId: text('medusa_product_id').unique(),
// medusa_product_id + medusa_variant_id (TS removed 2026-05-26):
// abandoned Medusa integration, no consumers in src/. Columns stay
// in DB until a future migration drops them along with the
// marketplace_listing_id reference above and the payments.ts ones.
// CHECK (marketplace_status IN ('draft', 'published', 'sold', 'archived'))
marketplaceStatus: text('marketplace_status').default('draft'),
// Added by 037: Medusa variant ID for cart API
medusaVariantId: text('medusa_variant_id'),
// User assignments
assignedTo: uuid('assigned_to').references(() => users.id),
assignedAt: timestamp('assigned_at', { withTimezone: true, mode: 'string' }),
+7 -4
View File
@@ -103,9 +103,11 @@ export const orders = pgTable('orders', {
// Seller information (for marketplace orders)
sellerId: uuid('seller_id').references(() => users.id),
// Medusa integration
medusaOrderId: text('medusa_order_id'),
medusaCartId: text('medusa_cart_id'),
// medusa_order_id + medusa_cart_id (TS removed 2026-05-26):
// abandoned Medusa integration, no consumers anywhere in src/.
// Columns stay in DB until a future migration drops them along
// with the parallel removals in inventory.ts (aiExtractedProducts
// and inventoryItems) and the order_items.medusaVariantId below.
// Notes
customerNotes: text('customer_notes'),
@@ -140,7 +142,8 @@ export const orderItems = pgTable('order_items', {
// Product information
productTitle: text('product_title').notNull(),
productSku: text('product_sku'),
medusaVariantId: text('medusa_variant_id'),
// medusa_variant_id (TS removed 2026-05-26): see comment above on
// orders.medusaOrderId — abandoned integration, no consumers.
inventoryItemId: uuid('inventory_item_id'),
// Quantity and pricing — CHECK (quantity > 0)