-- Migration pour la table ProductSupplier (many-to-many)
CREATE TABLE IF NOT EXISTS ProductSupplier (
    id INT AUTO_INCREMENT PRIMARY KEY,
    product_id INT NOT NULL,
    supplier_id INT NOT NULL,
    is_primary BOOLEAN DEFAULT FALSE,
    supplier_sku VARCHAR(50),
    supplier_price DECIMAL(10, 2),
    lead_time_days INT,
    FOREIGN KEY (product_id) REFERENCES Product(id) ON DELETE CASCADE,
    FOREIGN KEY (supplier_id) REFERENCES Supplier(id) ON DELETE CASCADE,
    UNIQUE(product_id, supplier_id),
    INDEX idx_product_supplier_product (product_id),
    INDEX idx_product_supplier_supplier (supplier_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
