/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to databas.sql

  • Committer: b11johgu
  • Date: 2013-04-23 13:56:45 UTC
  • mfrom: (47 lenasys)
  • mto: This revision was merged to the branch mainline in revision 48.
  • Revision ID: b11johgu@student.his.se-20130423135645-9r085zz3ljyjngdf
fixed minor buggs

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
CREATE  TABLE IF NOT EXISTS `lenasys`.`Users` (
13
13
  `userName` VARCHAR(20) NOT NULL ,
14
 
  `userType` ENUM(`Teacher`,`Student`) DEFAULT (`Student`) , -- 1=teacher and 2=student
 
14
  `userType` ENUM('Teacher','Student') DEFAULT 'Student' , -- 1=teacher and 2=student
15
15
  `name` VARCHAR(45) NULL ,
16
16
  `passwd` CHAR(40) NULL ,
17
17
  `passwdHint` CHAR(100) NULL ,
18
18
  `ssn` CHAR(13) NULL COMMENT 'yyyymmdd-xxxx' ,
19
 
  PRIMARY KEY (`userName`), )
 
19
  PRIMARY KEY (`userName`) )
20
20
ENGINE = InnoDB;
21
21
 
22
22
 
60
60
-- -----------------------------------------------------
61
61
-- Table `lenasys`.`SubCategories`
62
62
-- -----------------------------------------------------
 
63
CREATE  TABLE IF NOT EXISTS `lenasys`.`SubCategories` (
63
64
  `subCategoryName` VARCHAR(64) NOT NULL ,
64
65
  `categoryName` VARCHAR(64) NOT NULL ,
65
66
  `courseID` VARCHAR(10) NOT NULL ,
83
84
  `openingDate` DATETIME NULL ,  -- time for the student to do the quiz
84
85
  `closingDate` DATETIME NULL ,
85
86
  `updatedAt` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , 
86
 
  PRIMARY KEY (`quizNr`,  `subCategoryName`, `categoryName` , `courseID) ,
87
 
    FOREIGN KEY (`subCategoryName`, `categoryName`, `courseID` )
 
87
  PRIMARY KEY (`quizNr`,  `subCategoryName`, `categoryName` , `courseID`) ,
 
88
    FOREIGN KEY (`subCategoryName`, `categoryName`, `courseID`)
88
89
    REFERENCES `lenasys`.`SubCategories` (`subCategoryName`, `categoryName`, `courseID` ))
89
90
ENGINE = InnoDB;
90
91
 
150
151
-- -----------------------------------------------------
151
152
CREATE  TABLE IF NOT EXISTS `lenasys`.`Files` (
152
153
  `fileName` VARCHAR(20) NOT NULL ,
153
 
  `fileType` ENUM(`Text`, `Code`, `Video`, `Picture`) DEFAULT(`text`) , -- text=1, code=2, video=3 picture=4
 
154
  `fileType` ENUM('Text', 'Code', 'Video', 'Picture') DEFAULT 'text' , -- text=1, code=2, video=3 picture=4
154
155
  `codeLanguage` VARCHAR(10) NULL , -- example: javascript, html, m.m.
155
156
  `dataBlob` BLOB NULL , -- This is where the binary file is stored. Searchable. 
156
157
  `updatedAt` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , 
170
171
  `executable` BOOLEAN ,
171
172
  PRIMARY KEY (`columnNr`, `orderNr`, `fileName`,`exampleName`,`subCategoryName`, `categoryName`, `courseID`) ,
172
173
    FOREIGN KEY (`fileName` )
173
 
    REFERENCES `lenasys`.`Files` (`fileName` )
 
174
    REFERENCES `lenasys`.`Files` (`fileName` ),
174
175
        FOREIGN KEY (`exampleName`,`subCategoryName` ,`categoryName` , `courseID` )
175
176
    REFERENCES `lenasys`.`Examples` (`exampleName`,`subCategoryName` ,`categoryName` , `courseID` ))
176
177
ENGINE = InnoDB;
268
269
  PRIMARY KEY (`id`))
269
270
ENGINE = InnoDB;
270
271
-- -------------------------------------------------
271
 
  insert into `lenasys`.`UserTypeCodes` (`userTypeCode`,`userType`) 
272
 
  VALUES (0,'Teacher'),(1,'Student');
273
272
 
274
273
insert into `lenasys`.`Users` (`userName`,`name`,`passwd`,`userType`,`ssn`) 
275
274
  VALUES ('student','Per Student',sha1('Syp9393'),1,'19900385-2345'),