CREATE TABLE IF NOT EXISTS diagnostic_codes (
  code TEXT PRIMARY KEY, system TEXT NOT NULL, origin TEXT NOT NULL,
  description TEXT NOT NULL, causes TEXT NOT NULL, symptoms TEXT NOT NULL,
  severity TEXT NOT NULL, vehicles TEXT NOT NULL, source TEXT NOT NULL,
  updated_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_diagnostic_codes_system_origin
ON diagnostic_codes(system, origin);
CREATE TABLE IF NOT EXISTS ecu_catalog (
  id TEXT PRIMARY KEY, manufacturer TEXT NOT NULL, family TEXT NOT NULL,
  part_pattern TEXT NOT NULL, fuel_type TEXT NOT NULL, generation TEXT NOT NULL,
  protocols TEXT NOT NULL, vehicles TEXT NOT NULL, notes TEXT NOT NULL,
  search_text TEXT NOT NULL, updated_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_ecu_catalog_manufacturer_family
ON ecu_catalog(manufacturer, family);
