feat: daily vani
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- "Vāṇī of the Day" — one randomly-chosen piece of content (a prose chapter,
|
||||
-- a verse, or a transcript/lecture) surfaced on the home page each day.
|
||||
--
|
||||
-- One row per calendar day (UTC). The pick is chosen once — the first request
|
||||
-- of the day writes it and everyone sees the same item that day. `ref_id`
|
||||
-- (`<kind>:<mongo _id hex>`) identifies the underlying content so the picker
|
||||
-- can avoid repeating anything served in the last 90 days. `payload` is the
|
||||
-- prebuilt display blob (title/subtitle/href/…) so the CTA renders without
|
||||
-- re-reading Mongo.
|
||||
CREATE TABLE IF NOT EXISTS vani_of_the_day (
|
||||
day DATE PRIMARY KEY,
|
||||
kind TEXT NOT NULL,
|
||||
ref_id TEXT NOT NULL,
|
||||
payload JSONB NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- Serves the "not in the last 90 days" lookup (scan recent rows by ref_id).
|
||||
CREATE INDEX IF NOT EXISTS vani_of_the_day_ref_day_idx
|
||||
ON vani_of_the_day (ref_id, day DESC);
|
||||
Reference in New Issue
Block a user