add ttrss_archived_feeds (MODIFY SCHEMA v60)

This commit is contained in:
Andrew Dolgov 2009-12-28 19:15:15 +03:00
parent dbfc436519
commit 24902606eb
4 changed files with 34 additions and 4 deletions

View File

@ -22,6 +22,7 @@ drop table if exists ttrss_scheduled_updates;
drop table if exists ttrss_counters_cache; drop table if exists ttrss_counters_cache;
drop table if exists ttrss_cat_counters_cache; drop table if exists ttrss_cat_counters_cache;
drop table if exists ttrss_feeds; 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_feed_categories;
drop table if exists ttrss_users; drop table if exists ttrss_users;
drop table if exists ttrss_themes; 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), index(owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB; 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 ( create table ttrss_counters_cache (
feed_id integer not null, feed_id integer not null,
owner_uid integer not null, owner_uid integer not null,
@ -147,7 +156,7 @@ create table ttrss_user_entries (
index (feed_id), index (feed_id),
foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE, foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
index (orig_feed_id), 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), index (owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB; foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;

View File

@ -18,6 +18,7 @@ drop table ttrss_entries;
drop table ttrss_scheduled_updates; drop table ttrss_scheduled_updates;
drop table ttrss_counters_cache; drop table ttrss_counters_cache;
drop table ttrss_cat_counters_cache; drop table ttrss_cat_counters_cache;
drop table ttrss_archived_feeds;
drop table ttrss_feeds; drop table ttrss_feeds;
drop table ttrss_feed_categories; drop table ttrss_feed_categories;
drop table ttrss_users; 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 insert into ttrss_feeds (owner_uid, title, feed_url) values
(1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.spb.ru/forum/rss.php'); (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 ( create table ttrss_counters_cache (
feed_id integer not null, feed_id integer not null,
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, 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, int_id serial not null primary key,
ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE, ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE,
feed_id int references ttrss_feeds(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, owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
marked boolean not null default false, marked boolean not null default false,
published boolean not null default false, published boolean not null default false,

View File

@ -2,10 +2,18 @@ begin;
alter table ttrss_user_entries change feed_id feed_id integer null; 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; alter table ttrss_user_entries add column orig_feed_id integer;
update ttrss_user_entries set orig_feed_id = NULL; 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; update ttrss_version set schema_version = 60;

View File

@ -2,10 +2,16 @@ begin;
alter table ttrss_user_entries alter column feed_id drop not null; 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; alter table ttrss_user_entries add column orig_feed_id integer;
update ttrss_user_entries set orig_feed_id = NULL; 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; update ttrss_version set schema_version = 60;