drop table if exists ip_restricts;
create table ip_restricts(
	ip_restrict_id serial,
	ipaddress varchar(16),
	faults integer default 1,
	expires_tstamp timestamp without time zone,
	constraint ip_restricts_ip_restrict_id_pkey primary key( ip_restrict_id )
);

comment on table ip_restricts is 'storage of ip restrictions';
comment on column ip_restricts.ip_restrict_id is 'unique id of table';
comment on column ip_restricts.ipaddress is 'ipaddress of restrict';
comment on column ip_restricts.faults is 'faults of the restrict';
comment on column ip_restricts.expires_tstamp is 'expiration of restriction';

create index ip_restricts_ipaddress_ind on ip_restricts( ipaddress );
comment on index ip_restricts_ipaddress_ind is 'index on ipaddress';

create index ip_restricts_faults_ind on ip_restricts( faults );
comment on index ip_restricts_faults_ind is 'index on faults';

create index ip_restricts_expires_tstamp_ind on ip_restricts( expires_tstamp );
comment on index ip_restricts_expires_tstamp_ind is 'index on expires_tstamp';
