mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-09 09:22:40 +00:00
Fix subs in the new MySQL schema
This commit is contained in:
parent
df185bbe42
commit
48accdfad8
2 changed files with 35 additions and 71 deletions
|
@ -162,6 +162,7 @@ alter table arsse_subscriptions modify url longtext not null;
|
||||||
alter table arsse_subscriptions add foreign key(icon) references arsse_icons(id) on delete set null;
|
alter table arsse_subscriptions add foreign key(icon) references arsse_icons(id) on delete set null;
|
||||||
alter table arsse_subscriptions add unique(owner,url(255));
|
alter table arsse_subscriptions add unique(owner,url(255));
|
||||||
alter table arsse_subscriptions drop constraint arsse_subscriptions_ibfk_2;
|
alter table arsse_subscriptions drop constraint arsse_subscriptions_ibfk_2;
|
||||||
|
alter table arsse_subscriptions drop constraint owner;
|
||||||
alter table arsse_subscriptions drop column feed;
|
alter table arsse_subscriptions drop column feed;
|
||||||
|
|
||||||
-- Delete unneeded table
|
-- Delete unneeded table
|
||||||
|
|
|
@ -210,19 +210,19 @@ QUERY_TEXT
|
||||||
INSERT INTO arsse_icons(id, url) values
|
INSERT INTO arsse_icons(id, url) values
|
||||||
(4, 'https://example.org/icon'),
|
(4, 'https://example.org/icon'),
|
||||||
(12, 'https://example.net/icon');
|
(12, 'https://example.net/icon');
|
||||||
INSERT INTO arsse_users values
|
insert into arsse_feeds values
|
||||||
('a', 'xyz', 1, 0),
|
|
||||||
('b', 'abc', 2, 0),
|
|
||||||
('c', 'gfy', 5, 1);
|
|
||||||
INSERT INTO arsse_folders(id, owner, parent, name) values
|
|
||||||
(1337, 'a', null, 'ook'),
|
|
||||||
(4400, 'c', null, 'eek');
|
|
||||||
INSERT INTO arsse_feeds values
|
|
||||||
(1, 'https://example.com/rss', 'Title 1', 'https://example.com/', '2001-06-13 06:55:23', '2001-06-13 06:56:23', '2001-06-13 06:57:23', '2001-06-13 06:54:23', '"ook"', 42, 'Some error', 'johndoe', 'secret', 47, null),
|
(1, 'https://example.com/rss', 'Title 1', 'https://example.com/', '2001-06-13 06:55:23', '2001-06-13 06:56:23', '2001-06-13 06:57:23', '2001-06-13 06:54:23', '"ook"', 42, 'Some error', 'johndoe', 'secret', 47, null),
|
||||||
-- This feed has no subscriptions, so should not be seen in the new table
|
-- This feed has no subscriptions, so should not be seen in the new table
|
||||||
(2, 'https://example.org/rss', 'Title 2', 'https://example.org/', '2001-06-14 06:55:23', '2001-06-14 06:56:23', '2001-06-14 06:57:23', '2001-06-14 06:54:23', '"eek"', 5, 'That error', 'janedoe', 'secret', 2112, 4),
|
(2, 'https://example.org/rss', 'Title 2', 'https://example.org/', '2001-06-14 06:55:23', '2001-06-14 06:56:23', '2001-06-14 06:57:23', '2001-06-14 06:54:23', '"eek"', 5, 'That error', 'janedoe', 'secret', 2112, 4),
|
||||||
(3, 'https://example.net/rss', 'Title 3', 'https://example.net/', '2001-06-15 06:55:23', '2001-06-15 06:56:23', '2001-06-15 06:57:23', '2001-06-15 06:54:23', '"ack"', 44, 'This error', '', '', 3, 12);
|
(3, 'https://example.net/rss', 'Title 3', 'https://example.net/', '2001-06-15 06:55:23', '2001-06-15 06:56:23', '2001-06-15 06:57:23', '2001-06-15 06:54:23', '"ack"', 44, 'This error', '', '', 3, 12);
|
||||||
INSERT INTO arsse_subscriptions values
|
insert into arsse_users values
|
||||||
|
('a', 'xyz', 1, 0),
|
||||||
|
('b', 'abc', 2, 0),
|
||||||
|
('c', 'gfy', 5, 1);
|
||||||
|
insert into arsse_folders(id, owner, parent, name) values
|
||||||
|
(1337, 'a', null, 'ook'),
|
||||||
|
(4400, 'c', null, 'eek');
|
||||||
|
insert into arsse_subscriptions values
|
||||||
(1, 'a', 1, '2002-02-02 00:02:03', '2002-02-02 00:05:03', 'User Title', 2, 1, null, 'keep', 'block', 0),
|
(1, 'a', 1, '2002-02-02 00:02:03', '2002-02-02 00:05:03', 'User Title', 2, 1, null, 'keep', 'block', 0),
|
||||||
(4, 'a', 3, '2002-02-03 00:02:03', '2002-02-03 00:05:03', 'Rosy Title', 1, 0, 1337, 'meep', 'bloop', 0),
|
(4, 'a', 3, '2002-02-03 00:02:03', '2002-02-03 00:05:03', 'Rosy Title', 1, 0, 1337, 'meep', 'bloop', 0),
|
||||||
(6, 'c', 3, '2002-02-04 00:02:03', '2002-02-04 00:05:03', null, 2, 0, 4400, null, null, 1);
|
(6, 'c', 3, '2002-02-04 00:02:03', '2002-02-04 00:05:03', null, 2, 0, 4400, null, null, 1);
|
||||||
|
@ -253,68 +253,31 @@ QUERY_TEXT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
create table arsse_subscriptions(
|
CREATE TABLE arsse_articles(
|
||||||
-- users' subscriptions to newsfeeds, with settings
|
-- metadata for entries in newsfeeds, including user state
|
||||||
id integer primary key, -- sequence number
|
id integer primary key, -- sequence number
|
||||||
owner text not null references arsse_users(id) on delete cascade on update cascade, -- owner of subscription
|
subscription integer not null references arsse_subscriptions(id) on delete cascade on update cascade, -- associated subscription
|
||||||
url text not null, -- URL of feed
|
read int not null default 0, -- whether the article has been read
|
||||||
feed_title text collate nocase, -- feed title
|
starred int not null default 0, -- whether the article is starred
|
||||||
title text collate nocase, -- user-supplied title, which overrides the feed title when set
|
hidden int not null default 0, -- whether the article should be excluded from selection by default
|
||||||
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
|
published text, -- time of original publication
|
||||||
last_mod text, -- time at which the feed last actually changed at the foreign host
|
edited text, -- time of last edit by author
|
||||||
etag text not null default '', -- HTTP ETag hash used for cache validation, changes each time the content changes
|
modified text not null default CURRENT_TIMESTAMP, -- time when article was last modified in database pursuant to an authorial edit
|
||||||
next_fetch text, -- time at which the feed should next be fetched
|
marked text, -- time at which an article was last modified by the user
|
||||||
added text not null default CURRENT_TIMESTAMP, -- time at which feed was added
|
url text, -- URL of article
|
||||||
source text, -- URL of site to which the feed belongs
|
title text collate nocase, -- article title
|
||||||
updated text, -- time at which the feed was last fetched
|
author text collate nocase, -- author's name
|
||||||
err_count integer not null default 0, -- count of successive times update resulted in error since last successful update
|
guid text, -- a nominally globally unique identifier for the article, from the feed
|
||||||
err_msg text, -- last error message
|
url_title_hash text not null, -- hash of URL + title; used when checking for updates and for identification if there is no guid
|
||||||
size integer not null default 0, -- number of articles in the feed at last fetch
|
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
|
||||||
icon integer references arsse_icons(id) on delete set null, -- numeric identifier of any associated icon
|
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
|
||||||
modified text not null default CURRENT_TIMESTAMP, -- time at which subscription properties were last modified by the user
|
note text not null default '' -- Tiny Tiny RSS freeform user note
|
||||||
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
|
CREATE TABLE arsse_article_contents(
|
||||||
keep_rule text, -- Regular expression the subscription's articles must match to avoid being hidden
|
-- contents of articles, which is typically large text
|
||||||
block_rule text, -- Regular expression the subscription's articles must not match to avoid being hidden
|
id integer primary key references arsse_articles(id) on delete cascade on update cascade, -- reference to the article ID
|
||||||
unique(owner,url) -- a URL with particular credentials should only appear once
|
content text -- the contents
|
||||||
);
|
|
||||||
|
|
||||||
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_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
|
|
||||||
);
|
|
||||||
*/
|
*/
|
Loading…
Reference in a new issue