IF(SELECT DATA_TYPE 
	FROM INFORMATION_SCHEMA.COLUMNS
	WHERE TABLE_NAME = 'pal_CampaignMessage' AND COLUMN_NAME = 'mobile') = 'text'
BEGIN
	ALTER TABLE pal_CampaignMessage 
	ALTER COLUMN mobile VARCHAR(50) NULL
END

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'surfaceItemId'
      AND Object_ID = Object_ID(N'pal_CampaignRecipient'))
BEGIN
    ALTER TABLE pal_CampaignRecipient
	ADD surfaceItemId INT NULL; 
END

IF Object_ID('pal_vCampaignHistory') IS NOT NULL
BEGIN
	DROP VIEW pal_vCampaignHistory
END

