forked from RickStrahl/CodePaste.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodePasteSchema.sql
397 lines (378 loc) · 14.9 KB
/
CodePasteSchema.sql
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [CodePaste].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [CodePaste] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [CodePaste] SET ANSI_NULLS OFF
GO
ALTER DATABASE [CodePaste] SET ANSI_PADDING OFF
GO
ALTER DATABASE [CodePaste] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [CodePaste] SET ARITHABORT OFF
GO
ALTER DATABASE [CodePaste] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [CodePaste] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [CodePaste] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [CodePaste] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [CodePaste] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [CodePaste] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [CodePaste] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [CodePaste] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [CodePaste] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [CodePaste] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [CodePaste] SET DISABLE_BROKER
GO
ALTER DATABASE [CodePaste] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [CodePaste] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [CodePaste] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [CodePaste] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [CodePaste] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [CodePaste] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [CodePaste] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [CodePaste] SET RECOVERY SIMPLE
GO
ALTER DATABASE [CodePaste] SET MULTI_USER
GO
ALTER DATABASE [CodePaste] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [CodePaste] SET DB_CHAINING OFF
GO
USE [CodePaste]
GO
/****** Object: User [Network Service] Script Date: 4/27/2015 11:13:11 AM ******/
CREATE USER [Network Service] FOR LOGIN [NT AUTHORITY\NETWORK SERVICE] WITH DEFAULT_SCHEMA=[dbo]
GO
sys.sp_addrolemember @rolename = N'db_owner', @membername = N'Network Service'
GO
sys.sp_addrolemember @rolename = N'db_accessadmin', @membername = N'Network Service'
GO
sys.sp_addrolemember @rolename = N'db_ddladmin', @membername = N'Network Service'
GO
sys.sp_addrolemember @rolename = N'db_datareader', @membername = N'Network Service'
GO
sys.sp_addrolemember @rolename = N'db_datawriter', @membername = N'Network Service'
GO
/****** Object: FullTextCatalog [CodePasteFullText] Script Date: 4/27/2015 11:13:11 AM ******/
CREATE FULLTEXT CATALOG [CodePasteFullText]WITH ACCENT_SENSITIVITY = OFF
GO
/****** Object: StoredProcedure [dbo].[LogSnippetClick] Script Date: 4/27/2015 11:13:11 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: Logs a Snippet Click into the SnippetClick table
-- =============================================
CREATE PROCEDURE [dbo].[LogSnippetClick]
-- Add the parameters for the stored procedure here
@SnippetId AS VARCHAR(MAX),
@IpAddress AS VARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
-- check if don't allow updating if this ip address has already
-- clicked on this snippet in the last 10 minutes
select Id from SnippetClicks
WHERE snippetId = @SnippetId AND ipaddress = @IpAddress AND
DATEDIFF(minute, Entered, GETDATE() ) <= 10
IF @@ROWCOUNT = 0
BEGIN
INSERT INTO SnippetClicks
(SnippetId,IpAddress,Entered) VALUES
(@SnippetId,@IpAddress,GETDATE())
UPDATE CodeSnippets SET VIEWS = VIEWS + 1
WHERE id = @SnippetId
END
ELSE
BEGIN
-- clean up
DELETE FROM SnippetClicks WHERE DATEDIFF(minute,Entered,GETDATE()) > 10
END
END
GO
/****** Object: Table [dbo].[AdditionalSnippets] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AdditionalSnippets](
[Id] [nvarchar](40) NOT NULL,
[SnippetId] [nvarchar](40) NULL,
[Title] [nvarchar](40) NULL,
[Code] [ntext] NULL,
[Language] [nvarchar](40) NULL,
[Version] [decimal](12, 4) NULL,
[tstamp] [timestamp] NULL,
CONSTRAINT [PK_AdditionalSnippets] 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
/****** Object: Table [dbo].[ApplicationLog] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ApplicationLog](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Entered] [datetime] NOT NULL CONSTRAINT [DF_ApplicationLog_Entered] DEFAULT (getdate()),
[Message] [nvarchar](255) NULL,
[ErrorLevel] [int] NOT NULL CONSTRAINT [DF_ApplicationLog_ErrorLevel] DEFAULT ((0)),
[Details] [nvarchar](4000) NULL,
[ErrorType] [nvarchar](50) NULL,
[StackTrace] [nvarchar](1500) NULL,
[Url] [nvarchar](255) NULL,
[QueryString] [nvarchar](255) NULL,
[IpAddress] [nvarchar](20) NULL,
[Referrer] [nvarchar](255) NULL,
[UserAgent] [nvarchar](255) NULL,
[PostData] [nvarchar](2048) NULL,
[RequestDuration] [decimal](9, 3) NOT NULL CONSTRAINT [DF_ApplicationLog_RequestDuration] DEFAULT ((-1))
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[CodeSnippets] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CodeSnippets](
[Id] [nvarchar](40) NOT NULL CONSTRAINT [DF_CodeSnippets_Id] DEFAULT (''),
[UserId] [nvarchar](40) NULL CONSTRAINT [DF_CodeSnippets_UserId] DEFAULT (''),
[Code] [nvarchar](max) NULL CONSTRAINT [DF_CodeSnippets_Code] DEFAULT (''),
[FormattedCode] [nvarchar](max) NULL,
[Title] [nvarchar](255) NULL CONSTRAINT [DF_CodeSnippets_Title] DEFAULT (''),
[Comment] [nvarchar](2000) NULL CONSTRAINT [DF_CodeSnippets_Comment] DEFAULT (''),
[Tags] [nvarchar](255) NULL CONSTRAINT [DF_CodeSnippets_Tags] DEFAULT (''),
[IsPrivate] [bit] NOT NULL CONSTRAINT [DF_CodeSnippets_IsPrivate] DEFAULT ((0)),
[ShowLineNumbers] [bit] NOT NULL CONSTRAINT [DF_CodeSnippets_ShowLineNumbers] DEFAULT ((0)),
[Author] [nvarchar](200) NULL CONSTRAINT [DF_CodeSnippets_Name] DEFAULT (''),
[Theme] [nvarchar](50) NULL CONSTRAINT [DF_CodeSnippets_Theme] DEFAULT (''),
[Language] [nvarchar](40) NULL CONSTRAINT [DF_CodeSnippets_Language] DEFAULT (''),
[IsAbuse] [bit] NOT NULL CONSTRAINT [DF_CodeSnippets_IsAbuse] DEFAULT ((0)),
[Entered] [datetime] NOT NULL CONSTRAINT [DF_CodeSnippets_Entered] DEFAULT (getdate()),
[Views] [int] NOT NULL CONSTRAINT [DF_CodeSnippets_Views] DEFAULT ((0)),
[LinkedUrl] [nvarchar](512) NULL,
[LinkedUrlUpdated] [datetime] NOT NULL CONSTRAINT [DF_CodeSnippets_LiinkedUrlUpdated] DEFAULT (getdate()),
[IsTemporary] [bit] NOT NULL CONSTRAINT [DF_CodeSnippets_IsTemporary] DEFAULT ((0)),
[Version] [decimal](12, 4) NOT NULL CONSTRAINT [DF_CodeSnippets_Version] DEFAULT ((1.0)),
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [PK_CodeSnippets] 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
/****** Object: Table [dbo].[Comments] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Comments](
[Id] [nvarchar](40) NOT NULL,
[SnippetId] [nvarchar](40) NOT NULL CONSTRAINT [DF_Comments_SnippetId] DEFAULT (''),
[CommentText] [nvarchar](4000) NULL CONSTRAINT [DF_Comments_CommentText] DEFAULT (''),
[Author] [nvarchar](50) NOT NULL CONSTRAINT [DF_Comments_UserId] DEFAULT (''),
[Entered] [datetime] NOT NULL CONSTRAINT [DF_Comments_Entered] DEFAULT (getdate()),
[UserId] [nvarchar](50) NOT NULL CONSTRAINT [DF_Comments_UserId_1] DEFAULT (''),
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [PK_Comments] 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]
GO
/****** Object: Table [dbo].[Favorites] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Favorites](
[Id] [nvarchar](40) NOT NULL CONSTRAINT [DF_Favorites_Id] DEFAULT (''),
[UserId] [nvarchar](40) NOT NULL CONSTRAINT [DF_Favorites_RelatedId] DEFAULT (''),
[SnippetId] [nvarchar](40) NOT NULL,
[Title] [nvarchar](128) NULL CONSTRAINT [DF_Favorites_Title] DEFAULT (''),
[Type] [int] NOT NULL CONSTRAINT [DF_Favorites_Type] DEFAULT ((1)),
[Entered] [datetime] NOT NULL CONSTRAINT [DF_Favorites_Entered] DEFAULT (getdate()),
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [PK_Favorites] 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]
GO
/****** Object: Table [dbo].[Lookups] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Lookups](
[Pk] [int] IDENTITY(1,1) NOT NULL,
[Type] [nvarchar](50) NOT NULL,
[Value] [nvarchar](255) NOT NULL,
[LongValue] [ntext] NULL,
[IntValue] [int] NOT NULL,
[DecimalValue] [decimal](12, 2) NOT NULL,
[tstamp] [timestamp] NOT NULL,
[Value2] [nvarchar](255) NOT NULL,
CONSTRAINT [PK_Lookups] PRIMARY KEY CLUSTERED
(
[Pk] 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
/****** Object: Table [dbo].[SnippetClicks] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SnippetClicks](
[Id] [int] IDENTITY(1,1) NOT NULL,
[SnippetId] [nvarchar](20) NOT NULL CONSTRAINT [DF_ViewClicks_SnippetId] DEFAULT (''),
[IpAddress] [nvarchar](40) NOT NULL CONSTRAINT [DF_ViewClicks_IpAddress] DEFAULT (''),
[Entered] [datetime] NOT NULL CONSTRAINT [DF_ViewClicks_Entered] DEFAULT (getdate()),
CONSTRAINT [PK_SnippetClicks] 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]
GO
/****** Object: Table [dbo].[SpamKeywords] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SpamKeywords](
[Pk] [int] IDENTITY(1,1) NOT NULL,
[Keyword] [nvarchar](200) NULL,
CONSTRAINT [PK_SpamKeywords] PRIMARY KEY CLUSTERED
(
[Pk] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[UserGroups] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserGroups](
[Id] [nvarchar](40) NOT NULL,
[UserId] [nvarchar](40) NOT NULL,
[GroupUserId] [nvarchar](40) NOT NULL,
[GroupName] [nvarchar](128) NOT NULL,
[Access] [int] NOT NULL,
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [PK_UserGroups] 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]
GO
/****** Object: Table [dbo].[Users] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Users](
[Id] [nvarchar](40) NOT NULL,
[Name] [nvarchar](128) NOT NULL CONSTRAINT [DF_Users_Name] DEFAULT (''),
[Email] [nvarchar](255) NOT NULL CONSTRAINT [DF_Users_Email] DEFAULT (''),
[Password] [nvarchar](50) NOT NULL CONSTRAINT [DF_Users_Password] DEFAULT (''),
[LastLanguage] [nvarchar](50) NOT NULL CONSTRAINT [DF_Users_LastLanguage] DEFAULT (''),
[Theme] [nvarchar](50) NULL,
[InActive] [bit] NOT NULL CONSTRAINT [DF_Users_Active] DEFAULT ((0)),
[IsAdmin] [bit] NOT NULL CONSTRAINT [DF_Users_IsAdmin] DEFAULT ((0)),
[Visits] [int] NOT NULL CONSTRAINT [DF_Users_Visits] DEFAULT ((0)),
[Snippets] [int] NOT NULL CONSTRAINT [DF_Users_Snippets] DEFAULT ((0)),
[Updated] [datetime] NOT NULL CONSTRAINT [DF_Users_Updated] DEFAULT (getdate()),
[Entered] [datetime] NOT NULL CONSTRAINT [DF_Users_Entered] DEFAULT (getdate()),
[OpenId] [nvarchar](128) NOT NULL CONSTRAINT [DF_Users_openid] DEFAULT (''),
[OpenIdClaim] [nvarchar](255) NOT NULL CONSTRAINT [DF_Users_OpenIdClaim] DEFAULT (''),
[Validator] [nvarchar](20) NULL,
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [PK_Users] 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]
GO
/****** Object: Table [dbo].[UserTokens] Script Date: 4/27/2015 11:13:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserTokens](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Token] [nvarchar](50) NOT NULL,
[UserId] [nvarchar](50) NOT NULL,
[Entered] [datetime] NOT NULL CONSTRAINT [DF_UserTokens_Entered] DEFAULT (getdate()),
[Expires] [datetime] NOT NULL CONSTRAINT [DF_UserTokens_Expires] DEFAULT (getdate()+(1200)),
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [PK_UserTokens] 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]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_Users_Email] Script Date: 4/27/2015 11:13:12 AM ******/
CREATE NONCLUSTERED INDEX [IX_Users_Email] ON [dbo].[Users]
(
[Email] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: FullTextIndex Script Date: 4/27/2015 11:13:12 AM ******/
CREATE FULLTEXT INDEX ON [dbo].[CodeSnippets](
[Code] LANGUAGE 'English',
[Title] LANGUAGE 'English')
KEY INDEX [PK_CodeSnippets]ON ([CodePasteFullText], FILEGROUP [PRIMARY])
WITH (CHANGE_TRACKING = AUTO, STOPLIST = SYSTEM)
GO
ALTER TABLE [dbo].[Lookups] ADD CONSTRAINT [DF_Lookups_Value] DEFAULT ('') FOR [Value]
GO
ALTER TABLE [dbo].[Lookups] ADD CONSTRAINT [DF_Lookups_IntValue] DEFAULT ((0)) FOR [IntValue]
GO
ALTER TABLE [dbo].[Lookups] ADD CONSTRAINT [DF_Lookups_DecimalValue] DEFAULT ((0.00)) FOR [DecimalValue]
GO
ALTER TABLE [dbo].[Lookups] ADD CONSTRAINT [DF_Lookups_Value2] DEFAULT ('') FOR [Value2]
GO
ALTER TABLE [dbo].[UserGroups] ADD CONSTRAINT [DF_UserGroups_Id] DEFAULT ('') FOR [Id]
GO
ALTER TABLE [dbo].[UserGroups] ADD CONSTRAINT [DF_UserGroups_UserId] DEFAULT ('') FOR [UserId]
GO
ALTER TABLE [dbo].[UserGroups] ADD CONSTRAINT [DF_UserGroups_GroupUserId] DEFAULT ('') FOR [GroupUserId]
GO
ALTER TABLE [dbo].[UserGroups] ADD CONSTRAINT [DF_UserGroups_GroupName] DEFAULT ('') FOR [GroupName]
GO
ALTER TABLE [dbo].[UserGroups] ADD CONSTRAINT [DF_Table_1_GroupAccess] DEFAULT ((0)) FOR [Access]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Cookie assigned to user. If same user accesses snippet he can edit.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CodeSnippets', @level2type=N'COLUMN',@level2name=N'UserId'
GO
USE [master]
GO
ALTER DATABASE [CodePaste] SET READ_WRITE
GO