IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE
	TABLE_NAME = 'publ_ProductMasters' AND
	COLUMN_NAME = 'ProductMasters_ProductMasterDetails_NonVATItem')
BEGIN

ALTER TABLE [dbo].[publ_ProductMasters]
ADD [ProductMasters_ProductMasterDetails_NonVATItem] [bit] NULL;

UPDATE publ_ProductMasters
SET ProductMasters_ProductMasterDetails_NonVATItem = 0
where ProductMasters_ProductMasterDetails_NonVATItem is null;

END;

IF NOT EXISTS (SELECT 1 FROM pal_SurfaceField WHERE surfaceFieldName = 'ProductMasters_ProductMasterDetails_NonVATItem')
BEGIN

SET IDENTITY_INSERT [dbo].[pal_SurfaceField] ON 
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount])
VALUES (3217, 3098, N'ProductMasters_ProductMasterDetails_NonVATItem', N'Non-VAT Item', 8, 0, 0, 0, N'', N'', N'', N'', N'', 21, 14, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 6, 0, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, N'', 0)
SET IDENTITY_INSERT [dbo].[pal_SurfaceField] OFF

END;

UPDATE [dbo].[pal_SurfaceField]
SET isGrid = 1, isFilter = 1, gridSequence = 8
WHERE [surfaceFieldName] = 'ProductMasters_ProductMasterDetails_NonVATItem';

UPDATE [dbo].[pal_SurfaceField]
SET surfaceFieldTypeId = 29, actionType = 1 ,action = 19, actionSource = 1853,
  actionValue = 3217, isGrid = 1, isFilter = 1, gridSequence = 12
WHERE [surfaceFieldName] = 'Products_ProductDetails_NonVATItem';

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE
	TABLE_NAME = 'publ_Products' AND
	COLUMN_NAME = 'Products_ProductDetails_NonVATItem')
BEGIN

ALTER TABLE [dbo].[publ_Products] 
ALTER COLUMN Products_ProductDetails_NonVATItem varchar(10);

UPDATE publ_Products
SET Products_ProductDetails_NonVATItem = ''
where Products_ProductDetails_NonVATItem is null;
END;