1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| USE [IronViper]
GO
/****** Object: Table [dbo].[Messages] Script Date: 01/18/2011 00:08:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Messages](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Uuid] [uniqueidentifier] NOT NULL,
[Data] [ntext] NULL,
[UserId] [bigint] NOT NULL,
[ChannelId] [bigint] NOT NULL,
[PostDate] [datetime] NOT NULL,
CONSTRAINT [PK_Messages] 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] TEXTIMAGE_ON [PRIMARY]
GO
USE [IronViper]
/****** Object: Index [IX_Messages_ChannelId] Script Date: 01/18/2011 00:08:29 ******/
CREATE NONCLUSTERED INDEX [IX_Messages_ChannelId] ON [dbo].[Messages]
(
[ChannelId] ASC
)
INCLUDE ( [Id],
[Uuid],
[UserId],
[PostDate]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
USE [IronViper]
/****** Object: Index [IX_Messages_UserId] Script Date: 01/18/2011 00:08:29 ******/
CREATE NONCLUSTERED INDEX [IX_Messages_UserId] ON [dbo].[Messages]
(
[UserId] ASC
)
INCLUDE ( [Id],
[Uuid],
[ChannelId],
[PostDate]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
USE [IronViper]
/****** Object: Index [IX_Messages_Uuid] Script Date: 01/18/2011 00:08:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Messages_Uuid] ON [dbo].[Messages]
(
[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: FullTextIndex Script Date: 01/18/2011 00:08:29 ******/
CREATE FULLTEXT INDEX ON [dbo].[Messages](
[Data] LANGUAGE [English])
KEY INDEX [PK_Messages]ON ([IronViperFullTextCatalog], FILEGROUP [PRIMARY])
WITH (CHANGE_TRACKING = AUTO, STOPLIST = SYSTEM)
GO
ALTER TABLE [dbo].[Messages] WITH CHECK ADD CONSTRAINT [FK_Messages_ChannelId] FOREIGN KEY([ChannelId])
REFERENCES [dbo].[Channels] ([Id])
GO
ALTER TABLE [dbo].[Messages] CHECK CONSTRAINT [FK_Messages_ChannelId]
GO
ALTER TABLE [dbo].[Messages] WITH CHECK ADD CONSTRAINT [FK_Messages_UserId] FOREIGN KEY([UserId])
REFERENCES [dbo].[Users] ([Id])
GO
ALTER TABLE [dbo].[Messages] CHECK CONSTRAINT [FK_Messages_UserId]
GO
ALTER TABLE [dbo].[Messages] ADD CONSTRAINT [DF_Messages_Uuid] DEFAULT (newid()) FOR [Uuid]
GO
ALTER TABLE [dbo].[Messages] ADD CONSTRAINT [DF_Messages_PostDate] DEFAULT (getdate()) FOR [PostDate]
GO |
Partager