-- update script 2003-12-12 by rk
--
-- * adds filter and filtergroups to the database
--
-- This script will terminate with an error the second time it's run,
--   so running this script when it isn't needed can't do any harm.
--

BEGIN TRANSACTION;

CREATE SEQUENCE "filter_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;

CREATE TABLE "filter" (
  "id" integer DEFAULT nextval('filter_id_seq'::text) NOT NULL,
  "priority" integer,
  "filter_group_id" integer,
  "type" character varying(255) NOT NULL,
  "expression" character varying(255) NOT NULL,
  "tag" character varying(255) NOT NULL,
	"comment" text,
  "articleaction" character varying(255) NOT NULL,
  "commentaction" character varying(255) NOT NULL,
	"last_hit" timestamp with time zone
);

--
-- filter_group
--

CREATE SEQUENCE "filter_group_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;

CREATE TABLE "filter_group" (
  "id" integer DEFAULT nextval('filter_group_id_seq'::text) NOT NULL,
  "name" character varying(255),
  "priority" integer
);
  
COMMIT TRANSACTION;

