-- Ignore rules table: structured ignore patterns for unified import pipeline.
-- Replaces the per-field ignore logic scattered across stock_mappings.go.
-- Check order at import: ignore → mapping → insert.
CREATE TABLE IF NOT EXISTS qt_ignore_rules (
    id          BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    field       ENUM('partnumber','vendor','description') NOT NULL,
    match_type  ENUM('exact','glob','contains') NOT NULL DEFAULT 'exact',
    pattern     VARCHAR(500) NOT NULL,
    note        VARCHAR(500) NULL,
    created_by  VARCHAR(100) NOT NULL DEFAULT '',
    created_at  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_ignore_field (field, match_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
