/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
36.4.11 by b11johgu
fixed bugg #1171788
1
CREATE SCHEMA IF NOT EXISTS `lenasys` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
2
USE `lenasys` ;
32.1.1 by b11johgu
Added database and example student.
3
-- -----------------------------------------------------
50.1.1 by galaxyAbstractor
Started implementing categories and a menu
4
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
5
-- -----------------------------------------------------
6
-- Table `lenasys`.`Courses`
7
-- -----------------------------------------------------
8
CREATE  TABLE IF NOT EXISTS `lenasys`.`Courses` (
9
  `courseID` VARCHAR(10) NOT NULL ,
10
  `name` VARCHAR(45) NULL ,
11
  `courseData` VARCHAR(128) NULL , -- explenation about course, example: G1N 7,5hp  + additional text
12
  PRIMARY KEY (`courseID`))
13
ENGINE = InnoDB;
36.4.11 by b11johgu
fixed bugg #1171788
14
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
15
-- -----------------------------------------------------
29.1.3 by b11johgu
changed the order on the tables.
16
-- Table `lenasys`.`Users`
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
17
-- -----------------------------------------------------
36.2.1 by Johan Gustavsson
fixed bugg #1170270
18
29.1.3 by b11johgu
changed the order on the tables.
19
CREATE  TABLE IF NOT EXISTS `lenasys`.`Users` (
20
  `userName` VARCHAR(20) NOT NULL ,
36.4.13 by b11johgu
fixed minor buggs
21
  `userType` ENUM('Teacher','Student') DEFAULT 'Student' , -- 1=teacher and 2=student
29.1.3 by b11johgu
changed the order on the tables.
22
  `name` VARCHAR(45) NULL ,
36.2.1 by Johan Gustavsson
fixed bugg #1170270
23
  `passwd` CHAR(40) NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
24
  `passwdHint` CHAR(100) NULL ,
29.1.4 by b11johgu
changed the order of the attributes in the tables.
25
  `ssn` CHAR(13) NULL COMMENT 'yyyymmdd-xxxx' ,
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
26
  `firstLogin` BIT(1) NOT NULL DEFAULT 1, -- 1=true 0=false
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
27
  `activeCourse` VARCHAR(10) NULL,
28
  `email` VARCHAR(128) NULL,
29
  PRIMARY KEY (`userName`) ,
30
  FOREIGN KEY (`activeCourse` )
31
  REFERENCES `lenasys`.`Courses` (`courseID`)ON UPDATE CASCADE ON DELETE CASCADE)
32
ENGINE = InnoDB;
33
34
35
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
36
29.1.3 by b11johgu
changed the order on the tables.
37
-- -----------------------------------------------------
38
-- Table `lenasys`.`StudentCourseRegistrations`
39
-- -----------------------------------------------------
40
CREATE  TABLE IF NOT EXISTS `lenasys`.`StudentCourseRegistrations` (
29.1.7 by b11johgu
fixed comments and an attribute
41
  `courseOccasion` VARCHAR(16) NOT NULL , -- Example HT2012 period 2
29.1.3 by b11johgu
changed the order on the tables.
42
  `userName` VARCHAR(20) NOT NULL ,
29.1.4 by b11johgu
changed the order of the attributes in the tables.
43
  `courseID` VARCHAR(10) NOT NULL , -- Example G14234
44
  PRIMARY KEY (`courseOccasion`,`userName`, `courseID`) ,
29.1.3 by b11johgu
changed the order on the tables.
45
    FOREIGN KEY (`userName` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
46
    REFERENCES `lenasys`.`Users` (`userName` )ON UPDATE CASCADE ON DELETE CASCADE,
29.1.3 by b11johgu
changed the order on the tables.
47
    FOREIGN KEY (`courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
48
    REFERENCES `lenasys`.`Courses` (`courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
29.1.3 by b11johgu
changed the order on the tables.
49
ENGINE = InnoDB;
50
51
-- -----------------------------------------------------
36.4.7 by b11johgu
Finished database based on relationstabell v.2
52
-- Table `lenasys`.`Categories`
53
-- -----------------------------------------------------
54
55
CREATE  TABLE IF NOT EXISTS `lenasys`.`Categories` (
56
  `categoryName` VARCHAR(64) NOT NULL ,
57
  `courseID` VARCHAR(10) NOT NULL ,
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
58
  `orderNr` INT NOT NULL , -- the order of the examples in the same category 
36.4.7 by b11johgu
Finished database based on relationstabell v.2
59
  PRIMARY KEY (`categoryName`, `courseID`) ,
60
    FOREIGN KEY (`courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
61
    REFERENCES `lenasys`.`Courses` (`courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
36.4.7 by b11johgu
Finished database based on relationstabell v.2
62
ENGINE = InnoDB;
63
64
-- -----------------------------------------------------
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
65
-- Table `lenasys`.`SubCategories`
66
-- -----------------------------------------------------
36.4.13 by b11johgu
fixed minor buggs
67
CREATE  TABLE IF NOT EXISTS `lenasys`.`SubCategories` (
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
68
  `subCategoryName` VARCHAR(64) NOT NULL ,
69
  `categoryName` VARCHAR(64) NOT NULL ,
70
  `courseID` VARCHAR(10) NOT NULL ,
71
  `orderNr` INT NOT NULL , -- the order of the examples in the same category
72
  PRIMARY KEY (`subCategoryName`, `categoryName`, `courseID`) ,
73
    FOREIGN KEY (`categoryName` , `courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
74
    REFERENCES `lenasys`.`Categories` (`categoryName` , `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
75
ENGINE = InnoDB;
76
77
-- -----------------------------------------------------
29.1.3 by b11johgu
changed the order on the tables.
78
-- Table `lenasys`.`Quizzes`
79
-- -----------------------------------------------------
80
CREATE  TABLE IF NOT EXISTS `lenasys`.`Quizzes` (
29.1.4 by b11johgu
changed the order of the attributes in the tables.
81
  `quizNr` INT NOT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
82
  `subCategoryName` VARCHAR(64) NOT NULL ,
36.4.7 by b11johgu
Finished database based on relationstabell v.2
83
  `categoryName` VARCHAR(64) NOT NULL ,
29.1.3 by b11johgu
changed the order on the tables.
84
  `courseID` VARCHAR(10) NOT NULL ,
85
  `quizData` VARCHAR(45) NULL ,
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
86
  `allowMultipleReplies` BIT(1) NULL , -- 1=true and 0=false
87
  `autoCorrected` BIT(1) NULL , -- if the quiz is corrected by auto or if the teacher needs to do it manually., 1=true and 0=false
29.1.4 by b11johgu
changed the order of the attributes in the tables.
88
  `openingDate` DATETIME NULL ,  -- time for the student to do the quiz
29.1.3 by b11johgu
changed the order on the tables.
89
  `closingDate` DATETIME NULL ,
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
90
  `updatedAt` TIMESTAMP ON UPDATE NOW() , 
36.4.13 by b11johgu
fixed minor buggs
91
  PRIMARY KEY (`quizNr`,  `subCategoryName`, `categoryName` , `courseID`) ,
92
    FOREIGN KEY (`subCategoryName`, `categoryName`, `courseID`)
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
93
    REFERENCES `lenasys`.`SubCategories` (`subCategoryName`, `categoryName`, `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
29.1.3 by b11johgu
changed the order on the tables.
94
ENGINE = InnoDB;
95
96
-- -----------------------------------------------------
97
-- Table `lenasys`.`QuizQuestions`
98
-- -----------------------------------------------------
99
CREATE  TABLE IF NOT EXISTS `lenasys`.`QuizQuestions` (
29.1.5 by b11johgu
corrected the order of tables/attributes further
100
  `questionID` INT NOT NULL , -- The id of the individual question in the quiz.
101
  `quizNr` INT NOT NULL , -- The quiz from wich the question is from
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
102
  `subCategoryName` VARCHAR(64) NOT NULL ,
103
  `categoryName` VARCHAR(64) NOT NULL ,
29.1.3 by b11johgu
changed the order on the tables.
104
  `courseID` VARCHAR(10) NOT NULL ,
29.1.5 by b11johgu
corrected the order of tables/attributes further
105
  `questionData` VARCHAR(45) NULL , -- the question
106
  `correctAnswer` VARCHAR(45) NULL , -- the answer
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
107
  PRIMARY KEY (`questionID`, `quizNr`, `subCategoryName`,`categoryName` ,  `courseID`) ,
108
    FOREIGN KEY (`quizNr` ,`subCategoryName` ,`categoryName`,  `courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
109
    REFERENCES `lenasys`.`Quizzes` (`quizNr` , `subCategoryName`,`categoryName` , `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
29.1.3 by b11johgu
changed the order on the tables.
110
ENGINE = InnoDB;
111
112
-- -----------------------------------------------------
113
-- Table `lenasys`.`AssignedQuizzes`
114
-- -----------------------------------------------------
115
CREATE  TABLE IF NOT EXISTS `lenasys`.`AssignedQuizzes` (
29.1.7 by b11johgu
fixed comments and an attribute
116
  `courseOccasion` VARCHAR(16) NOT NULL , -- Example HT2012 period 2
29.1.5 by b11johgu
corrected the order of tables/attributes further
117
  `userName` VARCHAR(20) NOT NULL , -- wich student took the quiz
29.1.3 by b11johgu
changed the order on the tables.
118
  `courseID` VARCHAR(10) NOT NULL ,
119
  `quizNr` INT NOT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
120
  `subCategoryName` VARCHAR(64) NOT NULL ,
121
  `categoryName` VARCHAR(64) NOT NULL ,
29.1.3 by b11johgu
changed the order on the tables.
122
  `quizCourseID` VARCHAR(10) NOT NULL ,
29.1.5 by b11johgu
corrected the order of tables/attributes further
123
  `answers` VARCHAR(45) NULL , -- answers provided by the student
124
  `answerHash` VARCHAR(45) NULL , -- a security measure
125
  `answeredTimeStamp` DATETIME NULL , -- when the student submittet the quiz
29.1.3 by b11johgu
changed the order on the tables.
126
  `grade` VARCHAR(8) NULL ,
127
  `gradeComment` VARCHAR(200) NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
128
  PRIMARY KEY (`courseOccasion` ,`userName`, `courseID`, `quizNr`, `quizCourseID`) ,
29.1.3 by b11johgu
changed the order on the tables.
129
    FOREIGN KEY (`courseOccasion`,`userName` , `courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
130
    REFERENCES `lenasys`.`StudentCourseRegistrations` (`courseOccasion`,`userName` , `courseID` )ON UPDATE CASCADE ON DELETE CASCADE,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
131
    FOREIGN KEY (`quizNr` ,`subCategoryName`,`categoryName`, `quizCourseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
132
    REFERENCES `lenasys`.`Quizzes` (`quizNr` ,`subCategoryName`,`categoryName`, `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
29.1.3 by b11johgu
changed the order on the tables.
133
ENGINE = InnoDB;
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
134
36.4.6 by b11johgu
changed primary key in UserTypeCodes to UserTypeCode
135
136
137
-- -----------------------------------------------------
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
138
-- Table `lenasys`.`Examples`
139
-- -----------------------------------------------------
140
CREATE  TABLE IF NOT EXISTS `lenasys`.`Examples` (
29.1.4 by b11johgu
changed the order of the attributes in the tables.
141
  `exampleName` VARCHAR(20) NOT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
142
  `subCategoryName` VARCHAR(64) NOT NULL ,
36.4.7 by b11johgu
Finished database based on relationstabell v.2
143
  `categoryName` VARCHAR(64) NOT NULL ,
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
144
  `courseID` VARCHAR(10) NOT NULL ,
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
145
  `orderNr` INT NOT NULL , -- the order of the examples in the same category 
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
146
  `description` VARCHAR(200) NULL ,
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
147
  `updatedAt` TIMESTAMP ON UPDATE NOW() , 
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
148
  PRIMARY KEY (`exampleName`, `subCategoryName`, `categoryName`, `courseID`) ,
149
    FOREIGN KEY (`subCategoryName`, `categoryName`, `courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
150
    REFERENCES `lenasys`.`SubCategories` (`subCategoryName`,`categoryName`, `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
151
ENGINE = InnoDB;
152
29.1.3 by b11johgu
changed the order on the tables.
153
-- -----------------------------------------------------
154
-- Table `lenasys`.`Files`
155
-- -----------------------------------------------------
156
CREATE  TABLE IF NOT EXISTS `lenasys`.`Files` (
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
157
  `fileName` VARCHAR(228) NOT NULL ,
158
  `fileType` ENUM('Text', 'Code', 'Video', 'Picture') DEFAULT 'text' ,  -- text=1, code=2, video=3 picture=4
159
  `codeLanguage` VARCHAR(10) NULL , 									-- example: javascript, html, m.m.
160
  `dataBlob` BLOB NULL , 												-- This is where the binary file is stored. Searchable. 
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
161
  `updatedAt` TIMESTAMP ON UPDATE NOW() , 
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
162
  PRIMARY KEY (`fileName`))
29.1.3 by b11johgu
changed the order on the tables.
163
ENGINE = InnoDB;
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
164
-- -----------------------------------------------------
165
-- Table `lenasys`.`Containers`
166
-- -----------------------------------------------------
167
CREATE  TABLE IF NOT EXISTS `lenasys`.`Containers` (
168
  `columnNr` INT NOT NULL ,
169
  `orderNr` INT NOT NULL , -- the order of the examples in the same category 
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
170
  `fileName` VARCHAR(228) NOT NULL , -- primary key??
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
171
  `exampleName` VARCHAR(20) NOT NULL ,
172
  `subCategoryName` VARCHAR(64) NOT NULL ,
173
  `categoryName` VARCHAR(64) NOT NULL ,
174
  `courseID` VARCHAR(10) NOT NULL ,
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
175
  `executable` BIT(1) , -- 1=true and 0=false
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
176
  PRIMARY KEY (`columnNr`, `orderNr`, `fileName`,`exampleName`,`subCategoryName`, `categoryName`, `courseID`) ,
177
    FOREIGN KEY (`fileName` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
178
    REFERENCES `lenasys`.`Files` (`fileName` )ON UPDATE CASCADE ON DELETE CASCADE,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
179
	FOREIGN KEY (`exampleName`,`subCategoryName` ,`categoryName` , `courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
180
    REFERENCES `lenasys`.`Examples` (`exampleName`,`subCategoryName` ,`categoryName` , `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
181
ENGINE = InnoDB;
29.1.3 by b11johgu
changed the order on the tables.
182
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
183
-- -----------------------------------------------------
184
-- Table `lenasys`.`FileInterestingLines`
185
-- -----------------------------------------------------
186
CREATE  TABLE IF NOT EXISTS `lenasys`.`FileInterestingLines` (
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
187
`id` INT NOT NULL AUTO_INCREMENT ,
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
188
`fileName` VARCHAR(228) NOT NULL ,
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
189
`columnNr` INT NOT NULL ,
190
`orderNr` INT NOT NULL ,
191
`exampleName` VARCHAR(20) NOT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
192
`subCategoryName` VARCHAR(64) NOT NULL ,
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
193
`categoryName` VARCHAR(64) NOT NULL ,
194
`courseID` VARCHAR(10) NOT NULL ,
195
`beginAt` INT NULL ,
196
`endAt` INT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
197
PRIMARY KEY (`id`, `fileName` , `columnNr`, `exampleName`,`subCategoryName`,`categoryName`, `courseID`) ,
198
FOREIGN KEY (`columnNr`, `orderNr`, `fileName`, `exampleName`,`subCategoryName`, `categoryName`, `courseID`)
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
199
REFERENCES `lenasys`.`Containers` (`columnNr`, `orderNr`, `fileName`, `exampleName`,`subCategoryName`, `categoryName`, `courseID`)ON UPDATE CASCADE ON DELETE CASCADE)
36.4.7 by b11johgu
Finished database based on relationstabell v.2
200
ENGINE = InnoDB;
201
202
-- -----------------------------------------------------
203
-- Table `lenasys`.`Keywords`
204
-- -----------------------------------------------------
205
CREATE  TABLE IF NOT EXISTS `lenasys`.`Keywords` (
206
  `keyword` VARCHAR(20) NOT NULL ,
207
  `exampleName` VARCHAR(20) NOT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
208
  `subCategoryName` VARCHAR(64) NOT NULL ,
36.4.7 by b11johgu
Finished database based on relationstabell v.2
209
  `categoryName` VARCHAR(64) NOT NULL ,
210
  `courseID` VARCHAR(10) NOT NULL ,
36.4.12 by b11johgu
uppdated database after "relationsdatamodell" in google drive
211
  PRIMARY KEY (`keyword`, `exampleName`, `subCategoryName` , `categoryName`, `courseID`) ,
212
    FOREIGN KEY (`exampleName`,`subCategoryName` , `categoryName`, `courseID` )
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
213
    REFERENCES `lenasys`.`Examples` (`exampleName`, `subCategoryName` , `categoryName`, `courseID` )ON UPDATE CASCADE ON DELETE CASCADE)
28.1.1 by b11johgu
added a new .sql to test alongside with the old.
214
ENGINE = InnoDB;
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
215
216
217
-- -----------------------------------------------------
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
218
-- Table `lenasys`.`logUserLoginAttempts`
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
219
-- -----------------------------------------------------
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
220
CREATE  TABLE IF NOT EXISTS `lenasys`.`logUserLoginAttempts` (
221
  `id` INT NOT NULL AUTO_INCREMENT,
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
222
  `userName` VARCHAR(20) NOT NULL ,
36.4.2 by b11johgu
Finished log-tables.
223
  `userAgent` VARCHAR(200) NOT NULL , -- web browser and version
224
  `userIP` VARCHAR(20) NOT NULL , --  ip-number
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
225
  `browserID` VARCHAR(64) NOT NULL , -- autogenerated id for local-storage
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
226
  `loginTimeStamp` TIMESTAMP ON UPDATE NOW()  ,
227
  `success` BIT(1) NOT NULL , -- 1=true and 0=false
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
228
  PRIMARY KEY (`id`))
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
229
ENGINE = InnoDB;
230
-- -------------------------------------------------
231
-- Table `lenasys`.`logAssignedQuizzesAnswers`
232
-- -----------------------------------------------------
36.4.4 by b11johgu
Changed places on insert inty UserTypeCodes and Users
233
CREATE  TABLE IF NOT EXISTS `lenasys`.`logAssignedQuizzesAnswers` (
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
234
  `id` INT NOT NULL ,
235
  `userName` VARCHAR(20)  NOT NULL ,
36.4.2 by b11johgu
Finished log-tables.
236
  `userAgent` VARCHAR(200) NOT NULL ,
237
  `userIP` VARCHAR(20) NOT NULL ,
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
238
  `courseID` VARCHAR(10) NOT NULL ,
239
  `courseOccasion` VARCHAR(16) NOT NULL ,
240
  `quizNr` INT NOT NULL ,
241
  `answers` VARCHAR(45) NULL ,
242
  `answerHash` VARCHAR(45) NULL ,
36.4.6 by b11johgu
changed primary key in UserTypeCodes to UserTypeCode
243
  `answeredTimeStamp` DATETIME NULL , -- TIMESTAMP ??
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
244
  `grade` VARCHAR(8) NULL ,
245
  `gradeComment` VARCHAR(200) NULL ,
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
246
  PRIMARY KEY (`id`))
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
247
248
ENGINE = InnoDB;
249
-- -------------------------------------------------
250
-- Table `lenasys`.`logBenchmark`
251
-- -----------------------------------------------------
36.4.4 by b11johgu
Changed places on insert inty UserTypeCodes and Users
252
CREATE  TABLE IF NOT EXISTS `lenasys`.`logBenchmark` (
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
253
  `id` INT NOT NULL ,
254
  `userName` VARCHAR(20) NOT NULL ,
36.4.2 by b11johgu
Finished log-tables.
255
  `userAgent` VARCHAR(200) NOT NULL ,
256
  `userIP` VARCHAR(20)  NOT NULL ,
257
  `browser` VARCHAR(20)  NOT NULL , -- will they be used to show different views? Can we just use userAgent instead?
258
  `browserVersion` VARCHAR(20) NOT NULL , -- -||-
259
  `renderer` VARCHAR(20) NOT NULL , -- ??
260
  `rendererVersion` VARCHAR(20) NOT NULL , -- ??
261
  `os` VARCHAR(64) NOT NULL ,
262
  `osVersion` VARCHAR(20) NOT NULL ,
263
  `fps` VARCHAR(20) NOT NULL ,
264
  `maxFps` VARCHAR(20) NOT NULL ,
36.4.11 by b11johgu
fixed bugg #1171788
265
  `hostName` VARCHAR(20) NOT NULL , -- Ändrad till hostName
36.4.2 by b11johgu
Finished log-tables.
266
  `app` VARCHAR(20) NOT NULL ,
267
  `screenResolution` VARCHAR(20) NOT NULL ,
268
  `logTimeStamp` DATETIME NOT NULL ,
269
  `runtime` INT NOT NULL ,
36.4.10 by b11johgu
removed databas2.sql, put the code in sql so no auto-generated
270
  PRIMARY KEY (`id`))
36.4.1 by b11johgu
"finished" log-tables, just need further instructions about how
271
ENGINE = InnoDB;
36.2.1 by Johan Gustavsson
fixed bugg #1170270
272
-- -------------------------------------------------
273
36.4.16 by b11johgu
added example-data in databas.sql in talbes:
274
INSERT INTO `lenasys`.`Users` (`userName`,`name`,`passwd`, passwdHint,`userType`,`ssn`) 
54.1.1 by b11johgu
Added tables in Users: firstLogin and activeCourse
275
VALUES ('student','Per Student','06d31954049ffa053039ae83bab3dcd0ebc67195','gamla vanliga' ,2,'19900385-2345'),
276
('student2','Gösta Student','06d31954049ffa053039ae83bab3dcd0ebc67195','SypARN',2,'19800385-2385'),
277
('lärare','Kalle Lärare','06d31954049ffa053039ae83bab3dcd0ebc67195','Syp och året då Sverige först tillåter kommersiell radio x2',1,'19800385-2325');
36.4.16 by b11johgu
added example-data in databas.sql in talbes:
278
279
INSERT INTO `Courses`(`courseID`, `name`, `courseData`) 
36.4.17 by b11johgu
added data in tables:
280
VALUES('DA133G'  , 'Webbutveckling - datorgrafik G1N' , ' 7,5hp (IKI)'),
281
('d1popcrn'  , 'Webbutveckling - Läran om Gson' , ' 7,5hp (IKI)'),
282
('DAG123'  , 'Webbutveckling - Nånting' , ' 7,5hp (IKI)');
36.4.15 by b11johgu
started inserting data into the tables
283
36.4.16 by b11johgu
added example-data in databas.sql in talbes:
284
INSERT INTO `StudentCourseRegistrations`(`courseOccasion`, `userName`, `courseID`) 
36.4.15 by b11johgu
started inserting data into the tables
285
VALUES ('HT2012 period 2','student','d1popcrn'),
286
('HT2012 period 2','student','DA133G'),
36.4.17 by b11johgu
added data in tables:
287
('HT2012 period 2','student2','d1popcrn'),
288
('HT2012 period 2','student2','DAG123');
36.4.15 by b11johgu
started inserting data into the tables
289
36.4.16 by b11johgu
added example-data in databas.sql in talbes:
290
INSERT INTO `Categories`(`categoryName`, `courseID`, `orderNr`) 
291
VALUES ('Vektorgrafik','DA133G', 1),
292
('Shading','DA133G', 2),
293
('3D','DA133G', 3),
36.4.17 by b11johgu
added data in tables:
294
('Tidigt 90-tal','d1popcrn', 1),
295
('Categorie i nånting','DAG123', 1),
296
('Categorie i någontingen mer','DAG123', 2);
36.4.16 by b11johgu
added example-data in databas.sql in talbes:
297
298
INSERT INTO `SubCategories`(`subCategoryName`, `categoryName`, `courseID`, `orderNr`) 
36.4.17 by b11johgu
added data in tables:
299
VALUES ('Punkt' ,'Vektorgrafik','DA133G', 1),
300
('Linjer' ,'Vektorgrafik','DA133G', 2),
301
('Böjningar' ,'Vektorgrafik','DA133G', 3),
36.4.16 by b11johgu
added example-data in databas.sql in talbes:
302
('Vertexshading','Shading','DA133G', 1),
36.4.17 by b11johgu
added data in tables:
303
('Globalshading','Shading','DA133G', 2),
304
('Bra 3d' , '3D','DA133G', 1),
305
('Dålig 3d' , '3D','DA133G', 2),
306
('Smurfhits','Tidigt 90-tal','d1popcrn', 1),
307
('NES','Tidigt 90-tal','d1popcrn', 2),
308
('Sovmorgon','Tidigt 90-tal','d1popcrn', 3),
309
('Subcategorie i nånting' ,'Categorie i nånting','DAG123', 1),
310
('Subcategorie2 i nånting' ,'Categorie i nånting','DAG123', 2),
311
('Subcategorie i nåntingen mer', 'Categorie i någontingen mer','DAG123', 1),
312
('Subcategorie2 i nåntingen mer', 'Categorie i någontingen mer','DAG123', 2);
313
314
315
316
INSERT INTO Quizzes(`quizNr`, `subCategoryName`, `categoryName`, `courseID`, `quizData`, `allowMultipleReplies`,`autoCorrected`, `openingDate`,`closingDate` ) 
317
VALUES(1,'punkt' ,'Vektorgrafik','DA133G','Svara så gott du kan, lycka till',1,1, '2013-05-20 08:00:00','2013-05-25 23:59:00'),
318
(2,'punkt' ,'Vektorgrafik','DA133G','Lol glhf',1,1, '2013-05-20 08:00:00','2013-05-25 23:59:00'),
319
(3,'punkt' ,'Vektorgrafik','DA133G','ajaja detta kommer nu gå bra *NAWHT*',1,1, '2013-05-20 08:00:00','2013-05-25 23:59:00'),
320
(1,'linjer' ,'Vektorgrafik','DA133G','happ happ lycka till',1,1, '2013-05-20 08:00:00','2013-05-25 23:59:00');
321
  
322
 INSERT INTO QuizQuestions(`questionID`, `quizNr`, `subCategoryName`, `categoryName`, `courseID`, `questionData`, `correctAnswer`) 
323
 VALUES(1,1,'punkt' ,'Vektorgrafik','DA133G','vad är roten av pi plus solens massa?','inte vet jag lol'),
324
(2,1,'punkt' ,'Vektorgrafik','DA133G','hur mår du?','Bra som bara den');
325
326
INSERT INTO Examples(`exampleName`, `subCategoryName`, `categoryName`, `courseID`, `orderNr`, `description`) 
327
VALUES('punkt example 1','punkt' ,'Vektorgrafik','DA133G',1,'nån sorts förklaring om punkter'),
328
('punkt example 2','punkt' ,'Vektorgrafik','DA133G',2,'nån sorts förklaring om punkter i example 2'),
329
('ett till exempel inom punkt','punkt' ,'Vektorgrafik','DA133G',3,'nån sorts förklaring om punkter igen'),
330
('linjer example 1','linjer' ,'Vektorgrafik','DA133G',1,'nån sorts förklaring om linjer');
331
332
INSERT INTO Files(`fileName`,`fileType`,`codeLanguage`, `dataBlob`) 
333
VALUES('exempel fil1',1,'html','Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
334
Phasellus a tellus lacus, a dapibus velit. Integer ac lorem dui, nec condimentum purus. Nullam convallis erat a 
335
mauris pulvinar adipiscing. In consectetur, odio sit amet dictum pulvinar, erat risus condimentum mi, eu eleifend 
336
dolor est id elit. Pellentesque eu tellus sed sem molestie fringilla. Integer auctor arcu nec nunc pharetra non 
337
consectetur augue viverra. Pellentesque lorem nisl, tristique sed lobortis et, tincidunt sit amet diam. Maecenas 
338
lacinia laoreet ligula, eget pretium libero venenatis malesuada. Suspendisse eu velit in arcu consectetur dictum a quis orci. 
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
339
Maecenas vulputate tincidunt odio sit amet interdum. CuraBIT(1)ur non ante tristique mi malesuada dictum at quis nunc. 
36.4.17 by b11johgu
added data in tables:
340
Suspendisse ornare leo a elit egestas eu rutrum lorem cursus. Quisque sollicitudin, nisi eget consectetur auctor, 
341
leo risus blandit eros, id aliquet purus tortor a turpis. Donec venenatis blandit est quis imperdiet. Sed mauris eros, 
342
pharetra vitae tempus vel, pretium at purus.'),
343
57.1.1 by b11johgu
changed BIT to BIT(1) and CURRENT_TIMESTAMP to NOW()
344
('exempel fil2',1,'html','Donec sed turpis ante, et dapibus augue. Pellentesque haBIT(1)ant morbi tristique 
36.4.17 by b11johgu
added data in tables:
345
senectus et netus et malesuada fames ac turpis egestas. Sed at tellus ante. Nunc non dolor ipsum, quis lacinia felis. 
346
Sed tristique, leo eu imperdiet laoreet, lacus lacus porta purus, quis laoreet nisi sem non orci. In non consequat enim. 
347
Donec lacinia auctor convallis. Nulla facilisi. Nulla tortor mi, accumsan vel cursus nec, porta nec ante.
348
 Aenean venenatis elit vel sem sodales vulputate. Donec adipiscing porta tortor, sed sollicitudin erat dapibus id');
349
350
36.2.1 by Johan Gustavsson
fixed bugg #1170270
351
-- -----------------------------------------------------
29.1.4 by b11johgu
changed the order of the attributes in the tables.
352
-- allow maximum of 5 succesfull quiz-attemps is a good begining for implementation of the loggingtables to add restriction. 
36.4.11 by b11johgu
fixed bugg #1171788
353
-- ska courseID i ContainerFiles vara foreignkey ifrån contaiers??