/* Indexes for order validate performance */

IF NOT EXISTS (
  SELECT 1
  FROM sys.indexes
  WHERE name = 'IX_trOrderLine_OrderHeader_ItemCode'
    AND object_id = OBJECT_ID('dbo.trOrderLine')
)
BEGIN
  CREATE NONCLUSTERED INDEX IX_trOrderLine_OrderHeader_ItemCode
  ON dbo.trOrderLine (OrderHeaderID, ItemCode)
  INCLUDE (ItemTypeCode, ColorCode, ItemDim1Code, ItemDim2Code, ItemDim3Code, LineDescription, SortOrder, OrderLineID);
END
GO

IF NOT EXISTS (
  SELECT 1
  FROM sys.indexes
  WHERE name = 'IX_prItemVariant_Combo'
    AND object_id = OBJECT_ID('dbo.prItemVariant')
)
BEGIN
  CREATE NONCLUSTERED INDEX IX_prItemVariant_Combo
  ON dbo.prItemVariant (ItemTypeCode, ItemCode, ColorCode, ItemDim1Code, ItemDim2Code, ItemDim3Code)
  INCLUDE (PLU);
END
GO
