App-ProxyHunter-Model-Schema-Pg
view release on metacpan or search on metacpan
lib/App/ProxyHunter/Model/Schema/Pg.pm view on Meta::CPAN
host
port
checked
success_total
fails_total
insertdate
checkdate
speed_checkdate
fails
type
in_progress
conn_time
speed
);
inflate type => \&proxy_name_to_type;
deflate type => \&proxy_type_to_name;
deflate in_progress => \&perl_bool_to_sql;
for (qw/insertdate checkdate speed_checkdate/) {
inflate $_ => \&sql_datetime_to_perl;
deflate $_ => \&perl_datetime_to_sql;
}
};
1;
=pod
=head1 NAME
App::ProxyHunter::Model::Schema::Pg - PostgreSQL schema for App::ProxyHunter
=head1 SYNOPSIS
# just edit proxyhunter's config
db = {
driver: "Pg"
}
=head1 DESCRIPTION
You need to create database yourself, then use C<proxyhunter --create-schema> to create tables structure
=head1 SEE ALSO
L<App::ProxyHunter>
=head1 AUTHOR
Oleg G, E<lt>oleg@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself
=cut
__DATA__
CREATE TYPE proxy_type AS ENUM ('HTTPS_PROXY','HTTP_PROXY','CONNECT_PROXY','SOCKS4_PROXY','SOCKS5_PROXY','DEAD_PROXY');
CREATE TABLE proxy
(
id serial NOT NULL,
host character varying(15) NOT NULL,
port integer NOT NULL,
checked boolean NOT NULL DEFAULT false,
success_total integer NOT NULL DEFAULT 0,
fails_total integer NOT NULL DEFAULT 0,
insertdate timestamp without time zone NOT NULL,
checkdate timestamp without time zone NOT NULL DEFAULT '1980-01-01 00:00:00'::timestamp without time zone,
speed_checkdate timestamp without time zone NOT NULL DEFAULT '1980-01-01 00:00:00'::timestamp without time zone,
fails smallint NOT NULL DEFAULT 0,
type proxy_type NOT NULL DEFAULT 'DEAD_PROXY'::proxy_type,
in_progress boolean NOT NULL DEFAULT false,
conn_time integer DEFAULT NULL,
speed integer NOT NULL DEFAULT 0,
CONSTRAINT proxy_pk PRIMARY KEY (id),
CONSTRAINT proxy_uniq UNIQUE (host, port)
);
CREATE INDEX sort_idx
ON proxy
USING btree
(checked, checkdate);
CREATE INDEX type_idx
ON proxy
USING btree
(type);
( run in 0.408 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )