]> git.wh0rd.org - tt-rss.git/blobdiff - schema/ttrss_schema_pgsql.sql
implement settings profiles (bump schema)
[tt-rss.git] / schema / ttrss_schema_pgsql.sql
index 4ea93f97a53347d6e0416c7af3004e4e50da1938..fb2ac18222fb7c10a8da73460dcd41f711741e37 100644 (file)
@@ -1,3 +1,5 @@
+drop table ttrss_user_labels2;
+drop table ttrss_labels2;
 drop table ttrss_feedbrowser_cache;
 drop table ttrss_version;
 drop table ttrss_labels;
@@ -10,11 +12,14 @@ drop table ttrss_prefs_types;
 drop table ttrss_prefs_sections; 
 drop table ttrss_tags;
 drop table ttrss_enclosures;
+drop table ttrss_settings_profiles;
 drop table ttrss_entry_comments;
 drop table ttrss_user_entries;
 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;
@@ -75,6 +80,7 @@ create table ttrss_feeds (id serial not null primary key,
        last_viewed timestamp default null,
        last_update_started timestamp default null,
        update_method integer not null default 0,
+       always_display_enclosures boolean not null default false,
        auth_pass_encrypted boolean not null default false);    
 
 create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid);
@@ -85,8 +91,20 @@ 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 references ttrss_feeds(id) ON DELETE CASCADE,
+       feed_id integer not null,
+       owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
+       updated timestamp not null,
+       value integer not null default 0);
+
+create table ttrss_cat_counters_cache (
+       feed_id integer not null,
        owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
        updated timestamp not null,
        value integer not null default 0);
@@ -111,12 +129,14 @@ create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
 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 not null, 
+       feed_id int references ttrss_feeds(id) ON DELETE CASCADE, 
+       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,
        last_read timestamp,
        score int not null default 0,
+       note text,
        unread boolean not null default true);
 
 -- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
@@ -168,6 +188,9 @@ insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
 insert into ttrss_filter_actions (id,name,description) values (6, 'score', 
        'Modify score');
 
+insert into ttrss_filter_actions (id,name,description) values (7, 'label', 
+       'Assign label');
+
 create table ttrss_filters (id serial not null primary key,    
        owner_uid integer not null references ttrss_users(id) on delete cascade,
        feed_id integer references ttrss_feeds(id) on delete cascade default null,
@@ -179,19 +202,6 @@ create table ttrss_filters (id serial not null primary key,
        action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
        action_param varchar(250) not null default '');
 
-create table ttrss_labels (id serial not null primary key, 
-       owner_uid integer not null references ttrss_users(id) on delete cascade,
-       sql_exp text not null,
-       description varchar(250) not null);
-
-create index ttrss_labels_owner_uid_index on ttrss_labels(owner_uid);
-
-insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true', 
-       'Unread articles');
-
-insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
-       'last_read is null and unread = false', 'Updated articles');
-
 create table ttrss_tags (id serial not null primary key, 
        tag_name varchar(250) not null,
        owner_uid integer not null references ttrss_users(id) on delete cascade,
@@ -201,7 +211,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
 
 create table ttrss_version (schema_version int not null);
 
-insert into ttrss_version values (49);
+insert into ttrss_version values (63);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
@@ -210,6 +220,10 @@ create table ttrss_enclosures (id serial not null primary key,
        duration text not null,
        post_id integer references ttrss_entries(id) ON DELETE cascade NOT NULL);
 
+create table ttrss_settings_profiles(id serial not null primary key,
+       title varchar(250) not null,
+       owner_uid integer not null references ttrss_users(id) on delete cascade);
+
 create table ttrss_prefs_types (id integer not null primary key, 
        type_name varchar(100) not null);
 
@@ -239,8 +253,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
        'Experimental support for virtual feeds based on user crafted SQL queries. This feature is highly experimental and at this point not user friendly. Use with caution.');
        
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 'Default interval between feed updates (in minutes)',1);
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', 'Default article limit',2,
-       'Default limit for articles to display, any custom number you like (0 - disables).');
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 'Amount of articles to display at once',2);
 
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ALLOW_DUPLICATE_POSTS', 1, 'true', 'Allow duplicate posts',1,
        'This option is useful when you are reading several planet-type aggregators with partially colliding userbase. When disabled, it forces same posts from different feeds to appear only once.');
@@ -326,9 +340,32 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
 
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
 
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_OFFLINE_READING', 1, 'false', 'Enable offline reading',1, 'Synchronize new articles for offline reading using Google Gears.');
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_API_ACCESS', 1, 'false', 'Enable external API', 3);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_LABELS', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_UNCAT', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_ENABLE_CATS', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_SHOW_IMAGES', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_HIDE_READ', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_SORT_FEEDS_UNREAD', 1, 'false', '', 1);
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_THEME_ID', 3, '0', '', 1);
+
 create table ttrss_user_prefs (
        owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
        pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
+       profile integer references ttrss_settings_profiles(id) ON DELETE CASCADE,
        value text not null);
 
 create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid);
@@ -349,6 +386,19 @@ create function SUBSTRING_FOR_DATE(timestamp, int, int) RETURNS text AS 'SELECT
 
 create table ttrss_feedbrowser_cache (
        feed_url text not null primary key,
+       title text not null,
        subscribers integer not null);  
 
+create table ttrss_labels2 (id serial not null primary key, 
+       owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
+       fg_color varchar(15) not null default '',
+       bg_color varchar(15) not null default '',
+       caption varchar(250) not null
+);
+
+create table ttrss_user_labels2 (
+       label_id integer not null references ttrss_labels2(id) ON DELETE CASCADE,
+       article_id integer not null references ttrss_entries(id) ON DELETE CASCADE
+);
+
 commit;