From 6aff7845751e1671f436da6686209b414fdcfcc4 Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <fox@fakecake.org>
Date: Thu, 30 Aug 2012 18:50:56 +0400
Subject: implement multiple rule/action filters

---
 schema/ttrss_schema_mysql.sql | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

(limited to 'schema/ttrss_schema_mysql.sql')

diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql
index e5109de27..9a160f2aa 100644
--- a/schema/ttrss_schema_mysql.sql
+++ b/schema/ttrss_schema_mysql.sql
@@ -9,6 +9,9 @@ drop table if exists ttrss_labels2;
 drop table if exists ttrss_feedbrowser_cache;
 drop table if exists ttrss_version;
 drop table if exists ttrss_labels;
+drop table if exists ttrss_filters2_actions;
+drop table if exists ttrss_filters2_rules;
+drop table if exists ttrss_filters2;
 drop table if exists ttrss_filters;
 drop table if exists ttrss_filter_types;
 drop table if exists ttrss_filter_actions;
@@ -259,6 +262,38 @@ create table ttrss_filters (id integer not null primary key auto_increment,
 	index (action_id),
 	foreign key (action_id) references ttrss_filter_actions(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
 
+create table ttrss_filters2(id integer primary key auto_increment,
+	owner_uid integer not null,
+	match_any_rule boolean not null default false,
+	enabled boolean not null default true,
+	index(owner_uid),
+	foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
+	
+create table ttrss_filters2_rules(id integer primary key auto_increment,
+	filter_id integer not null references ttrss_filters2(id) on delete cascade,
+	reg_exp varchar(250) not null,
+	filter_type integer not null,
+	feed_id integer default null,
+	cat_id integer default null,
+	cat_filter boolean not null default false,
+	index (filter_id),
+	foreign key (filter_id) references ttrss_filters2(id) on delete cascade,
+	index (filter_type),
+	foreign key (filter_type) references ttrss_filter_types(id) ON DELETE CASCADE,
+	index (feed_id),
+	foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
+	index (cat_id),
+	foreign key (cat_id) references ttrss_feed_categories(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
+
+create table ttrss_filters2_actions(id integer primary key auto_increment,
+	filter_id integer not null,
+	action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
+	action_param varchar(250) not null default '',
+	index (filter_id),
+	foreign key (filter_id) references ttrss_filters2(id) on delete cascade,
+	index (action_id),
+	foreign key (action_id) references ttrss_filter_actions(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
+
 create table ttrss_tags (id integer primary key auto_increment,
 	owner_uid integer not null,
 	tag_name varchar(250) not null,
@@ -270,7 +305,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
 
-insert into ttrss_version values (95);
+insert into ttrss_version values (96);
 
 create table ttrss_enclosures (id integer primary key auto_increment,
 	content_url text not null,
-- 
cgit v1.2.3

