-- Migration 004: parser projects
CREATE TABLE IF NOT EXISTS parser_projects (
    id INT AUTO_INCREMENT PRIMARY KEY,
    project_key CHAR(64) NOT NULL UNIQUE,
    domain VARCHAR(255) NOT NULL,
    parser_name VARCHAR(255) NOT NULL,
    parser_type VARCHAR(64) NOT NULL DEFAULT 'product_discovery',
    page_classifiers JSON NULL,
    actions JSON NULL,
    extractors JSON NULL,
    validations JSON NULL,
    test_urls JSON NULL,
    validation_status VARCHAR(32) NOT NULL DEFAULT 'draft',
    validation_errors JSON NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_pp_domain (domain)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
