initial schema work on linked instances and shared feedbrowser

This commit is contained in:
Andrew Dolgov 2011-04-20 11:40:41 +04:00
parent 1ca77e0acd
commit 58fa1bbc00
5 changed files with 148 additions and 92 deletions

View file

@ -2,7 +2,7 @@
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 22);
define('SCHEMA_VERSION', 83);
define('SCHEMA_VERSION', 84);
if (!file_exists("config.php")) {
print "<b>Fatal Error</b>: You forgot to copy

View file

@ -1,6 +1,8 @@
SET NAMES utf8;
SET CHARACTER SET utf8;
drop table if exists ttrss_linked_feeds;
drop table if exists ttrss_linked_instances;
drop table if exists ttrss_access_keys;
drop table if exists ttrss_user_labels2;
drop table if exists ttrss_labels2;
@ -252,7 +254,7 @@ create table ttrss_tags (id integer primary key auto_increment,
create table ttrss_version (schema_version int not null) TYPE=InnoDB DEFAULT CHARSET=UTF8;
insert into ttrss_version values (83);
insert into ttrss_version values (84);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
@ -394,13 +396,6 @@ create table ttrss_user_prefs (
index (pref_name),
foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) TYPE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_scheduled_updates (id integer not null primary key auto_increment,
owner_uid integer not null,
feed_id integer default null,
entered datetime not null,
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE) TYPE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_sessions (id varchar(250) unique not null primary key,
data text,
expire integer not null,
@ -426,11 +421,24 @@ create table ttrss_user_labels2 (label_id integer not null,
foreign key (article_id) references ttrss_entries(id) ON DELETE CASCADE
) TYPE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_access_keys (id serial not null primary key,
create table ttrss_access_keys (id integer not null primary key auto_increment,
access_key varchar(250) not null,
feed_id varchar(250) not null,
is_cat bool not null default false,
owner_uid integer not null,
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_linked_instances (id integer not null primary key auto_increment,
access_key varchar(250) not null,
access_url text not null) TYPE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_linked_feeds (
feed_url text not null,
title text not null,
created datetime not null,
updated datetime not null,
instance_id integer not null,
subscribers integer not null,
foreign key (instance_id) references ttrss_linked_instances(id) ON DELETE CASCADE) TYPE=InnoDB DEFAULT CHARSET=UTF8;
commit;

View file

@ -1,3 +1,5 @@
drop table ttrss_linked_feeds;
drop table ttrss_linked_instances;
drop table ttrss_access_keys;
drop table ttrss_user_labels2;
drop table ttrss_labels2;
@ -223,7 +225,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 (83);
insert into ttrss_version values (84);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
@ -355,11 +357,6 @@ create table ttrss_user_prefs (
create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid);
-- create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
create table ttrss_scheduled_updates (id serial not null primary key,
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
feed_id integer default null references ttrss_feeds(id) ON DELETE CASCADE,
entered timestamp not null default NOW());
create table ttrss_sessions (id varchar(250) unique not null primary key,
data text,
expire integer not null);
@ -391,4 +388,16 @@ create table ttrss_access_keys (id serial not null primary key,
is_cat boolean not null default false,
owner_uid integer not null references ttrss_users(id) on delete cascade);
create table ttrss_linked_instances (id serial not null primary key,
access_key varchar(250) not null,
access_url text not null);
create table ttrss_linked_feeds (
feed_url text not null,
title text not null,
created timestamp not null,
updated timestamp not null,
instance_id integer not null references ttrss_linked_instances(id) ON DELETE CASCADE,
subscribers integer not null);
commit;

View file

@ -0,0 +1,20 @@
begin;
create table ttrss_linked_instances (id integer not null primary key auto_increment,
access_key varchar(250) not null,
access_url text not null) TYPE=InnoDB DEFAULT CHARSET=UTF8;
create table ttrss_linked_feeds (
feed_url text not null,
title text not null,
created datetime not null,
updated datetime not null,
instance_id integer not null,
subscribers integer not null,
foreign key (instance_id) references ttrss_linked_instances(id) ON DELETE CASCADE) TYPE=InnoDB DEFAULT CHARSET=UTF8;
drop table ttrss_scheduled_updates;
update ttrss_version set schema_version = 84;
commit;

View file

@ -0,0 +1,19 @@
begin;
create table ttrss_linked_instances (id serial not null primary key,
access_key varchar(250) not null,
access_url text not null);
create table ttrss_linked_feeds (
feed_url text not null,
title text not null,
created timestamp not null,
updated timestamp not null,
instance_id integer not null references ttrss_linked_instances(id) ON DELETE CASCADE,
subscribers integer not null);
drop table ttrss_scheduled_updates;
update ttrss_version set schema_version = 84;
commit;