create table dbversion ( version int primary key, release timestamptz not null, description text not null ); comment on table dbversion is 'Schema update tracking'; insert into dbversion (version, release, description) values (1, now(), 'Initial version'); create domain obj_hash as bytea; create type cook_status as enum ('new', 'pending', 'done'); comment on type cook_status is 'Status of the cooking'; create table cook_requests ( id bigserial primary key, type text not null, -- requested cooking type object_id obj_hash not null, -- requested object ID task_uuid varchar(128) not null, -- celery UUID of the cooking task status cook_status not null -- status of the cooking task ); create table cook_notifications ( id bigserial primary key, email text not null, -- e-mail to notify request_id bigint not null references cook_requests(id) );