DROP TABLE server;
DROP SEQUENCE next_server_id;
CREATE SEQUENCE next_server_id;

CREATE TABLE "server" (
        "rec_id" int4 DEFAULT nextval('next_server_id') PRIMARY KEY,
        "active"                int             not null        default 0,
        "url"                   varchar(128)    not null        default '',
        "period"                int             not null        default 604800,
        "tag"                   varchar(11)     not null        default '',
        "category"              varchar(11)     not null        default '',
        "charset"               varchar(16)     not null        default '',
        "lang"                  varchar(2)      not null        default '',
        "basic_auth"            varchar(64)     not null        default '',
        "proxy"                 varchar(64)     not null        default '',
        "proxy_port"            int		not null        default 3128,
        "proxy_auth"            varchar(64)     not null        default '',

        "maxhops"               int             not null        default 9999,
        "gindex"                int             not null        default 1,
        "follow"                int             not null        default 1,
        "deletebad"             int             not null        default 0,
        "use_robots"            int             not null        default 1,
        "delete_no_srv"         int             not null        default 1,
        "use_clones"            int             not null        default 1,

        "descweight"            int             not null        default 2,
        "keywordweight"         int             not null        default 2,
        "titleweight"           int             not null        default 2,
        "bodyweight"            int             not null        default 1,
        "urlweight"             int             not null        default 0,
        "urlhostweight"         int             not null        default 0,
        "urlpathweight"         int             not null        default 0,
        "urlfileweight"         int             not null        default 0,
        "correct_factor"        int             not null        default 1,
        "incorrect_factor"      int             not null        default 1,
        "number_factor"         int             not null        default 1,
        "alnum_factor"          int             not null        default 1,

        "max_net_errors"        int             not null        default 16,
        "net_delay_time"        int             not null        default 86400,
        "read_timeout"          int             not null        default 90

);

CREATE UNIQUE INDEX srv_url ON server (url);
