-- session storage
drop table if exists sessions;
create table sessions(
	session_id char(26) not null,
	session_data text,
	session_expires integer,
	user_id integer,
	constraint sessions_session_id_pkey primary key( session_id )
);

comment on table sessions is 'storage of sessions';
comment on column sessions.session_id is 'unique id of table';
comment on column sessions.session_data is 'serialized data of the session';
comment on column sessions.session_expires is 'unix timestamp of session_expiration';
comment on column sessions.user_id is 'reference id to users table';

comment on constraint sessions_session_id_pkey on sessions is 'unique constraint of table';

create index sessions_session_expires_ind on sessions( session_expires );
comment on index sessions_session_expires_ind is 'expires index of sessions';
