/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-22 12:12:37 UTC
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: b11johgu@student.his.se-20130422121237-9fclzb6iogep5fqb
changed primary key in UserTypeCodes to UserTypeCode
changed datatype on UserTypeCode to TINYINT(1)
added table "Categories"
fixed minor bugg

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
-- Table `lenasys`.`UserTypeCodes`
13
13
-- -----------------------------------------------------
14
14
CREATE  TABLE IF NOT EXISTS `lenasys`.`UserTypeCodes` (
15
 
  `userTypeCode` INT NOT NULL ,
 
15
  `userTypeCode` TINYINT(1) NOT NULL ,
16
16
  `userType` VARCHAR(10) NOT NULL ,
17
 
  PRIMARY KEY (`userType`))
 
17
  PRIMARY KEY (`userTypeCode`))
18
18
ENGINE = InnoDB;
19
19
-- -----------------------------------------------------
20
20
-- Table `lenasys`.`Users`
138
138
ENGINE = InnoDB;
139
139
 
140
140
-- -----------------------------------------------------
 
141
-- Table `lenasys`.`Categories`
 
142
-- -----------------------------------------------------
 
143
 
 
144
CREATE  TABLE IF NOT EXISTS `lenasys`.`Categories` (
 
145
  `categoryName` VARCHAR(64) NOT NULL ,
 
146
  `courseID` VARCHAR(10) NOT NULL ,
 
147
  `orderNumber` INT NULL , -- the order of the examples in the same category 
 
148
  PRIMARY KEY (`categoryName`, `courseID`) ,
 
149
  INDEX `fk_Examples_Courses1_idx` (`courseID` ASC) ,
 
150
  UNIQUE INDEX `categoryName_UNIQUE` (`categoryName` ASC) ,
 
151
  CONSTRAINT `fk_Categories_Courses1`
 
152
    FOREIGN KEY (`courseID` )
 
153
    REFERENCES `lenasys`.`Courses` (`courseID` )
 
154
    ON DELETE NO ACTION
 
155
    ON UPDATE NO ACTION)
 
156
ENGINE = InnoDB;
 
157
 
 
158
-- -----------------------------------------------------
141
159
-- Table `lenasys`.`Examples`
142
160
-- -----------------------------------------------------
143
161
CREATE  TABLE IF NOT EXISTS `lenasys`.`Examples` (
278
296
  `quizNr` INT NOT NULL ,
279
297
  `answers` VARCHAR(45) NULL ,
280
298
  `answerHash` VARCHAR(45) NULL ,
281
 
  `answeredTimeStamp` DATETIME NULL  -- TIMESTAMP ??
 
299
  `answeredTimeStamp` DATETIME NULL , -- TIMESTAMP ??
282
300
  `grade` VARCHAR(8) NULL ,
283
301
  `gradeComment` VARCHAR(200) NULL ,
284
302
  PRIMARY KEY (`id`) ,