<cfif form.Type EQ "Patch">
	<cfinclude template="patch_15.0.04.cfm">
</cfif>

<cfquery datasource="#application.config.DSN#">
IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_WorkflowStageUser_StageID') 
DROP INDEX [IX_WorkflowStageUser_StageID] ON [dbo].[WorkflowStageUser];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_WorkflowStageUser_WorkflowStageUserID') 
DROP INDEX [IX_WorkflowStageUser_WorkflowStageUserID] ON [dbo].[WorkflowStageUser];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_Workflow_WorkflowID') 
DROP INDEX [IX_Workflow_WorkflowID] ON [dbo].[Workflow];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_Workflow_ParentID_CurrentWorkflow') 
DROP INDEX [IX_Workflow_ParentID_CurrentWorkflow] ON [dbo].[Workflow];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_WorkflowStage_WorkflowID_StageID') 
DROP INDEX [IX_WorkflowStage_WorkflowID_StageID] ON [dbo].[WorkflowStage];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_WorkflowStage_WorkflowStageTypeID') 
DROP INDEX [IX_WorkflowStage_WorkflowStageTypeID] ON [dbo].[WorkflowStage];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_WorkflowUserDefinedUser_StageID') 
DROP INDEX [IX_WorkflowUserDefinedUser_StageID] ON [dbo].[WorkflowUserDefinedUser];

IF  EXISTS (SELECT * FROM sys.indexes WHERE NAME = N'IX_ApprovalEscalateOrConsult_WorkflowID_Type') 
DROP INDEX [IX_ApprovalEscalateOrConsult_WorkflowID_Type] ON [dbo].[ApprovalEscalateOrConsult];

CREATE NONCLUSTERED INDEX [IX_WorkflowStageUser_StageID]
ON [dbo].[WorkflowStageUser] ([StageID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_WorkflowStageUser_WorkflowStageUserID]
ON [dbo].[WorkflowStageUser] ([WorkflowStageUserID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_Workflow_WorkflowID]
ON [dbo].[Workflow] ([WorkflowID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_Workflow_ParentID_CurrentWorkflow]
ON [dbo].[Workflow] ([ParentID],[CurrentWorkflow])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_WorkflowStage_WorkflowID_StageID]
ON [dbo].[WorkflowStage] ([WorkflowID],[StageID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_WorkflowStage_WorkflowStageTypeID]
ON [dbo].[WorkflowStage] ([WorkflowStageTypeID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_WorkflowUserDefinedUser_StageID]
ON [dbo].[WorkflowUserDefinedUser] ([StageID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);

CREATE NONCLUSTERED INDEX [IX_ApprovalEscalateOrConsult_WorkflowID_Type]
ON [dbo].[ApprovalEscalateOrConsult] ([WorkflowID],[Type])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90);
</cfquery>