CREATE TABLE misc (
    "key" character varying(30),
    value character varying(255)
);

-- Live examples have been observed for URIs over 70 characters
CREATE TABLE urilist (
    uri character varying NOT NULL,
    list integer DEFAULT 2,
    count integer DEFAULT 1,
    added timestamp with time zone DEFAULT now(),
    comment character varying DEFAULT ''::character varying NOT NULL
);

ALTER TABLE ONLY urilist
    ADD CONSTRAINT urilist_pkey PRIMARY KEY (uri);

CREATE TABLE waslisted (
    uri character varying NOT NULL,
    list integer DEFAULT 2,
    count integer DEFAULT 1,
    origadded timestamp with time zone DEFAULT now() NOT NULL,
    comment character varying DEFAULT ''::character varying NOT NULL,
    delisted timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY waslisted
    ADD CONSTRAINT waslisted_pkey PRIMARY KEY (uri, origadded);
