CROP
ProjectsCROP FrontendCompleted

Unified Parts Schema Migration

Date: October 24, 2025 Status: ✅ Completed Author: Vova Commit: a06d180baefc72

Unified Parts Schema Migration

Date: October 24, 2025 Status: ✅ Completed Author: Vova Commit: a06d180baefc72

Purpose

Consolidated 13 manufacturer-specific collections into a unified unified_parts schema to:

  • Standardize part data structure across manufacturers
  • Simplify querying and maintenance
  • Enable cross-manufacturer search and comparison
  • Reduce schema complexity

Manufacturers Migrated

  1. McHale
  2. Club-Car
  3. Great Plains
  4. Hotsy
  5. Briggs & Stratton
  6. AMCO
  7. Harvest Tec
  8. HLA
  9. Ventrac
  10. Ag-Bag
  11. EZ-Trail
  12. Dion AG
  13. Kawasaki

Scripts Location (Git Archive)

All migration scripts have been removed from the codebase but are preserved in Git history.

To restore scripts:

# Restore all migration scripts
git checkout a06d180 -- scripts/migration/
git checkout a06d180 -- scripts/migrate-to-unified-parts.ts
git checkout a06d180 -- scripts/analyze-mongodb-schema.ts
git checkout a06d180 -- scripts/create-mongodb-indexes.ts
git checkout a06d180 -- scripts/deep-schema-analysis.ts

# View the commit that created them
git show a06d180

Migration Features

  • Field Mapping: Normalized fields across disparate schemas
  • Data Validation: Type checking and constraint validation
  • Batch Processing: Efficient bulk operations
  • Dry-run Mode: Safe testing before actual migration
  • Index Creation: Optimized queries post-migration
  • Rollback Support: Original collections preserved

Results

  • Parts Transformed: ~45,231 records
  • Collections Unified: 13 → 1 (unified_parts)
  • Schema Standardized: ✅ Yes
  • Indexes Created: ✅ Yes
  • Data Validation: ✅ Passed
  • Performance: Acceptable query times maintained

Current Status

The unified parts collection is no longer the primary data source. The project now uses:

  • Search Service API (v3) for part data
  • Direct MongoDB access deprecated in favor of microservices

Notes

  • Migration was successful but architecture evolved
  • Original manufacturer-specific collections may still exist in database
  • Contact @backend-team for database cleanup or rollback needs
  • Search Service v3 API: docs/backend-tasks/equipment-fitment-api.md
  • Part Schema Types: lib/db/parts-types.ts
  • Migration Scripts Commit: a06d180baefc72

On this page