BEGIN;

ALTER TABLE url ADD header_date datetime;
ALTER TABLE url ALTER header_date SET DEFAULT 'now'::text;

ALTER TABLE url ADD header_subj text NOT NULL;
ALTER TABLE url ALTER header_subj SET DEFAULT '';

ALTER TABLE url ADD header_from text NOT NULL;
ALTER TABLE url ALTER header_from SET DEFAULT '';

ALTER TABLE url ADD header_group text NOT NULL;
ALTER TABLE url ALTER header_group SET DEFAULT '';

ALTER TABLE url ADD header_refs text NOT NULL;
ALTER TABLE url ALTER header_refs SET DEFAULT '';

ALTER TABLE url ADD msg_id text NOT NULL;
ALTER TABLE url ALTER msg_id SET DEFAULT '';

CREATE INDEX "url_msg_id" ON "url" USING BTREE ("msg_id");

CREATE TABLE "thread" (
	parent	int4 DEFAULT '0' NOT NULL,
	child	int4 DEFAULT '0' NOT NULL
);

CREATE INDEX "thread_parent" ON "thread" USING BTREE ("parent");
CREATE INDEX "thread_child" ON "thread" USING BTREE ("child");

COMMIT;

