]> ruin.nu Git - ndwebbie.git/commitdiff
Scan request infrastructure
authorMichael Andreen <harv@ruin.nu>
Fri, 26 Sep 2008 09:56:54 +0000 (11:56 +0200)
committerMichael Andreen <harv@ruin.nu>
Fri, 26 Sep 2008 09:56:54 +0000 (11:56 +0200)
database/scan_requests.sql [new file with mode: 0644]

diff --git a/database/scan_requests.sql b/database/scan_requests.sql
new file mode 100644 (file)
index 0000000..32e1b8b
--- /dev/null
@@ -0,0 +1,14 @@
+CREATE TABLE scan_requests (
+       id      SERIAL PRIMARY KEY,
+       uid     INTEGER NOT NULL REFERENCES users(uid),
+       planet  INTEGER NOT NULL REFERENCES planets(id),
+       type    TEXT NOT NULL,
+       nick    TEXT NOT NULL,
+       tick    INTEGER NOT NULL DEFAULT tick(),
+       time    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+       sent    BOOL NOT NULL DEFAULT FALSE,
+       UNIQUE (tick,planet,type,uid)
+);
+
+CREATE INDEX scan_requests_time_not_sent_index ON scan_requests(time) WHERE NOT sent;
+