/*
	publ_QuoteEnquiryItems

	Change the size of unnecessarily large columns
	Create search indexes
*/
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteEnquiryItems')
    AND name='ix_publ_quoteEnquiryItems_itemId')
BEGIN
	DROP INDEX [ix_publ_quoteEnquiryItems_itemId] ON [dbo].[publ_QuoteEnquiryItems]
END
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteEnquiryItems]
	ALTER COLUMN [QuoteEnquiryItems_QuoteEnquiryItems_PartNumber] [varchar](256) NULL
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteEnquiryItems')
    AND name='idx_publ_QuoteEnquiryItems_ParentSurfaceItemId')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_QuoteEnquiryItems_ParentSurfaceItemId] ON [dbo].[publ_QuoteEnquiryItems]
	(
		[ParentSurfaceItemId] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
END
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteEnquiryItems')
    AND name='ix_publ_quoteEnquiryItems_itemId')
BEGIN
	CREATE NONCLUSTERED INDEX [ix_publ_quoteEnquiryItems_itemId] ON [dbo].[publ_QuoteEnquiryItems]
	(
		[itemID] ASC,
		[ParentSurfaceItemId] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
END
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------