EnVisageOnline/Main-RMO/Database/Schema/Tables/dbo.Project.sql

30 lines
2.9 KiB
Transact-SQL
Raw 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].[Project]') AND type in (N'U'))
DROP TABLE [dbo].[Project]
GO
CREATE TABLE [dbo].[Project] (
[Id] [uniqueidentifier] NOT NULL CONSTRAINT [DF_Show_Id] DEFAULT (newid()),
[CompanyId] [uniqueidentifier] NULL,
[ClientId] [uniqueidentifier] NULL,
[TypeId] [uniqueidentifier] NULL,
[StatusId] [uniqueidentifier] NULL,
[Name] [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ProjectNumber] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Color] [nvarchar](16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Details] [nvarchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Priority] [int] NOT NULL,
[Probability] [decimal](5, 4) NOT NULL,
CONSTRAINT [PK_Show] PRIMARY KEY CLUSTERED ([Id])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Project] ADD CONSTRAINT [FK_Show_Client] FOREIGN KEY ([ClientId]) REFERENCES [dbo].[Client] ([Id])
GO
ALTER TABLE [dbo].[Project] ADD CONSTRAINT [FK_Show_Status] FOREIGN KEY ([StatusId]) REFERENCES [dbo].[Status] ([Id])
GO
ALTER TABLE [dbo].[Project] ADD CONSTRAINT [FK_Show_Studio] FOREIGN KEY ([CompanyId]) REFERENCES [dbo].[Company] ([Id])
GO
ALTER TABLE [dbo].[Project] ADD CONSTRAINT [FK_Show_Type] FOREIGN KEY ([TypeId]) REFERENCES [dbo].[Type] ([Id])
GO