-
Notifications
You must be signed in to change notification settings - Fork 0
/
ikutku.sql
677 lines (631 loc) · 42.9 KB
/
ikutku.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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
USE [master]
GO
/****** Object: Database [ikutku] Script Date: 29/3/2018 6:59:03 PM ******/
CREATE DATABASE [ikutku]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'ikutku', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ikutku.mdf' , SIZE = 16320KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'ikutku_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ikutku_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [ikutku] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [ikutku].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [ikutku] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [ikutku] SET ANSI_NULLS OFF
GO
ALTER DATABASE [ikutku] SET ANSI_PADDING OFF
GO
ALTER DATABASE [ikutku] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [ikutku] SET ARITHABORT OFF
GO
ALTER DATABASE [ikutku] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [ikutku] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [ikutku] SET AUTO_SHRINK ON
GO
ALTER DATABASE [ikutku] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [ikutku] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [ikutku] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [ikutku] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [ikutku] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [ikutku] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [ikutku] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [ikutku] SET DISABLE_BROKER
GO
ALTER DATABASE [ikutku] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [ikutku] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [ikutku] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [ikutku] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [ikutku] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [ikutku] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [ikutku] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [ikutku] SET RECOVERY SIMPLE
GO
ALTER DATABASE [ikutku] SET MULTI_USER
GO
ALTER DATABASE [ikutku] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [ikutku] SET DB_CHAINING OFF
GO
ALTER DATABASE [ikutku] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [ikutku] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO
EXEC sys.sp_db_vardecimal_storage_format N'ikutku', N'ON'
GO
USE [ikutku]
GO
/****** Object: User [ikutku] Script Date: 29/3/2018 6:59:03 PM ******/
CREATE USER [ikutku] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
ALTER ROLE [db_owner] ADD MEMBER [ikutku]
GO
/****** Object: PartitionFunction [FollowersPartitionFunction] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE PARTITION FUNCTION [FollowersPartitionFunction](nvarchar(20)) AS RANGE LEFT FOR VALUES ()
GO
/****** Object: PartitionScheme [FollowersPartitionScheme] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE PARTITION SCHEME [FollowersPartitionScheme] AS PARTITION [FollowersPartitionFunction] TO ([PRIMARY])
GO
/****** Object: StoredProcedure [dbo].[ELMAH_GetErrorsXml] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ELMAH_GetErrorsXml]
(
@Application NVARCHAR(60),
@PageIndex INT = 0,
@PageSize INT = 15,
@TotalCount INT OUTPUT
)
AS
SET NOCOUNT ON
DECLARE @FirstTimeUTC DATETIME
DECLARE @FirstSequence INT
DECLARE @StartRow INT
DECLARE @StartRowIndex INT
SELECT
@TotalCount = COUNT(1)
FROM
[ELMAH_Error]
WHERE
[Application] = @Application
-- Get the ID of the first error for the requested page
SET @StartRowIndex = @PageIndex * @PageSize + 1
IF @StartRowIndex <= @TotalCount
BEGIN
SET ROWCOUNT @StartRowIndex
SELECT
@FirstTimeUTC = [TimeUtc],
@FirstSequence = [Sequence]
FROM
[ELMAH_Error]
WHERE
[Application] = @Application
ORDER BY
[TimeUtc] DESC,
[Sequence] DESC
END
ELSE
BEGIN
SET @PageSize = 0
END
-- Now set the row count to the requested page size and get
-- all records below it for the pertaining application.
SET ROWCOUNT @PageSize
SELECT
errorId = [ErrorId],
application = [Application],
host = [Host],
type = [Type],
source = [Source],
message = [Message],
[user] = [User],
statusCode = [StatusCode],
time = CONVERT(VARCHAR(50), [TimeUtc], 126) + 'Z'
FROM
[ELMAH_Error] error
WHERE
[Application] = @Application
AND
[TimeUtc] <= @FirstTimeUTC
AND
[Sequence] <= @FirstSequence
ORDER BY
[TimeUtc] DESC,
[Sequence] DESC
FOR
XML AUTO
GO
/****** Object: StoredProcedure [dbo].[ELMAH_GetErrorXml] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ELMAH_GetErrorXml]
(
@Application NVARCHAR(60),
@ErrorId UNIQUEIDENTIFIER
)
AS
SET NOCOUNT ON
SELECT
[AllXml]
FROM
[ELMAH_Error]
WHERE
[ErrorId] = @ErrorId
AND
[Application] = @Application
GO
/****** Object: StoredProcedure [dbo].[ELMAH_LogError] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ELMAH_LogError]
(
@ErrorId UNIQUEIDENTIFIER,
@Application NVARCHAR(60),
@Host NVARCHAR(30),
@Type NVARCHAR(100),
@Source NVARCHAR(60),
@Message NVARCHAR(500),
@User NVARCHAR(50),
@AllXml NTEXT,
@StatusCode INT,
@TimeUtc DATETIME
)
AS
SET NOCOUNT ON
INSERT
INTO
[ELMAH_Error]
(
[ErrorId],
[Application],
[Host],
[Type],
[Source],
[Message],
[User],
[AllXml],
[StatusCode],
[TimeUtc]
)
VALUES
(
@ErrorId,
@Application,
@Host,
@Type,
@Source,
@Message,
@User,
@AllXml,
@StatusCode,
@TimeUtc
)
GO
/****** Object: UserDefinedFunction [dbo].[fun_DateTimeFromTicks] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fun_DateTimeFromTicks]
(@tick BIGINT, @referenceDate DATETIME)
RETURNS DATETIME
WITH SCHEMABINDING
AS
begin
return (select dateadd(ss,@tick / cast(10000000 as bigint),@referenceDate))
end
GO
/****** Object: Table [dbo].[cachedUsers] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cachedUsers](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[twitterid] [nvarchar](20) NOT NULL,
[screenName] [nvarchar](20) NOT NULL,
[profileImageUrl] [nvarchar](1500) NOT NULL,
[ratio] [decimal](18, 2) NOT NULL,
[lastTweet] [datetime] NULL,
[updated] [datetime] NOT NULL,
[followingsCount] [int] NOT NULL,
[followersCount] [int] NOT NULL,
CONSTRAINT [PK_cachedUsers] PRIMARY KEY NONCLUSTERED
(
[twitterid] 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].[ELMAH_Error] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ELMAH_Error](
[ErrorId] [uniqueidentifier] NOT NULL,
[Application] [nvarchar](60) NOT NULL,
[Host] [nvarchar](50) NOT NULL,
[Type] [nvarchar](100) NOT NULL,
[Source] [nvarchar](60) NOT NULL,
[Message] [nvarchar](500) NOT NULL,
[User] [nvarchar](50) NOT NULL,
[StatusCode] [int] NOT NULL,
[TimeUtc] [datetime] NOT NULL,
[Sequence] [int] IDENTITY(1,1) NOT NULL,
[AllXml] [ntext] NOT NULL,
CONSTRAINT [PK_ELMAH_Error] PRIMARY KEY NONCLUSTERED
(
[ErrorId] 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].[errorCounters] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[errorCounters](
[id] [smallint] IDENTITY(1,1) NOT NULL,
[type] [int] NOT NULL,
[count] [int] NOT NULL,
CONSTRAINT [PK_errorCounters] 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].[followers] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[followers](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[twitterid] [nvarchar](20) NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
CONSTRAINT [PK_followers] 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].[followings] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[followings](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[twitterid] [nvarchar](20) NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
CONSTRAINT [PK_followings] 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].[loginIntervals] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[loginIntervals](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
[timeBetweenLogins] [bigint] NOT NULL,
CONSTRAINT [PK_loginIntervals] 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].[queuedFollowingUsers] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[queuedFollowingUsers](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
CONSTRAINT [PK_queuedFollowingUsers] 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].[queuedUsers] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[queuedUsers](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
[settings] [int] NOT NULL,
CONSTRAINT [PK_queuedUsers] 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].[queueTimes] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[queueTimes](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[secondsQueued] [int] NOT NULL,
[created] [datetime] NOT NULL,
CONSTRAINT [PK_queueTimese] 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].[statistics] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[statistics](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[uncachedCount] [bigint] NOT NULL,
[uncachedElapsed] [bigint] NOT NULL,
[staleCount] [bigint] NOT NULL,
[staleElapsed] [bigint] NOT NULL,
[insertCount] [int] NOT NULL,
[insertElapsed] [bigint] NOT NULL,
[ticksSince] [bigint] NOT NULL,
[ticks] [bigint] NOT NULL,
CONSTRAINT [PK_statistics] 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: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[users](
[id] [nvarchar](20) NOT NULL,
[username] [nvarchar](20) NOT NULL,
[startTime] [datetime] NULL,
[settings] [bigint] NOT NULL,
[photoUrl] [nvarchar](500) NULL,
[updated] [datetime] NOT NULL,
[oauthToken] [varchar](256) NULL,
[oauthSecret] [varchar](256) NULL,
[followersCursor] [bigint] NULL,
[followingsCursor] [bigint] NULL,
[lastRebuildDuration] [bigint] NULL,
[followerCountSync] [int] NULL,
[followerCountTotal] [int] NULL,
[followingCountSync] [int] NULL,
[followingCountTotal] [int] NULL,
[uncachedTotal] [int] NULL,
[uncachedCount] [int] NULL,
[uncachedFollowingTotal] [int] NULL,
[uncachedFollowingCount] [int] NULL,
[userlistCount] [int] NULL,
[lastLogin] [datetime] NULL,
[authFailCount] [int] NOT NULL,
[apiNextRetry] [float] 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
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[usersInLists] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[usersInLists](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[userlistid] [nvarchar](20) NOT NULL,
[twitterid] [nvarchar](20) NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
CONSTRAINT [PK_usersInLists] 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].[usersLists] Script Date: 29/3/2018 6:59:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[usersLists](
[id] [nvarchar](20) NOT NULL,
[listname] [nvarchar](50) NOT NULL,
[slug] [nvarchar](50) NOT NULL,
[exclude] [bit] NOT NULL,
[ownerid] [nvarchar](20) NOT NULL,
[updated] [datetime] NOT NULL,
[listCursor] [bigint] NULL,
[memberCount] [int] NOT NULL,
CONSTRAINT [PK_users_lists] 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: Index [IX_cachedUsers] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE UNIQUE CLUSTERED INDEX [IX_cachedUsers] ON [dbo].[cachedUsers]
(
[updated] ASC,
[id] 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
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_followers] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_followers] ON [dbo].[followers]
(
[ownerid] ASC,
[twitterid] 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
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_followings] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_followings] ON [dbo].[followings]
(
[ownerid] ASC,
[twitterid] 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
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_queuedUsers] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_queuedUsers] ON [dbo].[queuedUsers]
(
[ownerid] 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
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_oauthSecret_incl_id_username] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE NONCLUSTERED INDEX [IX_oauthSecret_incl_id_username] ON [dbo].[users]
(
[oauthSecret] ASC
)
INCLUDE ( [id],
[username]) 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
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_ownerid_twitterid_incl_id_userlistid] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE NONCLUSTERED INDEX [IX_ownerid_twitterid_incl_id_userlistid] ON [dbo].[usersInLists]
(
[ownerid] ASC,
[twitterid] ASC
)
INCLUDE ( [id],
[userlistid]) 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
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_usersInLists] Script Date: 29/3/2018 6:59:04 PM ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_usersInLists] ON [dbo].[usersInLists]
(
[ownerid] ASC,
[userlistid] ASC,
[twitterid] 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
ALTER TABLE [dbo].[cachedUsers] ADD CONSTRAINT [DF_cachedUsers_followingsCount] DEFAULT ((0)) FOR [followingsCount]
GO
ALTER TABLE [dbo].[cachedUsers] ADD CONSTRAINT [DF_cachedUsers_followersCount] DEFAULT ((0)) FOR [followersCount]
GO
ALTER TABLE [dbo].[ELMAH_Error] ADD CONSTRAINT [DF_ELMAH_Error_ErrorId] DEFAULT (newid()) FOR [ErrorId]
GO
ALTER TABLE [dbo].[queuedUsers] ADD CONSTRAINT [DF_queuedUsers_settings] DEFAULT ((3)) FOR [settings]
GO
ALTER TABLE [dbo].[statistics] ADD CONSTRAINT [DF_statistics_insertCount] DEFAULT ((0)) FOR [insertCount]
GO
ALTER TABLE [dbo].[statistics] ADD CONSTRAINT [DF_statistics_insertElapsed] DEFAULT ((0)) FOR [insertElapsed]
GO
ALTER TABLE [dbo].[statistics] ADD CONSTRAINT [DF_statistics_ticksSince] DEFAULT ((0)) FOR [ticksSince]
GO
ALTER TABLE [dbo].[statistics] ADD CONSTRAINT [DF_statistics_ticks] DEFAULT ((0)) FOR [ticks]
GO
ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_settings] DEFAULT ((0)) FOR [settings]
GO
ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_lastLogin] DEFAULT (getdate()) FOR [lastLogin]
GO
ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_authFailCount] DEFAULT ((0)) FOR [authFailCount]
GO
ALTER TABLE [dbo].[usersLists] ADD CONSTRAINT [DF_usersLists_memberCount] DEFAULT ((0)) FOR [memberCount]
GO
ALTER TABLE [dbo].[followers] WITH NOCHECK ADD CONSTRAINT [FK_followers_cachedUsers] FOREIGN KEY([twitterid])
REFERENCES [dbo].[cachedUsers] ([twitterid])
GO
ALTER TABLE [dbo].[followers] NOCHECK CONSTRAINT [FK_followers_cachedUsers]
GO
ALTER TABLE [dbo].[followers] WITH NOCHECK ADD CONSTRAINT [FK_followers_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[followers] CHECK CONSTRAINT [FK_followers_users]
GO
ALTER TABLE [dbo].[followings] WITH NOCHECK ADD CONSTRAINT [FK_followings_cachedUsers] FOREIGN KEY([twitterid])
REFERENCES [dbo].[cachedUsers] ([twitterid])
GO
ALTER TABLE [dbo].[followings] NOCHECK CONSTRAINT [FK_followings_cachedUsers]
GO
ALTER TABLE [dbo].[followings] WITH NOCHECK ADD CONSTRAINT [FK_followings_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[followings] CHECK CONSTRAINT [FK_followings_users]
GO
ALTER TABLE [dbo].[loginIntervals] WITH CHECK ADD CONSTRAINT [FK_loginIntervals_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[loginIntervals] CHECK CONSTRAINT [FK_loginIntervals_users]
GO
ALTER TABLE [dbo].[queuedFollowingUsers] WITH CHECK ADD CONSTRAINT [FK_queuedFollowingUsers_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[queuedFollowingUsers] CHECK CONSTRAINT [FK_queuedFollowingUsers_users]
GO
ALTER TABLE [dbo].[queuedUsers] WITH CHECK ADD CONSTRAINT [FK_queuedUsers_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[queuedUsers] CHECK CONSTRAINT [FK_queuedUsers_users]
GO
ALTER TABLE [dbo].[usersInLists] WITH NOCHECK ADD CONSTRAINT [FK_usersInLists_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[usersInLists] CHECK CONSTRAINT [FK_usersInLists_users]
GO
ALTER TABLE [dbo].[usersInLists] WITH NOCHECK ADD CONSTRAINT [FK_usersInLists_usersLists] FOREIGN KEY([userlistid])
REFERENCES [dbo].[usersLists] ([id])
GO
ALTER TABLE [dbo].[usersInLists] CHECK CONSTRAINT [FK_usersInLists_usersLists]
GO
ALTER TABLE [dbo].[usersLists] WITH NOCHECK ADD CONSTRAINT [FK_users_lists_users] FOREIGN KEY([ownerid])
REFERENCES [dbo].[users] ([id])
GO
ALTER TABLE [dbo].[usersLists] CHECK CONSTRAINT [FK_users_lists_users]
GO
USE [master]
GO
ALTER DATABASE [ikutku] SET READ_WRITE
GO