-- Migration pour la table ProductAttribute
CREATE TABLE IF NOT EXISTS ProductAttribute (
    id INT AUTO_INCREMENT PRIMARY KEY,
    product_id INT NOT NULL,
    attribute_id INT,
    custom_name VARCHAR(50),
    value TEXT,
    unit VARCHAR(20),
    FOREIGN KEY (product_id) REFERENCES Product(id) ON DELETE CASCADE,
    FOREIGN KEY (attribute_id) REFERENCES Attribute(id) ON DELETE SET NULL,
    UNIQUE(product_id, attribute_id, custom_name),
    INDEX idx_product_attribute_product (product_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
