--**************************************************************************************************
--*
--*	This script will update PS10 view tables to PS11 view tables.
--*
--*	Privileges needed: member of db_owner or db_ddladmin
--*
--**************************************************************************************************

--****************************************************************************************************
--*		MSP_VIEW_PROJ_RES_ENT
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_RES_ENT ADD
   ResourceEnterpriseRMV20ID		     ntext              NULL,
   ResourceEnterpriseRMV21ID         	     ntext              NULL,
   ResourceEnterpriseRMV22ID         	     ntext              NULL,
   ResourceEnterpriseRMV23ID                 ntext              NULL,
   ResourceEnterpriseRMV24ID                 ntext              NULL,
   ResourceEnterpriseRMV25ID                 ntext              NULL,
   ResourceEnterpriseRMV26ID                 ntext              NULL,
   ResourceEnterpriseRMV27ID                 ntext              NULL,
   ResourceEnterpriseRMV28ID                 ntext              NULL,
   ResourceEnterpriseRMV29ID                 ntext              NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_PROJ_ASSN_ENT
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_ASSN_ENT ADD
   AssignmentEnterpriseRMV20ID               ntext               NULL,
   AssignmentEnterpriseRMV21ID               ntext               NULL,
   AssignmentEnterpriseRMV22ID               ntext               NULL,
   AssignmentEnterpriseRMV23ID               ntext               NULL,
   AssignmentEnterpriseRMV24ID               ntext               NULL,
   AssignmentEnterpriseRMV25ID               ntext               NULL,
   AssignmentEnterpriseRMV26ID               ntext               NULL,
   AssignmentEnterpriseRMV27ID               ntext               NULL,
   AssignmentEnterpriseRMV28ID               ntext               NULL,
   AssignmentEnterpriseRMV29ID               ntext               NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_RES_ENT
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_RES_ENT ADD
   ResourceEnterpriseRMV20ID	             ntext 		 NULL,
   ResourceEnterpriseRMV21ID	             ntext 		 NULL,
   ResourceEnterpriseRMV22ID	             ntext 		 NULL,
   ResourceEnterpriseRMV23ID	             ntext 		 NULL,
   ResourceEnterpriseRMV24ID	             ntext 		 NULL,
   ResourceEnterpriseRMV25ID	             ntext 		 NULL,
   ResourceEnterpriseRMV26ID	             ntext 		 NULL,
   ResourceEnterpriseRMV27ID	             ntext 		 NULL,
   ResourceEnterpriseRMV28ID	             ntext 		 NULL,
   ResourceEnterpriseRMV29ID	             ntext 		 NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_RES_STD
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_RES_STD ADD
   ResourceBookingType                       smallint   	NULL,
   ResourceActualOvertimeWorkProtected       decimal(25,6)      NULL,
   ResourceActualWorkProtected               decimal(25,6)      NULL,
   ResourceInactive			     tinyint		NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_PROJ_RES_STD
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_RES_STD ADD
   ResourceBookingType                       smallint   	NULL,
   ResourceActualOvertimeWorkProtected       decimal(25,6)      NULL,
   ResourceActualWorkProtected               decimal(25,6)      NULL,
   ResourceInactive			     tinyint		NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_PROJ_ASSN_STD
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_ASSN_STD ADD
   AssignmentBookingType                     smallint 		NULL,
   AssignmentBaseline1Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline2Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline3Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline4Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline5Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline6Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline7Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline8Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline9Cost       	     decimal(25,6) 	NULL,
   AssignmentBaseline10Cost      	     decimal(25,6) 	NULL,
   AssignmentBaseline1Finish     	     datetime 		NULL,
   AssignmentBaseline2Finish     	     datetime 		NULL,
   AssignmentBaseline3Finish     	     datetime 		NULL,
   AssignmentBaseline4Finish     	     datetime 		NULL,
   AssignmentBaseline5Finish     	     datetime 		NULL,
   AssignmentBaseline6Finish     	     datetime 		NULL,
   AssignmentBaseline7Finish     	     datetime 		NULL,
   AssignmentBaseline8Finish     	     datetime 		NULL,
   AssignmentBaseline9Finish     	     datetime 		NULL,
   AssignmentBaseline10Finish    	     datetime 		NULL,
   AssignmentBaseline1Start      	     datetime 		NULL,
   AssignmentBaseline2Start      	     datetime 		NULL,
   AssignmentBaseline3Start      	     datetime 		NULL,
   AssignmentBaseline4Start      	     datetime 		NULL,
   AssignmentBaseline5Start      	     datetime 		NULL,
   AssignmentBaseline6Start      	     datetime 		NULL,
   AssignmentBaseline7Start      	     datetime 		NULL,
   AssignmentBaseline8Start      	     datetime 		NULL,
   AssignmentBaseline9Start      	     datetime 		NULL,
   AssignmentBaseline10Start     	     datetime 		NULL,
   AssignmentBaseline1Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline2Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline3Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline4Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline5Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline6Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline7Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline8Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline9Work       	     decimal(25,6) 	NULL,
   AssignmentBaseline10Work      	     decimal(25,6) 	NULL,
   AssignmentActualOvertimeWorkProtected     decimal(25,6)      NULL,
   AssignmentActualWorkProtected             decimal(25,6)      NULL
GO

UPDATE MSP_VIEW_PROJ_ASSN_STD SET AssignmentBookingType = 0
GO
--****************************************************************************************************
--*		MSP_VIEW_PROJ_TASKS_STD
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_TASKS_STD ADD
   TaskParentUID                       	     int   		NOT NULL DEFAULT 0,
   TaskActualOvertimeWorkProtected           decimal(25,6)      NULL,
   TaskActualWorkProtected                   decimal(25,6)      NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_PROJ_TASK_TP_BY_DAY
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_TASK_TP_BY_DAY ADD
  TaskTimeBaselineCost 		decimal(25,6) 		NULL
GO

--****************************************************************************************************
--*		MSP_VIEW_PROJ_ASSN_TP_BY_DAY
--****************************************************************************************************

ALTER TABLE dbo.MSP_VIEW_PROJ_ASSN_TP_BY_DAY ADD
  AssignmentTimeActualWorkProtected                     decimal(25,6) 	NULL,
  AssignmentTimeActualOvertimeWorkProtected         	decimal(25,6) 	NULL
GO



-- End of script