123456789101112131415161718192021222324252627CREATE TABLE feeds (
id INTEGERPRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL/* Subscription title shown in the reader. */,
url TEXT NOT NULLUNIQUE/* Subscription feed URL, stored as https. An http address is upgraded when subscribing. */,
checked_at TEXT /* Last check attempt, UTC ISO 8601. */,
error TEXT /* Last check error, or null after success. */,
subscribed INTEGERNOT NULLDEFAULT1CHECK (subscribed IN (0, 1)) /* 0 retains item identity after unsubscribing. */
);
CREATE TABLE items (
id INTEGERPRIMARY KEY AUTOINCREMENT,
feed_id INTEGERREFERENCES feeds(id) /* Subscription; null for standalone or file-imported items. */,
guid TEXT,
guid_is_perma_link INTEGERNOT NULLDEFAULT1CHECK (guid_is_perma_link IN (0, 1)),
title TEXT,
link TEXT,
description TEXT,
author TEXT,
category TEXT,
comments TEXT,
pub_date TEXT,
source TEXT /* RSS <source>: original publication channel, not the subscription. */,
source_url TEXT /* RSS <source> URL: original publication feed, not the subscription URL. */,
enclosure_url TEXT,
enclosure_length INTEGERCHECK (enclosure_length >=0),
enclosure_type TEXT,
CHECK (title ISNOT NULLOR description ISNOT NULL)
);