IF  NOT EXISTS (SELECT * FROM sys.objects 
WHERE object_id = OBJECT_ID(N'[dbo].[pal_Campaign]') AND type in (N'U'))
BEGIN

	CREATE TABLE [dbo].[pal_Campaign](
	[recId] [int] IDENTITY(1,1) NOT NULL,
	[campaignTitle] [varchar](150) NULL,
	[campaignBody] [text] NULL,
	[campaignType] [int] NULL,
	[isRecurring] [bit] NULL,
	[interval] [int] NULL,
	[messageType] [int] NULL,
	[lastSent] [datetime] NULL,
	[nextSend] [datetime] NULL,
	[createdBy] [int] NULL,
	[dateSaved] [datetime] NULL,
	[dateUpdated] [datetime] NULL,
	[isActive] [bit] NULL,
	 CONSTRAINT [PK_pal_Campaign] PRIMARY KEY CLUSTERED 
	(
		[recId] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
	) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]




END

IF  NOT EXISTS (SELECT * FROM sys.objects 
WHERE object_id = OBJECT_ID(N'[dbo].[pal_CampaignMessage]') AND type in (N'U'))
BEGIN


	CREATE TABLE [dbo].[pal_CampaignMessage](
		[recId] [int] IDENTITY(1,1) NOT NULL,
		[campaignId] [int] NULL,
		[message] [text] NULL,
		[messageType] [int] NULL,
		[email] [varchar](350) NULL,
		[mobile] [text] NULL,
		[dateSent] [datetime] NULL,
		[status] [int] NULL,
		[statusCode] [int] NULL,
		[statusDisplay] [varchar](350) NULL,
	 CONSTRAINT [PK_pal_CampaignMessage] PRIMARY KEY CLUSTERED 
	(
		[recId] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
	) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



END