-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDbSetupScript.sql
More file actions
147 lines (147 loc) · 9.82 KB
/
DbSetupScript.sql
File metadata and controls
147 lines (147 loc) · 9.82 KB
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
USE [Color]
GO
/****** Object: Schema [TEST] Script Date: 11/03/2011 21:09:26 ******/
CREATE SCHEMA [TEST] AUTHORIZATION [dbo]
GO
/****** Object: Table [TEST].[Players] Script Date: 11/03/2011 21:09:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [TEST].[Players](
[Id] [uniqueidentifier] NOT NULL,
[Name] [varchar](30) NOT NULL,
CONSTRAINT [PK_Players] 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].[Players] Script Date: 11/03/2011 21:09:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Players](
[Id] [uniqueidentifier] NOT NULL,
[Name] [varchar](30) NOT NULL,
CONSTRAINT [PK_Players] 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 [TEST].[GameRounds] Script Date: 11/03/2011 21:09:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [TEST].[GameRounds](
[Id] [uniqueidentifier] NOT NULL,
[PlayerId] [uniqueidentifier] NOT NULL,
[Date] [datetime] NOT NULL,
[Answer] [varchar](20) NOT NULL,
[FailedAttempts] [int] NOT NULL,
[Score] [int] NULL,
CONSTRAINT [PK_GameRounds] 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].[GameRounds] Script Date: 11/03/2011 21:09:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[GameRounds](
[Id] [uniqueidentifier] NOT NULL,
[PlayerId] [uniqueidentifier] NOT NULL,
[Date] [datetime] NOT NULL,
[Answer] [varchar](20) NOT NULL,
[FailedAttempts] [int] NOT NULL,
[Score] [int] NULL,
CONSTRAINT [PK_GameRounds] 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 [TEST].[GameRoundsChoices] Script Date: 11/03/2011 21:09:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [TEST].[GameRoundsChoices](
[Id] [uniqueidentifier] NOT NULL,
[GameRoundId] [uniqueidentifier] NOT NULL,
[Choice] [varchar](20) NOT NULL,
CONSTRAINT [PK_GameRoundsChoices] 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].[GameRoundsChoices] Script Date: 11/03/2011 21:09:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[GameRoundsChoices](
[Id] [uniqueidentifier] NOT NULL,
[GameRoundId] [uniqueidentifier] NOT NULL,
[Choice] [varchar](20) NOT NULL,
CONSTRAINT [PK_GameRoundsChoices] 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: ForeignKey [FK_GameRounds_Players] Script Date: 11/03/2011 21:09:26 ******/
ALTER TABLE [dbo].[GameRounds] WITH CHECK ADD CONSTRAINT [FK_GameRounds_Players] FOREIGN KEY([PlayerId])
REFERENCES [dbo].[Players] ([Id])
GO
ALTER TABLE [dbo].[GameRounds] CHECK CONSTRAINT [FK_GameRounds_Players]
GO
/****** Object: ForeignKey [FK_GameRounds_GameRoundsChoices] Script Date: 11/03/2011 21:09:26 ******/
ALTER TABLE [dbo].[GameRoundsChoices] WITH CHECK ADD CONSTRAINT [FK_GameRounds_GameRoundsChoices] FOREIGN KEY([GameRoundId])
REFERENCES [dbo].[GameRounds] ([Id])
GO
ALTER TABLE [dbo].[GameRoundsChoices] CHECK CONSTRAINT [FK_GameRounds_GameRoundsChoices]
GO
/****** Object: ForeignKey [FK_GameRounds_Players] Script Date: 11/03/2011 21:09:26 ******/
ALTER TABLE [TEST].[GameRounds] WITH CHECK ADD CONSTRAINT [FK_GameRounds_Players] FOREIGN KEY([PlayerId])
REFERENCES [TEST].[Players] ([Id])
GO
ALTER TABLE [TEST].[GameRounds] CHECK CONSTRAINT [FK_GameRounds_Players]
GO
/****** Object: ForeignKey [FK_GameRounds_GameRoundsChoices] Script Date: 11/03/2011 21:09:26 ******/
ALTER TABLE [TEST].[GameRoundsChoices] WITH CHECK ADD CONSTRAINT [FK_GameRounds_GameRoundsChoices] FOREIGN KEY([GameRoundId])
REFERENCES [TEST].[GameRounds] ([Id])
GO
ALTER TABLE [TEST].[GameRoundsChoices] CHECK CONSTRAINT [FK_GameRounds_GameRoundsChoices]
GO