create table voting
(
	id integer not null primary key default nextval('public.documents_id_seq'::text),
	class text not null,
	ctime timestamp not null default now(),
	mtime timestamp not null default now(),
	dtime timestamp not null default now(),
	uid integer not null,
        vote_type varchar(32),
        object_class text not null,
        object_id integer not null,
        status smallint not null default 0,
        sections integer[],
        name text,
        vote integer not null,
        data text
);
create index voting_sections on voting using gist ( "sections" "gist__int_ops" );
create index voting_object on voting (object_class, object_id);
create unique index voting_vote on voting (uid, object_class, object_id, vote_type);
