add timeline feeds

This commit is contained in:
Namekuji 2023-08-10 14:32:05 -04:00
parent 4f19c1c3c0
commit 76a487b5fe
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
2 changed files with 29 additions and 0 deletions

View file

@ -2,6 +2,8 @@ DROP MATERIALIZED VIEW IF EXISTS reaction_by_id;
DROP MATERIALIZED VIEW IF EXISTS reaction_by_userid;
DROP INDEX IF EXISTS reaction_by_id;
DROP TABLE IF EXISTS reaction;
DROP TABLE IF EXISTS local_feed;
DROP TABLE IF EXISTS home_feed;
DROP MATERIALIZED VIEW IF EXISTS note_by_renote_id;
DROP MATERIALIZED VIEW IF EXISTS note_by_userid;
DROP MATERIALIZED VIEW IF EXISTS note_by_id;

View file

@ -101,6 +101,33 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS note_by_renote_id AS
PRIMARY KEY ("renoteId", "createdAt", "createdAtDate", "userId")
WITH CLUSTERING ORDER BY ("createdAt" DESC);
CREATE TABLE IF NOT EXISTS home_feed (
"userId" ascii,
"fedAtDate" date,
"fedAt" timestamp,
"noteId" ascii,
"noteUserId" ascii,
"noteUserHost" text,
"replyUserId" ascii,
"replyUserHost" text,
"renoteUserId" ascii,
"renoteUserHost" text,
PRIMARY KEY (("userId", "fedAtDate"), "fedAt")
) WITH CLUSTERING ORDER BY ("fedAt" DESC);
CREATE TABLE IF NOT EXISTS local_feed (
"fedAtDate" date,
"fedAt" timestamp,
"noteId" ascii,
"noteUserId" ascii,
"noteUserHost" text,
"replyUserId" ascii,
"replyUserHost" text,
"renoteUserId" ascii,
"renoteUserHost" text,
PRIMARY KEY ("fedAtDate", "fedAt")
) WITH CLUSTERING ORDER BY ("fedAt" DESC);
CREATE TABLE IF NOT EXISTS reaction (
"id" text,
"noteId" ascii,