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
createtablemain.newssync_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)
categoryintegernotnullreferencesnewssync_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