Add LOT model mapping management, UI, and first-seen tracking

This commit is contained in:
2026-02-15 19:51:04 +03:00
parent 3ffdf9b0e1
commit fd149c3d64
22 changed files with 987 additions and 56 deletions

View File

@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS lot_model_mappings;
DELETE FROM id_sequences WHERE entity_type = 'lot_model_mapping';

View File

@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS lot_model_mappings (
id VARCHAR(16) PRIMARY KEY,
model VARCHAR(255) NOT NULL,
lot_id VARCHAR(16) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT fk_lot_model_mappings_lot
FOREIGN KEY (lot_id) REFERENCES lots(id)
ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE KEY uniq_lot_model_mappings_model (model),
INDEX idx_lot_model_mappings_lot (lot_id)
);
INSERT IGNORE INTO id_sequences (entity_type, next_value)
VALUES ('lot_model_mapping', 1);