chiark / gitweb /
Store Unix timestamps in the database, rather than SQL ones.
[odin-cgi] / sql / setup-shorturl.sql
index b2ff717325f597287bcd7ea27cab298e837e7cc4..dee90a37b845aa607d40d28f230cbb1f1d4124fb 100644 (file)
@@ -9,17 +9,18 @@
 
 begin;
 
-drop table odin_shorturl;
-drop table odin_shorturl_seq;
+drop table if exists odin_shorturl;
+drop table if exists odin_shorturl_seq;
 
 create table odin_shorturl_seq (seq int);
 insert into odin_shorturl_seq (seq) values (10000);
 
 create table odin_shorturl
        (tag varchar(16) primary key,
-        stamp timestamp not null default current_timestamp,
+        stamp bigint not null,
         owner varchar(64) not null,
         url text not null);
 create index odin_shorturl_by_owner on odin_shorturl (owner);
+create index odin_shorturl_by_url_owner on odin_shorturl (url, owner);
 
 commit;