Add LOT model mapping management, UI, and first-seen tracking
This commit is contained in:
2
migrations/0013_lot_model_mappings/down.sql
Normal file
2
migrations/0013_lot_model_mappings/down.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS lot_model_mappings;
|
||||
DELETE FROM id_sequences WHERE entity_type = 'lot_model_mapping';
|
||||
15
migrations/0013_lot_model_mappings/up.sql
Normal file
15
migrations/0013_lot_model_mappings/up.sql
Normal 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);
|
||||
Reference in New Issue
Block a user