1 --- vim: set noet nosta sw=4 ts=4 ft=sql: |
|
2 BEGIN; |
|
3 |
|
4 CREATE TABLE IF NOT EXISTS requests ( |
|
5 scheme VARCHAR(5) DEFAULT NULL, |
|
6 host VARCHAR(255) DEFAULT NULL, |
|
7 tld VARCHAR(255) DEFAULT NULL, |
|
8 path TEXT DEFAULT NULL, |
|
9 port INTEGER DEFAULT NULL, |
|
10 ip VARCHAR(72) DEFAULT NULL, |
|
11 user VARCHAR(40) DEFAULT NULL, |
|
12 method VARCHAR(10) DEFAULT NULL, |
|
13 rewrite_rule INTEGER REFERENCES rewrite_rules( id ) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED |
|
14 ); |
|
15 CREATE INDEX IF NOT EXISTS host_idx ON requests ( host ); |
|
16 CREATE INDEX IF NOT EXISTS tld_idx ON requests ( tld ); |
|
17 CREATE INDEX IF NOT EXISTS path_idx ON requests ( path ); |
|
18 |
|
19 CREATE TABLE IF NOT EXISTS rewrite_rules ( |
|
20 id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, |
|
21 scheme VARCHAR(5) DEFAULT NULL, |
|
22 host VARCHAR(255) DEFAULT NULL, |
|
23 path TEXT DEFAULT NULL, |
|
24 port INTEGER DEFAULT NULL, |
|
25 redir TINYINT NOT NULL DEFAULT 0 CHECK( redir IN (0,1,2) ) |
|
26 ); |
|
27 |
|
28 COMMIT; |
|