From c62d62f65e0ee9feaaa18f0b3eb8860e4400f97c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 19 Nov 2005 11:03:47 +0100 Subject: [PATCH] new schema adapted for mysql, PG schema fixes --- schema/ttrss_schema_mysql.sql | 32 ++++++++++++++++++++------------ schema/ttrss_schema_pgsql.sql | 6 ++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 507c26e7..6851d617 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -1,5 +1,8 @@ drop table if exists ttrss_tags; + +drop table if exists ttrss_user_entries; drop table if exists ttrss_entries; + drop table if exists ttrss_feeds; drop table if exists ttrss_labels; drop table if exists ttrss_filters; @@ -38,20 +41,26 @@ insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net', 'http://syndication.technocrat.net/rss'); create table ttrss_entries (id integer not null primary key auto_increment, - owner_uid integer not null, - feed_id integer not null, - updated datetime not null, title text not null, - guid varchar(255) not null, + guid varchar(255) not null unique, link text not null, + updated datetime not null, content text not null, content_hash varchar(250) not null, - last_read datetime, - marked bool not null default 0, - date_entered datetime not null, no_orig_date bool not null default 0, - comments varchar(250) not null default '', + date_entered datetime not null, + comments varchar(250) not null default '') TYPE=InnoDB; + +create table ttrss_user_entries ( + int_id integer not null primary key auto_increment, + ref_id integer not null, + feed_id int not null, + owner_uid integer not null, + marked bool not null default 0, + last_read datetime, unread bool not null default 1, + index (ref_id), + foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE, index (feed_id), foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE, index (owner_uid), @@ -64,7 +73,6 @@ create table ttrss_filter_types (id integer primary key, name varchar(120) unique not null, description varchar(250) not null unique) TYPE=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', @@ -98,9 +106,9 @@ insert into ttrss_labels (owner_uid,sql_exp,description) values (1, create table ttrss_tags (id integer primary key auto_increment, owner_uid integer not null, tag_name varchar(250) not null, - post_id integer not null, - index (post_id), - foreign key (post_id) references ttrss_entries(id) ON DELETE CASCADE, + post_int_id integer not null, + index (post_int_id), + foreign key (post_int_id) references ttrss_user_entries(int_id) ON DELETE CASCADE, index (owner_uid), foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB; diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index e1d07c42..0abb8130 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -49,8 +49,10 @@ create table ttrss_entries (id serial not null primary key, content_hash varchar(250) not null, no_orig_date boolean not null default false, date_entered timestamp not null default NOW(), - comments varchar(250) not null default '', - index (guid), index(title)); + comments varchar(250) not null default ''); + +create index ttrss_entries_guid_index on ttrss_entries(guid); +create index ttrss_entries_title_index on ttrss_entries(title); create table ttrss_user_entries ( int_id serial not null primary key, -- 2.39.5