EnVisageOnline/Main/Database/Schema/Tables/dbo.PeopleResourceAllocatio...

22 lines
2.1 KiB
Transact-SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Run this script on SQL Server 2008 or later. There may be flaws if running on earlier versions of SQL Server.
*/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PeopleResourceAllocation]') AND type in (N'U'))
DROP TABLE [dbo].[PeopleResourceAllocation]
GO
CREATE TABLE [dbo].[PeopleResourceAllocation] (
[Id] [uniqueidentifier] NOT NULL,
[ResourceId] [uniqueidentifier] NOT NULL,
[ScenarioId] [uniqueidentifier] NOT NULL,
[ExpenditureCategoryId] [uniqueidentifier] NOT NULL,
[StartDate] [date] NOT NULL,
[EndDate] [date] NOT NULL,
[AllocatePercentage] [float] NOT NULL,
CONSTRAINT [PK_ResourceAllocation] PRIMARY KEY CLUSTERED ([Id])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PeopleResourceAllocation] ADD CONSTRAINT [FK_ResourceAllocation_Expenditure_Category] FOREIGN KEY ([ExpenditureCategoryId]) REFERENCES [dbo].[Expenditure_Category] ([Id])
GO
ALTER TABLE [dbo].[PeopleResourceAllocation] ADD CONSTRAINT [FK_ResourceAllocation_Scenario] FOREIGN KEY ([ScenarioId]) REFERENCES [dbo].[Scenario] ([Id])
GO