Unified Quote Journal (parts_log) v3

- New unified append-only quote log table parts_log replaces three
  separate log tables (stock_log, partnumber_log_competitors, lot_log)
- Migrations 042-049: extend supplier, create parts_log/import_formats/
  ignore_rules, rework qt_lot_metadata composite PK, add lead_time_weeks
  to pricelist_items, backfill data, migrate ignore rules
- New services: PartsLogBackfillService, ImportFormatService,
  UnifiedImportService; new world pricelist type (all supplier types)
- qt_lot_metadata PK changed to (lot_name, pricelist_type); all queries
  now filter WHERE pricelist_type='estimate'
- Fix pre-existing bug: qt_component_usage_stats column names
  quotes_last30d/quotes_last7d (no underscore) — added explicit gorm tags
- Bible: full table inventory, baseline schema snapshot, updated pricelist/
  data-rules/api/history/architecture docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-21 17:25:54 +03:00
parent f73e3d144d
commit 5f8aec456b
40 changed files with 2294 additions and 124 deletions

View File

@@ -28,10 +28,17 @@ func (LotLog) TableName() string {
return "lot_log"
}
// Supplier represents existing supplier table (READ-ONLY)
// Supplier represents the supplier table.
// PriceForge manages this table for the unified import pipeline.
type Supplier struct {
SupplierName string `gorm:"column:supplier_name;primaryKey;size:255"`
SupplierComment string `gorm:"column:supplier_comment;size:10000"`
SupplierName string `gorm:"column:supplier_name;primaryKey;size:255" json:"supplier_name"`
SupplierComment string `gorm:"column:supplier_comment;size:10000" json:"supplier_comment,omitempty"`
SupplierCode string `gorm:"column:supplier_code;size:100;not null;default:'';uniqueIndex:uq_supplier_code" json:"supplier_code"`
SupplierType string `gorm:"column:supplier_type;type:enum('trader','self','competitor');not null;default:'trader'" json:"supplier_type"`
PriceUplift float64 `gorm:"column:price_uplift;type:decimal(8,4);not null;default:1.0" json:"price_uplift"`
DefaultLeadTimeWeeks *int `gorm:"column:default_lead_time_weeks" json:"default_lead_time_weeks,omitempty"`
DefaultImportFormatCode *string `gorm:"column:default_import_format_code;size:100" json:"default_import_format_code,omitempty"`
IsActive bool `gorm:"column:is_active;not null;default:true" json:"is_active"`
}
func (Supplier) TableName() string {