/* -*-sql-*-
 *
 * Plain old SQL for setting up the tables for Odin web services.
 */

/* The various tools assume that the database is appropriate configured with
 * the SERIALIZABLE isolation level.
 */

begin;

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,
	 owner varchar(64) not null,
	 url text not null);
create index odin_shorturl_by_owner on odin_shorturl (owner);

commit;
