schema: add filter actions, fix typo in PG schema

This commit is contained in:
Andrew Dolgov 2005-11-29 19:30:08 +01:00
parent f8e80be444
commit 53d6935b34
2 changed files with 29 additions and 3 deletions

View file

@ -2,6 +2,7 @@ drop table if exists ttrss_version;
drop table if exists ttrss_labels; drop table if exists ttrss_labels;
drop table if exists ttrss_filters; drop table if exists ttrss_filters;
drop table if exists ttrss_filter_types; drop table if exists ttrss_filter_types;
drop table if exists ttrss_filter_actions;
drop table if exists ttrss_user_prefs; drop table if exists ttrss_user_prefs;
drop table if exists ttrss_prefs; drop table if exists ttrss_prefs;
drop table if exists ttrss_prefs_types; drop table if exists ttrss_prefs_types;
@ -108,18 +109,31 @@ insert into ttrss_filter_types (id,name,description) values (3, 'both',
insert into ttrss_filter_types (id,name,description) values (4, 'link', insert into ttrss_filter_types (id,name,description) values (4, 'link',
'Link'); 'Link');
create table ttrss_filter_actions (id integer not null primary key,
name varchar(120) unique not null,
description varchar(250) not null unique) TYPE=InnoDB;
insert into ttrss_filter_actions (id,name,description) values (1, 'filter',
'Filter article');
insert into ttrss_filter_actions (id,name,description) values (2, 'catchup',
'Mark as read');
create table ttrss_filters (id integer not null primary key auto_increment, create table ttrss_filters (id integer not null primary key auto_increment,
owner_uid integer not null, owner_uid integer not null,
feed_id integer default null, feed_id integer default null,
filter_type integer not null, filter_type integer not null,
reg_exp varchar(250) not null, reg_exp varchar(250) not null,
description varchar(250) not null default '', description varchar(250) not null default '',
action_id integer not null default 1,
index (filter_type), index (filter_type),
foreign key (filter_type) references ttrss_filter_types(id) ON DELETE CASCADE, foreign key (filter_type) references ttrss_filter_types(id) ON DELETE CASCADE,
index (owner_uid), index (owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
index (feed_id), index (feed_id),
foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE) TYPE=InnoDB; foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
index (action_id),
foreign key (action_id) references ttrss_filter_actions(id) ON DELETE CASCADE) TYPE=InnoDB;
create table ttrss_labels (id integer not null primary key auto_increment, create table ttrss_labels (id integer not null primary key auto_increment,
owner_uid integer not null, owner_uid integer not null,

View file

@ -2,6 +2,7 @@ drop table ttrss_version;
drop table ttrss_labels; drop table ttrss_labels;
drop table ttrss_filters; drop table ttrss_filters;
drop table ttrss_filter_types; drop table ttrss_filter_types;
drop table ttrss_filter_actions;
drop table ttrss_user_prefs; drop table ttrss_user_prefs;
drop table ttrss_prefs; drop table ttrss_prefs;
drop table ttrss_prefs_types; drop table ttrss_prefs_types;
@ -23,7 +24,7 @@ create table ttrss_users (id serial not null primary key,
login varchar(120) not null unique, login varchar(120) not null unique,
pwd_hash varchar(250) not null, pwd_hash varchar(250) not null,
last_login timestamp default null, last_login timestamp default null,
access_level integer not null default 0 access_level integer not null default 0,
theme_id integer references ttrss_themes(id) default null); theme_id integer references ttrss_themes(id) default null);
insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10); insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10);
@ -102,12 +103,23 @@ insert into ttrss_filter_types (id,name,description) values (3, 'both',
insert into ttrss_filter_types (id,name,description) values (4, 'link', insert into ttrss_filter_types (id,name,description) values (4, 'link',
'Link'); 'Link');
create table ttrss_filter_actions (id integer not null primary key,
name varchar(120) unique not null,
description varchar(250) not null unique);
insert into ttrss_filter_actions (id,name,description) values (1, 'filter',
'Filter article');
insert into ttrss_filter_actions (id,name,description) values (2, 'catchup',
'Mark as read');
create table ttrss_filters (id serial not null primary key, create table ttrss_filters (id serial not null primary key,
owner_uid integer not null references ttrss_users(id) on delete cascade, owner_uid integer not null references ttrss_users(id) on delete cascade,
feed_id integer references ttrss_feeds(id) on delete cascade default null, feed_id integer references ttrss_feeds(id) on delete cascade default null,
filter_type integer not null references ttrss_filter_types(id), filter_type integer not null references ttrss_filter_types(id),
reg_exp varchar(250) not null, reg_exp varchar(250) not null,
description varchar(250) not null default ''); description varchar(250) not null default '',
action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade);
create table ttrss_labels (id serial not null primary key, create table ttrss_labels (id serial not null primary key,
owner_uid integer not null references ttrss_users(id) on delete cascade, owner_uid integer not null references ttrss_users(id) on delete cascade,