ttrss_entries & ttrss_user_entries

Development-related discussion, including bundled plugins
Saliency
Bear Rating Trainee
Bear Rating Trainee
Posts: 49
Joined: 27 Mar 2013, 20:05

ttrss_entries & ttrss_user_entries

Postby Saliency » 05 Apr 2013, 00:18

Hi more questions sorry.

I'm guessing it has something to do with archiving articles but I was wondering why each user gets an identical ttrss_entries instead of pointing ttrss_user_entries to one row.

Playing around I made a copy of my AWS tt-rss instance and blasted the data on the new instance using the query under.
After running the query everything still looks good.



/*
SQL to merge stuff.
*/
CREATE TEMPORARY TABLE tempT (
min_id int(11)
,link varchar(1000)
) ENGINE=MEMORY;

INSERT INTO tempT (min_id, link)
SELECT min(id), link
FROM ttRSS.ttrss_entries
GROUP BY link;

UPDATE
ttRSS.ttrss_user_entries ue
JOIN ttRSS.ttrss_entries e ON ue.ref_id = e.id
JOIN tempT t ON e.link = t.link
SET ue.ref_id = t.min_id;


/* Explicitly destroy the table */
DROP TABLE tempT;



/*
Now delete the orphins.
*/
/*
SELECT * FROM ttRSS.ttrss_entries WHERE ID NOT IN
(SELECT distinct ref_id from ttRSS.ttrss_user_entries);
*/

delete from ttRSS.ttrss_enclosures
WHERE ID NOT IN
(SELECT distinct ref_id from ttRSS.ttrss_user_entries);

delete from ttRSS.ttrss_entries
WHERE ID NOT IN
(SELECT distinct ref_id from ttRSS.ttrss_user_entries);


/*
Thought about moving them but fk pain. On new AWS instance so don't care if i fuck it up.

UPDATE ttRSS.ttrss_enclosures
SET post_id = id * -1
WHERE ID NOT IN
(SELECT distinct ref_id from ttRSS.ttrss_user_entries);

UPDATE ttRSS.ttrss_entries
SET id = id * -1
WHERE ID NOT IN
(SELECT distinct ref_id from ttRSS.ttrss_user_entries);
*/

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: ttrss_entries & ttrss_user_entries

Postby fox » 05 Apr 2013, 00:25

Because of resyndication/plugins and potential GUID clashes. Why do you think ttrss_entries/user_entries exists, that's how it worked for a long time, until I switched to the current model because of increased abilities of tt-rss users to manipulate article data.


Return to “Development”

Who is online

Users browsing this forum: No registered users and 5 guests