From 76a487b5fe57a001274d619cf822184cc9bccd20 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Thu, 10 Aug 2023 14:32:05 -0400 Subject: [PATCH] add timeline feeds --- .../cql/1689400417034_timeline/down.cql | 2 ++ .../cql/1689400417034_timeline/up.cql | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/down.cql b/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/down.cql index c1746c8a49..6dd964ce5f 100644 --- a/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/down.cql +++ b/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/down.cql @@ -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; diff --git a/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/up.cql b/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/up.cql index 6c4cb8b854..fb166b2c49 100644 --- a/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/up.cql +++ b/packages/backend/native-utils/scylla-migration/cql/1689400417034_timeline/up.cql @@ -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,