- Cleaned 137+ fake engine-displacement models from supplier imports (v3/v4 scripts: Chevrolet, Ford, Chrysler, Dodge, Jeep, Nissan, etc.) - Removed 1,251+ corrupted models (INT. prefixes, year-suffix, torque specs, empty names, trailing-year variants) - Migrated supplier tables to master DB (supplier_catalog, supplier_catalog_compat, supplier_catalog_interchange) - Fixed _get_mye_ids_with_parts() to query supplier_catalog_compat from master DB so supplier-only vehicles appear for all tenants - Added fuzzy model matcher with parenthesis stripping, noise suffix removal, compact matching, prefix/substring fallback, model aliases, and ±3 year proximity - Matched compat rows: KEEP GREEN +14,152, KNADIAN +3,021, VAZLO +127,500, LUK +477, RAYBESTOS +1,743 - Added KNADIAN catalog importer with year-range expansion and future-year filtering - Added VAZLO catalog importer with position parsing and SKU-in-model cleanup - Added Keep Green, LUK, Yokomitsu, Raybestos catalog importers - Cache clearing after cleanups (_classify_cache_*, nexus:mye_ids:*, nexus:brand_mye_counts:*) Final match rates: - KEEP GREEN: 90.3% - VAZLO: 93.6% - YOKOMITSU: 100.0% - KNADIAN: 57.4% - LUK: 51.0% - RAYBESTOS: 55.9%
31 lines
1.4 KiB
SQL
31 lines
1.4 KiB
SQL
-- ============================================================
|
|
-- v3.5 MercadoLibre Questions & Answers
|
|
-- ============================================================
|
|
-- Adds table for tracking buyer questions on ML listings.
|
|
-- All tables live in the tenant DB.
|
|
-- ============================================================
|
|
|
|
CREATE TABLE IF NOT EXISTS marketplace_questions (
|
|
id SERIAL PRIMARY KEY,
|
|
listing_id INTEGER REFERENCES marketplace_listings(id) ON DELETE SET NULL,
|
|
external_question_id VARCHAR(50) NOT NULL UNIQUE,
|
|
external_item_id VARCHAR(50) NOT NULL,
|
|
question_text TEXT NOT NULL,
|
|
answer_text TEXT,
|
|
status VARCHAR(20) DEFAULT 'unanswered', -- unanswered, answered, closed
|
|
buyer_id VARCHAR(50),
|
|
buyer_nickname VARCHAR(100),
|
|
question_date TIMESTAMPTZ,
|
|
answer_date TIMESTAMPTZ,
|
|
raw_json JSONB,
|
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_marketplace_questions_status
|
|
ON marketplace_questions(status);
|
|
CREATE INDEX IF NOT EXISTS idx_marketplace_questions_listing
|
|
ON marketplace_questions(listing_id);
|
|
CREATE INDEX IF NOT EXISTS idx_marketplace_questions_external
|
|
ON marketplace_questions(external_question_id);
|