-- users' subscriptions to newsfeeds, with settings
id integer primary key, -- sequence number
owner text not null references arsse_users(id) on delete cascade on update cascade, -- owner of subscription
url text not null, -- URL of feed
feed_title text collate nocase, -- feed title
title text collate nocase, -- user-supplied title, which overrides the feed title when set
folder integer references arsse_folders(id) on delete cascade, -- TT-RSS category (nestable); the first-level category (which acts as Nextcloud folder) is joined in when needed
last_mod text, -- time at which the feed last actually changed at the foreign host
etag text not null default '', -- HTTP ETag hash used for cache validation, changes each time the content changes
next_fetch text, -- time at which the feed should next be fetched
added text not null default CURRENT_TIMESTAMP, -- time at which feed was added
source text, -- URL of site to which the feed belongs
updated text, -- time at which the feed was last fetched
err_count integer not null default 0, -- count of successive times update resulted in error since last successful update
err_msg text, -- last error message
size integer not null default 0, -- number of articles in the feed at last fetch
icon integer references arsse_icons(id) on delete set null, -- numeric identifier of any associated icon
modified text not null default CURRENT_TIMESTAMP, -- time at which subscription properties were last modified by the user
order_type int not null default 0, -- Nextcloud sort order
pinned int not null default 0, -- whether feed is pinned (always sorts at top)
scrape int not null default 0, -- whether the user has requested scraping content from source articles
keep_rule text, -- Regular expression the subscription's articles must match to avoid being hidden
block_rule text, -- Regular expression the subscription's articles must not match to avoid being hidden
unique(owner,url) -- a URL with particular credentials should only appear once
);
CREATE TABLE arsse_articles(
-- metadata for entries in newsfeeds, including user state
id integer primary key, -- sequence number
subscription integer not null references arsse_subscriptions(id) on delete cascade on update cascade, -- associated subscription
read int not null default 0, -- whether the article has been read
starred int not null default 0, -- whether the article is starred
hidden int not null default 0, -- whether the article should be excluded from selection by default
published text, -- time of original publication
edited text, -- time of last edit by author
modified text not null default CURRENT_TIMESTAMP, -- time when article was last modified in database pursuant to an authorial edit
marked text, -- time at which an article was last modified by the user
url text, -- URL of article
title text collate nocase, -- article title
author text collate nocase, -- author's name
guid text, -- a nominally globally unique identifier for the article, from the feed
url_title_hash text not null, -- hash of URL + title; used when checking for updates and for identification if there is no guid
url_content_hash text not null, -- hash of URL + content + enclosure URL + enclosure content type; used when checking for updates and for identification if there is no guid
title_content_hash text not null, -- hash of title + content + enclosure URL + enclosure content type; used when checking for updates and for identification if there is no guid
note text not null default '' -- Tiny Tiny RSS freeform user note
)
create table arsse_feeds(
-- newsfeeds, deduplicated
-- users have subscriptions to these feeds in another table
id integer primary key, -- sequence number
url text not null, -- URL of feed
title text collate nocase, -- default title of feed (users can set the title of their subscription to the feed)
source text, -- URL of site to which the feed belongs
updated text, -- time at which the feed was last fetched
modified text, -- time at which the feed last actually changed
next_fetch text, -- time at which the feed should next be fetched
orphaned text, -- time at which the feed last had no subscriptions
etag text not null default '', -- HTTP ETag hash used for cache validation, changes each time the content changes
err_count integer not null default 0, -- count of successive times update resulted in error since last successful update
err_msg text, -- last error message
username text not null default '', -- HTTP authentication username
password text not null default '', -- HTTP authentication password (this is stored in plain text)
size integer not null default 0, -- number of articles in the feed at last fetch
icon integer references arsse_icons(id) on delete set null, -- numeric identifier of any associated icon
unique(url,username,password) -- a URL with particular credentials should only appear once
CREATE TABLE arsse_article_contents(
-- contents of articles, which is typically large text
id integer primary key references arsse_articles(id) on delete cascade on update cascade, -- reference to the article ID
content text -- the contents
)
create table arsse_subscriptions(
-- users' subscriptions to newsfeeds, with settings
id integer primary key, -- sequence number
owner text not null references arsse_users(id) on delete cascade on update cascade, -- owner of subscription
feed integer not null references arsse_feeds(id) on delete cascade, -- feed for the subscription
added text not null default CURRENT_TIMESTAMP, -- time at which feed was added
modified text not null default CURRENT_TIMESTAMP, -- time at which subscription properties were last modified
title text collate nocase, -- user-supplied title
order_type int not null default 0, -- Nextcloud sort order
pinned boolean not null default 0, -- whether feed is pinned (always sorts at top)
folder integer references arsse_folders(id) on delete cascade, -- TT-RSS category (nestable); the first-level category (which acts as Nextcloud folder) is joined in when needed
keep_rule text default null,
block_rule text default null,
scape boolean not null default 0,
unique(owner,feed) -- a given feed should only appear once for a given owner