USE [EnVisage]
GO


IF (EXISTS (SELECT * FROM sys.tables where name='TagLink'))
BEGIN
ALTER TABLE [dbo].[TagLink] DROP CONSTRAINT [DF_TagLink_Id]
DROP TABLE [dbo].[TagLink]
END

CREATE TABLE [dbo].[TagLink](
	[Id] [uniqueidentifier] NOT NULL,
	[TagID] [uniqueidentifier] NOT NULL,
	[TagGroupID] [uniqueidentifier] NULL,
	[ParentID] [uniqueidentifier] NOT NULL,
	[TagLinkType] [int] NOT NULL,
	[timestamp] [timestamp] NOT NULL,
 CONSTRAINT [PK_TagLink] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [dbo].[TagLink] ADD  CONSTRAINT [DF_TagLink_Id]  DEFAULT (newid()) FOR [Id]


