/*
	publ_QuoteBuyoutSuppliers

	Change the size of unnecessarily large columns
	Create search indexes
*/
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteBuyoutSuppliers')
    AND name='ix_publ_quoteBuyoutSuppliers_itemId')
BEGIN
	DROP INDEX [ix_publ_quoteBuyoutSuppliers_itemId] ON [dbo].[publ_QuoteBuyoutSuppliers]
END
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_SupplierTradingName] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_QuoteBuyoutSupplierTelephone] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_QuoteBuyoutSupplierEmail] [varchar](256) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_QuoteBuyoutSupplierContactPerson] [varchar](256) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_QuoteBuyoutSupplierCurrency] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_QuoteBuyoutSupplierDefaultDiscount] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_QuoteBuyoutSuppliers]
	ALTER COLUMN [QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_QuoteBuyoutSupplierDefaultLeadtime] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_QuoteBuyoutSuppliers')
    AND name='idx_publ_QuoteBuyoutSuppliers_ParentSurfaceItemId')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_QuoteBuyoutSuppliers_ParentSurfaceItemId] ON [dbo].[publ_QuoteBuyoutSuppliers]
	(
		[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_QuoteBuyoutSuppliers')
    AND name='idx_publ_QuoteBuyoutSuppliers_Match')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_QuoteBuyoutSuppliers_Match] ON [dbo].[publ_QuoteBuyoutSuppliers]
	(
		[ParentSurfaceItemId] ASC,
		[QuoteBuyoutSuppliers_QuoteBuyoutSuppliers_SupplierTradingName] 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_QuoteBuyoutSuppliers')
    AND name='ix_publ_quoteBuyoutSuppliers_itemId')
BEGIN
	CREATE NONCLUSTERED INDEX [ix_publ_quoteBuyoutSuppliers_itemId] ON [dbo].[publ_QuoteBuyoutSuppliers]
	(
		[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
-------------------------------------------------------------------------------------------------------------------------