-
Notifications
You must be signed in to change notification settings - Fork 2
/
DatabaseMigration.sql
73 lines (67 loc) · 3.57 KB
/
DatabaseMigration.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
CREATE SCHEMA [Audit]
GO
CREATE SCHEMA [Rating]
GO
CREATE SCHEMA [User]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Audit].[Messages](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Message] [nvarchar](max) NULL,
[DateTime] [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)
)
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Rating].[WeeklyRatingUserModel](
[Id] [int] IDENTITY(1,1) NOT NULL,
[CodewarsUsername] [nvarchar](50) NOT NULL,
[WeekNumber] [int] NOT NULL,
[Points] [int] NOT NULL,
CONSTRAINT [PK_WeeklyRatingUserModel] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Rating].[Weeks](
[Id] [int] IDENTITY(1,1) NOT NULL,
[WeekNumber] [int] NOT NULL,
[EndDate] [datetime] NOT NULL,
CONSTRAINT [PK_Weeks] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [User].[Users](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CodewarsUsername] [nvarchar](100) NOT NULL,
[CodewarsFullname] [nvarchar](100) NULL,
[TelegramUsername] [nvarchar](100) NULL,
[TelegramId] [int] NULL,
[DateTime] [datetime] NOT NULL,
[Points] [int] 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)
)
GO