add necessary schema plumbing to implement filter ordering

also add filter titles
This commit is contained in:
Andrew Dolgov 2013-03-31 16:14:42 +04:00
parent b6173bd561
commit 8e8c8934a9
5 changed files with 38 additions and 4 deletions

View file

@ -1,6 +1,6 @@
<?php
define('EXPECTED_CONFIG_VERSION', 26);
define('SCHEMA_VERSION', 111);
define('SCHEMA_VERSION', 112);
define('LABEL_BASE_INDEX', -1024);
define('PLUGIN_FEED_BASE_INDEX', -128);
@ -3192,7 +3192,7 @@
$cat_id = (int)getFeedCategory($link, $feed_id);
$result = db_query($link, "SELECT * FROM ttrss_filters2 WHERE
owner_uid = $owner_uid AND enabled = true");
owner_uid = $owner_uid AND enabled = true ORDER BY order_id, title");
$check_cats = join(",", array_merge(
getParentCategories($link, $cat_id, $owner_uid),

View file

@ -251,6 +251,8 @@ create table ttrss_filters2(id integer primary key auto_increment,
match_any_rule boolean not null default false,
enabled boolean not null default true,
inverse bool not null default false,
title varchar(250) not null default '',
order_id integer not null default 0,
index(owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
@ -291,7 +293,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 (111);
insert into ttrss_version values (112);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,

View file

@ -223,6 +223,8 @@ create table ttrss_filters2(id serial not null primary key,
owner_uid integer not null references ttrss_users(id) on delete cascade,
match_any_rule boolean not null default false,
inverse boolean not null default false,
title varchar(250) not null default '',
order_id integer not null default 0,
enabled boolean not null default true);
create table ttrss_filters2_rules(id serial not null primary key,
@ -249,7 +251,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id);
create table ttrss_version (schema_version int not null);
insert into ttrss_version values (111);
insert into ttrss_version values (112);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,

View file

@ -0,0 +1,15 @@
begin;
alter table ttrss_filters2 add column order_id integer;
update ttrss_filters2 set order_id = 0;
alter table ttrss_filters2 change order_id order_id integer not null;
alter table ttrss_filters2 alter column order_id set default 0;
alter table ttrss_filters2 add column title varchar(250);
update ttrss_filters2 set title = '';
alter table ttrss_filters2 change title title varchar(250) not null;
alter table ttrss_filters2 alter column title set default '';
update ttrss_version set schema_version = 112;
commit;

View file

@ -0,0 +1,15 @@
begin;
alter table ttrss_filters2 add column order_id integer;
update ttrss_filters2 set order_id = 0;
alter table ttrss_filters2 alter column order_id set not null;
alter table ttrss_filters2 alter column order_id set default 0;
alter table ttrss_filters2 add column title varchar(250);
update ttrss_filters2 set title = '';
alter table ttrss_filters2 alter column title set not null;
alter table ttrss_filters2 alter column title set default '';
update ttrss_version set schema_version = 112;
commit;