]> ruin.nu Git - ndwebbie.git/blob - database/scan_requests.sql
32e1b8b8736a473b8ebcadd331479aa8b2bf19a5
[ndwebbie.git] / database / scan_requests.sql
1 CREATE TABLE scan_requests (
2         id      SERIAL PRIMARY KEY,
3         uid     INTEGER NOT NULL REFERENCES users(uid),
4         planet  INTEGER NOT NULL REFERENCES planets(id),
5         type    TEXT NOT NULL,
6         nick    TEXT NOT NULL,
7         tick    INTEGER NOT NULL DEFAULT tick(),
8         time    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
9         sent    BOOL NOT NULL DEFAULT FALSE,
10         UNIQUE (tick,planet,type,uid)
11 );
12
13 CREATE INDEX scan_requests_time_not_sent_index ON scan_requests(time) WHERE NOT sent;
14