-
Notifications
You must be signed in to change notification settings - Fork 0
/
01.00.00.SqlDataProvider
21 lines (18 loc) · 1023 Bytes
/
01.00.00.SqlDataProvider
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}ShoutboxSpa]') and OBJECTPROPERTY(id, N'IsTable') = 1)
BEGIN
CREATE TABLE {databaseOwner}[{objectQualifier}ShoutboxSpa]
(
[ModuleID] [int] NOT NULL,
[ItemID] [int] NOT NULL IDENTITY(1, 1),
[Message] [nvarchar](max) NOT NULL,
[UserId] [int] NULL,
[CreatedDate] [datetime] NOT NULL,
[VoteUp] [int] NOT NULL,
[VoteDown] [int] NOT NULL,
[ReplyTo] [int] NULL
)
ALTER TABLE {databaseOwner}[{objectQualifier}ShoutboxSpa] ADD CONSTRAINT [PK_{objectQualifier}ShoutboxSpa] PRIMARY KEY CLUSTERED ([ItemID])
CREATE NONCLUSTERED INDEX [IX_{objectQualifier}ShoutboxSpa] ON {databaseOwner}[{objectQualifier}ShoutboxSpa] ([ModuleID])
ALTER TABLE {databaseOwner}[{objectQualifier}ShoutboxSpa] WITH NOCHECK ADD CONSTRAINT [FK_{objectQualifier}ShoutboxSpa_{objectQualifier}Modules] FOREIGN KEY ([ModuleID]) REFERENCES {databaseOwner}[{objectQualifier}Modules] ([ModuleID]) ON DELETE CASCADE
END
GO