IF (NOT EXISTS 
	(SELECT * FROM INFORMATION_SCHEMA.TABLES 
    WHERE TABLE_NAME = 'pal_PageTemplate'))
BEGIN

	CREATE TABLE [dbo].[pal_PageTemplate](
		[recId] [int] IDENTITY(1,1) NOT NULL,
		[name] [nvarchar](50) NULL,
		[pageTemplateContentId] [int] NULL,
		[isActive] [bit] NULL,
		[dateCreated] [datetime] NULL,
		[userCreated] [int] NULL,
	 CONSTRAINT [PK_pal_WebPage] 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]
	
END



IF (NOT EXISTS 
	(SELECT * FROM INFORMATION_SCHEMA.TABLES 
    WHERE TABLE_NAME = 'pal_PageTemplateContent'))
BEGIN

	CREATE TABLE [dbo].[pal_PageTemplateContent](
		[recId] [int] IDENTITY(1,1) NOT NULL,
		[name] [nvarchar](50) NULL,
		[templateContent] [ntext] NULL,
		[isActive] [bit] NULL,
	 CONSTRAINT [PK_pal_WebPageTemplate] 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 INFORMATION_SCHEMA.TABLES 
    WHERE TABLE_NAME = 'pal_PageTemplateControl'))
BEGIN

	CREATE TABLE [dbo].[pal_PageTemplateControl](
		[recId] [int] IDENTITY(1,1) NOT NULL,
		[pageTemplateId] [int] NULL,
		[controlTag] [nvarchar](50) NULL,
		[controlText] [ntext] NULL,
		[controlAttachmentId] [int] NULL,
		[controlUrl] [nvarchar](500) NULL,
	 CONSTRAINT [PK_pal_WebPageControl] 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
