From 24902606eb47debce37ff1ee68b0a668d224d966 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 28 Dec 2009 19:15:15 +0300 Subject: [PATCH] add ttrss_archived_feeds (MODIFY SCHEMA v60) --- schema/ttrss_schema_mysql.sql | 11 ++++++++++- schema/ttrss_schema_pgsql.sql | 9 ++++++++- schema/versions/mysql/60.sql | 10 +++++++++- schema/versions/pgsql/60.sql | 8 +++++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index c6de6028..68611c94 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -22,6 +22,7 @@ drop table if exists ttrss_scheduled_updates; drop table if exists ttrss_counters_cache; drop table if exists ttrss_cat_counters_cache; drop table if exists ttrss_feeds; +drop table if exists ttrss_archived_feeds; drop table if exists ttrss_feed_categories; drop table if exists ttrss_users; drop table if exists ttrss_themes; @@ -62,6 +63,14 @@ create table ttrss_feed_categories(id integer not null primary key auto_incremen index(owner_uid), foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB; +create table ttrss_archived_feeds (id integer not null primary key, + owner_uid integer not null, + title varchar(200) not null, + feed_url text not null, + site_url varchar(250) not null default '', + index(owner_uid), + foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB; + create table ttrss_counters_cache ( feed_id integer not null, owner_uid integer not null, @@ -147,7 +156,7 @@ create table ttrss_user_entries ( index (feed_id), foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE, index (orig_feed_id), - foreign key (orig_feed_id) references ttrss_feeds(id) ON DELETE SET NULL, + foreign key (orig_feed_id) references ttrss_archived_feeds(id) ON DELETE SET NULL, 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 7afebb5d..f2b0e808 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -18,6 +18,7 @@ drop table ttrss_entries; drop table ttrss_scheduled_updates; drop table ttrss_counters_cache; drop table ttrss_cat_counters_cache; +drop table ttrss_archived_feeds; drop table ttrss_feeds; drop table ttrss_feed_categories; drop table ttrss_users; @@ -89,6 +90,12 @@ insert into ttrss_feeds (owner_uid, title, feed_url) values insert into ttrss_feeds (owner_uid, title, feed_url) values (1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.spb.ru/forum/rss.php'); +create table ttrss_archived_feeds (id integer not null primary key, + owner_uid integer not null references ttrss_users(id) on delete cascade, + title varchar(200) not null, + feed_url text not null, + site_url varchar(250) not null default ''); + create table ttrss_counters_cache ( feed_id integer not null, owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, @@ -122,7 +129,7 @@ create table ttrss_user_entries ( int_id serial not null primary key, ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE, feed_id int references ttrss_feeds(id) ON DELETE CASCADE, - orig_feed_id int references ttrss_feeds(id) ON DELETE SET NULL, + orig_feed_id integer references ttrss_archived_feeds(id) ON DELETE SET NULL, owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, marked boolean not null default false, published boolean not null default false, diff --git a/schema/versions/mysql/60.sql b/schema/versions/mysql/60.sql index a2c02335..40d2988a 100644 --- a/schema/versions/mysql/60.sql +++ b/schema/versions/mysql/60.sql @@ -2,10 +2,18 @@ begin; alter table ttrss_user_entries change feed_id feed_id integer null; +create table ttrss_archived_feeds (id integer not null primary key, + owner_uid integer not null, + title varchar(200) not null, + feed_url text not null, + site_url varchar(250) not null default '', + index(owner_uid), + foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB; + alter table ttrss_user_entries add column orig_feed_id integer; update ttrss_user_entries set orig_feed_id = NULL; -alter table ttrss_user_entries add constraint FOREIGN KEY (orig_feed_id) REFERENCES ttrss_feeds(id) ON DELETE SET NULL; +alter table ttrss_user_entries add constraint FOREIGN KEY (orig_feed_id) REFERENCES ttrss_archived_feeds(id) ON DELETE SET NULL; update ttrss_version set schema_version = 60; diff --git a/schema/versions/pgsql/60.sql b/schema/versions/pgsql/60.sql index 39a2e202..bcf2fdef 100644 --- a/schema/versions/pgsql/60.sql +++ b/schema/versions/pgsql/60.sql @@ -2,10 +2,16 @@ begin; alter table ttrss_user_entries alter column feed_id drop not null; +create table ttrss_archived_feeds (id integer not null primary key, + owner_uid integer not null references ttrss_users(id) on delete cascade, + title varchar(200) not null, + feed_url text not null, + site_url varchar(250) not null default ''); + alter table ttrss_user_entries add column orig_feed_id integer; update ttrss_user_entries set orig_feed_id = NULL; -alter table ttrss_user_entries add constraint "$4" FOREIGN KEY (orig_feed_id) REFERENCES ttrss_feeds(id) ON DELETE SET NULL; +alter table ttrss_user_entries add constraint "$4" FOREIGN KEY (orig_feed_id) REFERENCES ttrss_archived_feeds(id) ON DELETE SET NULL; update ttrss_version set schema_version = 60;