/*
	publ_Quotes

	Change the size of unnecessarily large columns
	Create search indexes
*/
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_Quotes')
    AND name='ix_publ_Quotes_itemId')
BEGIN
	DROP INDEX [ix_publ_Quotes_itemId] ON [dbo].[publ_Quotes]
END
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteInformation_QuoteNumber] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerTradingNameCopy] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteItems_QuoteItems_QuoteItemsSupplyTypes] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteFinal_QuoteFinalItems_QuoteFinalItemsRefresh] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteFinal_QuoteFinalItems_QuoteFinalItemsFinaliseQuote] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteItems_QuoteItems_QuoteItemsHideZeroQuantities] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteEnquiryItems_QuoteEnquiryItems_QuoteRequestItemsUploadList] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerLegalEntity] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerCode] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [None_QuoteInformation_QuoteLastUpdated] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteItems_QuoteItems_QuoteItemsDefaultMargin] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteItems_QuoteItems_QuoteItemsDefaultMarginApplyToAll] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [None_QuoteInformation_QuoteUpdatedBy] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerIsParent] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerParentCompany] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [None_QuoteInformation_CustomerTradingName] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_ContactNameCopy] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [None_QuoteInformation_ContactName] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_QuoteContactEmail] [varchar](256) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_QuoteMobileNumber] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_QuoteTelephoneNumber] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_QuoteCustomerDefaultMargin] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_QuoteCustomerDefaultDiscount] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerType] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerCurrency] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerVATNumber] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerVATRate] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerPhysicalAddress] [varchar](256) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteCustomerDetails_QuoteCustomerDetails_CustomerPostalAddress] [varchar](256) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteInformation_CustomerTradingName] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_Quotes]
	ALTER COLUMN [QuoteInformation_ContactName] [varchar](64) NULL
------------------------------------------------------------------------------------------------------------------------- 
GO
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_Quotes')
    AND name='idx_publ_Quotes_QuoteNumber')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_Quotes_QuoteNumber] ON [dbo].[publ_Quotes]
	(
		[QuoteInformation_QuoteNumber] 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_Quotes')
    AND name='ix_publ_Quotes_itemId')
BEGIN
	CREATE NONCLUSTERED INDEX [ix_publ_Quotes_itemId] ON [dbo].[publ_Quotes]
	(
		[itemID] 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
-------------------------------------------------------------------------------------------------------------------------