IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'pal_SurfaceField' AND COLUMN_NAME = 'actionType')
BEGIN
	ALTER TABLE [dbo].[pal_SurfaceField]
		ADD [actionType]   INT NULL
END

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'pal_SurfaceField' AND COLUMN_NAME = 'action')
BEGIN
	ALTER TABLE [dbo].[pal_SurfaceField]
		ADD [action]       INT NULL
END

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'pal_SurfaceField' AND COLUMN_NAME = 'actionSource')
BEGIN
	ALTER TABLE [dbo].[pal_SurfaceField]
		ADD [actionSource] INT NULL
END


TRUNCATE TABLE pal_TaskCategory
TRUNCATE TABLE pal_TaskPriority
TRUNCATE TABLE pal_TaskStatus
TRUNCATE TABLE pal_TaskType

SET IDENTITY_INSERT [dbo].[pal_TaskCategory] ON 

GO
INSERT [dbo].[pal_TaskCategory] ([recId], [taskCategory], [isActive]) VALUES (1, N'Scoping', 1)
GO
INSERT [dbo].[pal_TaskCategory] ([recId], [taskCategory], [isActive]) VALUES (2, N'Service Desk', 1)
GO
INSERT [dbo].[pal_TaskCategory] ([recId], [taskCategory], [isActive]) VALUES (3, N'Ideas', 1)
GO
SET IDENTITY_INSERT [dbo].[pal_TaskCategory] OFF
GO
SET IDENTITY_INSERT [dbo].[pal_TaskPriority] ON 

GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (1, N'Blocker', 1)
GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (2, N'Critical', 1)
GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (3, N'Major', 1)
GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (4, N'Minor', 1)
GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (5, N'Trivial', 1)
GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (6, N'Wish List', 1)
GO
INSERT [dbo].[pal_TaskPriority] ([recId], [taskPriority], [isActive]) VALUES (7, N'Idea', 1)
GO
SET IDENTITY_INSERT [dbo].[pal_TaskPriority] OFF
GO
SET IDENTITY_INSERT [dbo].[pal_TaskStatus] ON 

GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (1, N'To do', 1, 2)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (2, N'In progress', 1, 3)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (3, N'To be tested', 1, 4)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (4, N'Release ready', 1, 5)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (5, N'Reopened', 1, 6)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (6, N'Closed', 1, 7)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (7, N'On hold', 1, 8)
GO
INSERT [dbo].[pal_TaskStatus] ([recId], [taskStatus], [isActive], [sequence]) VALUES (8, N'In Review', 1, 1)
GO
SET IDENTITY_INSERT [dbo].[pal_TaskStatus] OFF
GO
SET IDENTITY_INSERT [dbo].[pal_TaskType] ON 

GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (1, 1, N'New feature', 1)
GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (2, 1, N'Bug', 1)
GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (3, 1, N'Enhancement', 1)
GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (4, 2, N'Support', 1)
GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (5, 3, N'Business', 1)
GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (6, 3, N'Marketing', 1)
GO
INSERT [dbo].[pal_TaskType] ([recId], [taskCategoryId], [taskType], [isActive]) VALUES (7, 3, N'Technical', 1)
GO
SET IDENTITY_INSERT [dbo].[pal_TaskType] OFF
GO



