alter table AutomatedTaskPackageNode add 
	constraint FK_AutomatedTaskPackageNode_AutomatedTaskPackage foreign key ( AutomatedTaskPackageRevisionGuid) 
		references AutomatedTaskPackage ( AutomatedTaskPackageRevisionGuid)
go

alter table AutomatedTaskPackageNode add 
	constraint FK_AutomatedTaskPackageNonde_Script foreign key ( ScriptID) references Script(ScriptID)			
go

alter table AutomatedTaskPackageNotification
	add constraint 
	   FK_AutomatedTaskPackageNotification_AutomatedTaskPackageNode 
           foreign key ( AutomatedTaskPackageNodeGuid) references AutomatedTaskPackageNode(AutomatedTaskPackageNodeGuid)
go	

alter table AutomatedTaskPackageAction
	add constraint 
	   FK_AutomatedTaskPackageAction_AutomatedTaskPackageNode 
           foreign key ( AutomatedTaskPackageNodeGuid) references AutomatedTaskPackageNode(AutomatedTaskPackageNodeGuid)
go	

alter table AutomatedTaskPackageAction
	add constraint 
         FK_AutoamtedTaskPackageAction_AutomatedTaskPackageNode_NextNode 
              foreign key (NextAutomatedTaskPackageNodeGuid) references AutomatedTaskPackageNode(AutomatedTaskPackageNodeGuid)	
go


alter table AutomatedTaskPackageScriptParameter add
    constraint FK_AutomatedTaskPackageScriptParameter_AutoamtedTask foreign key ( AutomatedTaskID) references AutomatedTask(AutomatedTaskID) 
go
alter table AutomatedTaskPackageScriptParameter add
    constraint FK_AutomatedTaskPackageScriptParameter_AutomatedTaskPackageNode foreign key (AutomatedTaskPackageNodeGuid) 
		references AutomatedTaskPackageNode(AutomatedTaskPackageNodeGuid)
go
alter table AutomatedTaskPackageScriptParameter add
    constraint FK_AutomatedTaskPacakageScriptParameter_AutomatedTaskParameterFile foreign key (AutomatedTaskParameterFileID) 
		references AutomatedTaskParameterFile (AutomatedTaskParameterFileID)
go

alter table AutomatedTask add constraint FK_AutomatedTask_AutomatedTaskPackage 
	foreign key (AutomatedTaskPackageRevisionGuid) references AutomatedTaskPackage(AutomatedTaskPackageRevisionGuid)
go
