EnVisageOnline/Beta/Database/Schema/Tables/dbo.ProjectAccess.sql

17 lines
1.6 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].[ProjectAccess]') AND type in (N'U'))
DROP TABLE [dbo].[ProjectAccess]
GO
CREATE TABLE [dbo].[ProjectAccess] (
[PrincipalId] [uniqueidentifier] NOT NULL,
[ProjectId] [uniqueidentifier] NOT NULL,
[Read] [int] NOT NULL CONSTRAINT [DF_ProjectAccess_Read] DEFAULT ((0)),
[Write] [int] NOT NULL CONSTRAINT [DF_ProjectAccess_Write] DEFAULT ((0)),
CONSTRAINT [PK_ProjectAccess] PRIMARY KEY CLUSTERED ([PrincipalId], [ProjectId])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProjectAccess] ADD CONSTRAINT [FK_ProjectAccess_Project] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project] ([Id])
GO