Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 DROP TABLE IF EXISTS crawler_sites; | 1 DROP TABLE IF EXISTS crawler_sites; |
2 DROP TABLE IF EXISTS crawler_runs; | 2 DROP TABLE IF EXISTS crawler_runs; |
3 DROP TABLE IF EXISTS crawler_data; | 3 DROP TABLE IF EXISTS crawler_data; |
4 | 4 |
5 CREATE TABLE crawler_sites ( | 5 CREATE TABLE crawler_sites ( |
6 id INT NOT NULL AUTO_INCREMENT, | 6 id INT NOT NULL AUTO_INCREMENT, |
7 PRIMARY KEY (id), | 7 PRIMARY KEY (id), |
8 url VARCHAR(512) NOT NULL | 8 url VARCHAR(512) NOT NULL, |
Wladimir Palant
2012/09/14 17:24:18
How about UNIQUE(url) constraint? This will make s
Felix Dahlke
2012/09/26 15:20:30
Done.
| |
9 UNIQUE (url) | |
9 ); | 10 ); |
10 | 11 |
11 CREATE TABLE crawler_runs ( | 12 CREATE TABLE crawler_runs ( |
12 id INT NOT NULL AUTO_INCREMENT, | 13 id INT NOT NULL AUTO_INCREMENT, |
13 PRIMARY KEY (id), | 14 PRIMARY KEY (id), |
14 timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP | 15 timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
15 ); | 16 ); |
16 | 17 |
17 CREATE TABLE crawler_data ( | 18 CREATE TABLE crawler_data ( |
18 id INT NOT NULL AUTO_INCREMENT, | 19 id INT NOT NULL AUTO_INCREMENT, |
19 PRIMARY KEY (id), | 20 PRIMARY KEY (id), |
20 run INT NOT NULL, | 21 run INT NOT NULL, |
21 FOREIGN KEY (run) REFERENCES crawler_runs (id), | 22 FOREIGN KEY (run) REFERENCES crawler_runs (id), |
22 site INT NOT NULL, | 23 site INT NOT NULL, |
23 FOREIGN KEY (site) REFERENCES crawler_sites (id), | 24 FOREIGN KEY (site) REFERENCES crawler_sites (id), |
24 url VARCHAR(512) NOT NULL, | 25 url VARCHAR(512) NOT NULL, |
25 filtered BOOLEAN NOT NULL | 26 filtered BOOLEAN NOT NULL |
26 ); | 27 ); |
LEFT | RIGHT |