chiark / gitweb /
Store Unix timestamps in the database, rather than SQL ones.
[odin-cgi] / sql / setup-shorturl.sql
CommitLineData
be24e9af
MW
1/* -*-sql-*-
2 *
3 * Plain old SQL for setting up the tables for Odin web services.
4 */
5
6/* The various tools assume that the database is appropriate configured with
7 * the SERIALIZABLE isolation level.
8 */
9
10begin;
11
697afe0d
MW
12drop table if exists odin_shorturl;
13drop table if exists odin_shorturl_seq;
be24e9af
MW
14
15create table odin_shorturl_seq (seq int);
16insert into odin_shorturl_seq (seq) values (10000);
17
18create table odin_shorturl
19 (tag varchar(16) primary key,
3300e9a2 20 stamp bigint not null,
be24e9af
MW
21 owner varchar(64) not null,
22 url text not null);
23create index odin_shorturl_by_owner on odin_shorturl (owner);
bdae614e 24create index odin_shorturl_by_url_owner on odin_shorturl (url, owner);
be24e9af
MW
25
26commit;