PRAGMA journal_mode=WAL;

create table if not exists feeds (
	feed_id blob primary key,
	parent_id blob,
	nick text,
	uri text,
	state string,
	last_scan_on timestamp,
	refresh_rate int default 600,
	last_modified_on timestamp,
	last_etag text,
	last_error text
);

create table if not exists twts (
	feed_id blob,
    ulid blob,
	text text,
	conv text,
	hash text,
	mentions text, -- json
	tags text, -- json
    primary key (feed_id, ulid)
);

create table if not exists last_twt_on(
	feed_id blob,
	last_twt_on,
	primary key (feed_id)
); 

CREATE INDEX if not exists twt_time on twts (ulid asc);
