/*
	publ_QuoteRequestItems

	Change the size of unnecessarily large columns
	Create search indexes
*/
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteRequestItems')
    AND name='ix_publ_quoteRequestItems_itemId')
BEGIN
	DROP INDEX [ix_publ_quoteRequestItems_itemId] ON [dbo].[publ_QuoteRequestItems]
END
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteRequestItems]
	ALTER COLUMN [QuoteRequestItems_QuoteRequestItems_QuoteRequestItemsPartNumber] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteRequestItems]
	ALTER COLUMN [QuoteRequestItems_QuoteRequestItems_QuoteRequestItemsMasterNumber] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteRequestItems]
	ALTER COLUMN [QuoteRequestItems_QuoteRequestItems_QuoteRequestItemsDescription] [varchar](512) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteRequestItems]
	ALTER COLUMN [QuoteRequestItems_QuoteRequestItems_QuoteRequestItemsAdditionalDescription] [varchar](3000) NULL
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteRequestItems')
    AND name='idx_publ_QuoteRequestItems_ParentSurfaceItemId')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_QuoteRequestItems_ParentSurfaceItemId] ON [dbo].[publ_QuoteRequestItems]
	(
		[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_QuoteRequestItems')
    AND name='ix_publ_quoteRequestItems_itemId')
BEGIN
	CREATE NONCLUSTERED INDEX [ix_publ_quoteRequestItems_itemId] ON [dbo].[publ_QuoteRequestItems]
	(
		[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
-------------------------------------------------------------------------------------------------------------------------