-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
71 lines (60 loc) · 2.44 KB
/
db.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
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema informationretrieval
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `informationretrieval` DEFAULT CHARACTER SET utf8 ;
USE `informationretrieval` ;
-- -----------------------------------------------------
-- Table `informationretrieval`.`files`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `informationretrieval`.`files` ;
CREATE TABLE IF NOT EXISTS `informationretrieval`.`files` (
`fileId` INT(11) NOT NULL AUTO_INCREMENT,
`fileName` MEDIUMTEXT NOT NULL,
PRIMARY KEY (`fileId`))
ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `informationretrieval`.`words`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `informationretrieval`.`words` ;
CREATE TABLE IF NOT EXISTS `informationretrieval`.`words` (
`wordId` INT(11) NOT NULL AUTO_INCREMENT,
`word` VARCHAR(45) NOT NULL,
`inverseDocFreq` DOUBLE NOT NULL DEFAULT '1',
PRIMARY KEY (`wordId`))
ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `informationretrieval`.`wordsfiles`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `informationretrieval`.`wordsfiles` ;
CREATE TABLE IF NOT EXISTS `informationretrieval`.`wordsfiles` (
`wordId` INT(11) NOT NULL,
`fileId` INT(11) NOT NULL,
`termFreq` DOUBLE NOT NULL DEFAULT '1',
`score` DOUBLE NOT NULL DEFAULT '1',
INDEX `wf wordId_idx` (`wordId` ASC),
INDEX `wf fileId_idx` (`fileId` ASC),
CONSTRAINT `wf fileId`
FOREIGN KEY (`fileId`)
REFERENCES `informationretrieval`.`files` (`fileId`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `wf wordId`
FOREIGN KEY (`wordId`)
REFERENCES `informationretrieval`.`words` (`wordId`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;