enclosures_hashvarchar(64),-- hash of enclosures, if any; since enclosures are not uniquely identified, we need to know when they change
tags_hashvarchar(64)-- hash of RSS/Atom categories included in article; since these categories are not uniquely identified, we need to know when they change
unique(owner,name,parent)-- cannot have multiple categories with the same name under the same parent for the same owner
);
-- users' subscriptions to newsfeeds, with settings
createtablenewssync_subscriptions(
idintegerprimarykeynotnull,-- sequence number
ownerTEXTnotnullreferencesnewssync_users(id)ondeletecascadeonupdatecascade,-- owner of subscription
feedintegernotnullreferencesnewssync_feeds(id)ondeletecascade,-- feed for the subscription
addeddatetimenotnulldefaultCURRENT_TIMESTAMP,-- time at which feed was added
modifieddatetimenotnulldefaultCURRENT_TIMESTAMP,-- date at which subscription properties were last modified
titleTEXT,-- user-supplied title
order_typeintnotnulldefault0,-- ownCloud sort order
pinnedbooleannotnulldefault0,-- whether feed is pinned (always sorts at top)
categoryintegerreferencesnewssync_categories(id)ondeletesetnull,-- TT-RSS category (nestable); the first-level category (which acts as ownCloud folder) is joined in when needed
unique(owner,feed)-- a given feed should only appear once for a given owner