<cfif form.Type EQ "Patch">
        <cfinclude template="patch_14.0.07.cfm">
</cfif>
<!--- IC-454 remove unused app settings --->
<cfquery datasource="#application.config.DSN#">
IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'AdminIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'AdminIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'AdminIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'AdminIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'Admin_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'Admin_Icon'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'UserHubIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'UserHubIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'UserHubIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'UserHubIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'UserHub_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'UserHub_Icon'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'DashboardIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'DashboardIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'DashboardIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'DashboardIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'Dashboard_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'Dashboard_Icon'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'StatsIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'StatsIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'StatsIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'StatsIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'Stats_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'Stats_Icon'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'LoginIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'LoginIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'LoginIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'LoginIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'Password_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'Password_Icon'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'LogoutIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'LogoutIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'LogoutIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'LogoutIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'LogOut_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'LogOut_Icon'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'FeedbackIconDisplay')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'FeedbackIconDisplay'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'FeedbackIconText')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'FeedbackIconText'
END

IF EXISTS (SELECT Value FROM AppSetting WHERE Name = 'Feedback_Icon')
BEGIN
	DELETE FROM AppSetting WHERE Name = 'Feedback_Icon'
END
</cfquery>
<!--- IC-450 remove tutorial builder --->
<cfquery datasource="#application.config.DSN#">
IF OBJECT_ID('dbo.TutorialTip', 'U') IS NOT NULL 
BEGIN
DROP TABLE TutorialTip
END

IF OBJECT_ID('dbo.TutorialPage', 'U') IS NOT NULL 
BEGIN
DROP TABLE TutorialPage
END

IF OBJECT_ID('dbo.TutorialLog', 'U') IS NOT NULL 
BEGIN
DROP TABLE TutorialLog
END

IF OBJECT_ID('dbo.Tutorial', 'U') IS NOT NULL 
BEGIN
DROP TABLE Tutorial
END
</cfquery>
<!--- IC-1083 update bookmarks widget title and description --->
<cfquery datasource="#application.config.DSN#">
  UPDATE WidgetType
  SET WidgetTypeTitle = 'Bookmarks',
  WidgetTypeDesc = 'Creates a quick view of the logged in employee''s personal Bookmarks. Bookmarks can also be accessed through an employee''s profile, and can be added on any page by clicking Bookmarks in the Toolbar.'
  WHERE WidgetTypeId = 7
</cfquery>
<!--- IC-979 Stats Viewer role --->
<cfquery datasource="#application.config.DSN#">
IF EXISTS( SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='UserProfile' AND COLUMN_NAME='StorybarEditor')
BEGIN
ALTER TABLE UserProfile DROP CONSTRAINT DF_UserProfile_StorybarEditor;
ALTER TABLE UserProfile DROP COLUMN StorybarEditor;
END

IF NOT EXISTS( SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='UserProfile' AND COLUMN_NAME='StatsViewer')
BEGIN	
ALTER TABLE UserProfile ADD [StatsViewer] [bit] NOT NULL CONSTRAINT [DF_UserProfile_StatsViewer] DEFAULT ((0));
END
</cfquery>
<!--- IC-1069 video upload --->
<cfquery datasource="#application.config.DSN#">
IF NOT EXISTS (SELECT [Name] FROM [StoryType] WHERE ID = 3)	
BEGIN
	SET IDENTITY_INSERT [StoryType] ON;
	INSERT INTO [StoryType] (ID, Name)
	VALUES (3, 'video upload');
	SET IDENTITY_INSERT [StoryType] OFF;
END

IF NOT EXISTS( SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Story' AND COLUMN_NAME='Video')
BEGIN	
  ALTER TABLE Story ADD Video nvarchar(255) NULL
END
</cfquery>
