/*
	publ_PartsMaster

	Change the size of unnecessarily large columns
	Create search indexes
*/
-------------------------------------------------------------------------------------------------------------------------
IF EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_PartsMaster')
    AND name='ix_PartsMaster_itemId')
BEGIN
	DROP INDEX [ix_PartsMaster_itemId] ON [dbo].[publ_PartsMaster]
END
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterCEPNumber] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterPartNumber] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterItemVettedBy] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterSalesMultiples] [varchar](32) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterMachine] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsCategoryName] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsSubCategoryName] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMinorCodeName] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterTariffHeading] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterDefaultDuty] [varchar](16) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterPreferredSupplier] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_PartsMasterTopSpendSupplier] [varchar](128) NULL
-------------------------------------------------------------------------------------------------------------------------
ALTER TABLE [dbo].[publ_PartsMaster]
	ALTER COLUMN [PartsMaster_PartsMasterDetails_MasterNumber] [varchar](64) NULL
-------------------------------------------------------------------------------------------------------------------------
GO
-------------------------------------------------------------------------------------------------------------------------
IF NOT EXISTS (
    SELECT * FROM sys.indexes 
    WHERE object_id = OBJECT_ID('dbo.publ_PartsMaster')
    AND name='idx_publ_PartsMaster_CEPNumber')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_PartsMaster_CEPNumber] ON [dbo].[publ_PartsMaster]
	(
		[PartsMaster_PartsMasterDetails_PartsMasterCEPNumber] 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_PartsMaster')
    AND name='idx_publ_PartsMaster_MasterNumber')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_PartsMaster_MasterNumber] ON [dbo].[publ_PartsMaster]
	(
		[PartsMaster_PartsMasterDetails_MasterNumber] 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_PartsMaster')
    AND name='idx_publ_PartsMaster_PartNumber')
BEGIN
	CREATE NONCLUSTERED INDEX [idx_publ_PartsMaster_PartNumber] ON [dbo].[publ_PartsMaster]
	(
		[PartsMaster_PartsMasterDetails_PartsMasterPartNumber] 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_PartsMaster')
    AND name='ix_PartsMaster_itemId')
BEGIN
	CREATE NONCLUSTERED INDEX [ix_PartsMaster_itemId] ON [dbo].[publ_PartsMaster]
	(
		[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
-------------------------------------------------------------------------------------------------------------------------