updated mysql schema

This commit is contained in:
Andrew Dolgov 2005-09-07 13:42:49 +01:00
parent b6eefba52b
commit 4b3dff6ed5
4 changed files with 22 additions and 28 deletions

View file

@ -686,7 +686,7 @@
$filter_id = db_escape_string($_GET["id"]);
$result = db_query($link, "UPDATE ttrss_filters SET
regexp = '$regexp',
reg_exp = '$regexp',
description = '$descr',
filter_type = (SELECT id FROM ttrss_filter_types WHERE
description = '$match')
@ -710,11 +710,11 @@
if (!WEB_DEMO_MODE) {
$regexp = db_escape_string($_GET["regexp"]);
$regexp = db_escape_string($_GET["reg_exp"]);
$match = db_escape_string($_GET["match"]);
$result = db_query($link,
"INSERT INTO ttrss_filters (regexp,filter_type) VALUES
"INSERT INTO ttrss_filters (reg_exp,filter_type) VALUES
('$regexp', (SELECT id FROM ttrss_filter_types WHERE
description = '$match'))");
}
@ -739,13 +739,13 @@
</table>";
$result = db_query($link, "SELECT
id,regexp,description,
id,reg_exp,description,
(SELECT name FROM ttrss_filter_types WHERE
id = filter_type) as filter_type_name,
(SELECT description FROM ttrss_filter_types
WHERE id = filter_type) as filter_type_descr
FROM
ttrss_filters ORDER by regexp");
ttrss_filters ORDER by reg_exp");
print "<p><table width=\"100%\" class=\"prefFilterList\" id=\"prefFilterList\">";
@ -768,7 +768,7 @@
print "<tr class=\"$class\" id=\"FILRR-$filter_id\">";
$line["regexp"] = htmlspecialchars($line["regexp"]);
$line["regexp"] = htmlspecialchars($line["reg_exp"]);
$line["description"] = htmlspecialchars($line["description"]);
if (!$edit_filter_id || $subop != "edit") {
@ -779,7 +779,7 @@
type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>";
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
$line["regexp"] . "</td>";
$line["reg_exp"] . "</td>";
print "<td><a href=\"javascript:editFilter($filter_id);\">" .
$line["description"] . "</td>";
@ -793,7 +793,7 @@
print "<td><input disabled=\"true\" type=\"checkbox\"
id=\"FICHK-".$line["id"]."\"></td>";
print "<td>".$line["regexp"]."</td>";
print "<td>".$line["reg_exp"]."</td>";
print "<td>".$line["description"]."</td>";
print "<td>".$line["filter_type_descr"]."</td>";
@ -801,7 +801,7 @@
print "<td><input disabled=\"true\" type=\"checkbox\"></td>";
print "<td><input id=\"iedit_regexp\" value=\"".$line["regexp"].
print "<td><input id=\"iedit_regexp\" value=\"".$line["reg_exp"].
"\"></td>";
print "<td><input id=\"iedit_descr\" value=\"".$line["description"].
@ -852,5 +852,5 @@
print "</div>";
}
pg_close($link);
db_close($link);
?>

View file

@ -115,14 +115,14 @@
$filters = array();
$result = db_query($link, "SELECT regexp,
$result = db_query($link, "SELECT reg_exp,
(SELECT name FROM ttrss_filter_types
WHERE id = filter_type) as name
FROM ttrss_filters");
while ($line = db_fetch_assoc($result)) {
if (!$filters[$line["name"]]) $filters[$line["name"]] = array();
array_push($filters[$line["name"]], $line["regexp"]);
array_push($filters[$line["name"]], $line["reg_exp"]);
}
foreach ($rss->items as $item) {

View file

@ -56,6 +56,6 @@ insert into ttrss_filter_types (id,name,description) values (3, 'both',
create table ttrss_filters (id serial primary key,
filter_type integer not null references ttrss_filter_types(id),
regexp varchar(250) not null,
reg_exp varchar(250) not null,
description varchar(250) not null default '');

View file

@ -5,9 +5,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
title varchar(200) not null unique,
feed_url varchar(250) unique not null,
icon_url varchar(250) not null default '',
last_updated timestamp default null);
alter table ttrss_feeds ENGINE=InnoDB;
last_updated timestamp default null) TYPE=InnoDB;
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');
insert into ttrss_feeds (title,feed_url) values ('Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml');
@ -30,7 +28,7 @@ insert into ttrss_feeds (title,feed_url) values ('Technocrat.net',
'http://syndication.technocrat.net/rss');
create table ttrss_entries (id integer not null primary key auto_increment,
feed_id int id not null,
feed_id integer not null,
updated timestamp not null,
title varchar(250) not null,
guid varchar(250) not null unique,
@ -38,32 +36,28 @@ create table ttrss_entries (id integer not null primary key auto_increment,
content text not null,
content_hash varchar(250) not null,
last_read timestamp,
marked boolean not null default 'false',
marked bool not null default 'false',
date_entered timestamp not null,
no_orig_date boolean not null default 'false',
no_orig_date bool not null default 'false',
comments varchar(250) not null default '',
unread boolean not null default true);
alter table ttrss_entries ENGINE=InnoDB;
unread bool not null default 'true') TYPE=InnoDB;
drop table if exists ttrss_filters;
drop table if exists ttrss_filter_types;
create table ttrss_filter_types (id integer primary key,
name varchar(120) unique not null,
description varchar(250) not null unique);
description varchar(250) not null unique) TYPE=InnoDB;
alter table ttrss_filter_types ENGINE=InnoDB;
insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
insert into ttrss_filter_types (id,name,description) values (3, 'both',
'Title or Content');
create table ttrss_filters (id serial primary key,
create table ttrss_filters (id integer primary key auto_increment,
filter_type integer not null,
regexp varchar(250) not null,
description varchar(250) not null default '');
reg_exp varchar(250) not null,
description varchar(250) not null default '') TYPE=InnoDB;
alter table ttrss_filters ENGINE=InnoDB;