3 * Plain old SQL for setting up the tables for Odin web services.
6 /* The various tools assume that the database is appropriate configured with
7 * the SERIALIZABLE isolation level.
12 drop table if exists odin_pastebin
;
13 drop table if exists odin_pastebin_lang
;
14 drop table if exists odin_pastebin_seq
;
16 create table odin_pastebin_lang
17 (lang
varchar(32) primary key,
18 descr
varchar(64) not null);
19 insert into odin_pastebin_lang (lang
, descr
) values ('txt', 'Plain text');
21 create table odin_pastebin_seq (seq
int);
22 insert into odin_pastebin_seq (seq
) values (10000);
24 create table odin_pastebin
25 (tag
varchar(16) primary key,
26 stamp
bigint not null,
27 edithash
varchar(128) not null,
28 owner varchar(64) not null,
29 title
varchar(128) not null,
30 lang
varchar(32) not null
32 references odin_pastebin_lang (lang
)
35 deferrable initially deferred,
36 content text not null);
37 create index odin_pastebin_by_lang
on odin_pastebin (lang
);
38 create index odin_pastebin_by_owner
on odin_pastebin (owner);