addition of new dashboard
This commit is contained in:
14
backend/db/migrations/000016 - cache.sql
Normal file
14
backend/db/migrations/000016 - cache.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- Per-tenant read-through cache; updated_ts drives TTL freshness.
|
||||
CREATE TABLE IF NOT EXISTS public.cache (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL REFERENCES public.user(id),
|
||||
tag TEXT NOT NULL,
|
||||
data JSONB NOT NULL,
|
||||
created_ts TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_ts TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT uniq__cache__user_id_tag UNIQUE (user_id, tag)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx__public__cache__user_id ON public.cache (user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx__public__cache__tag ON public.cache (tag);
|
||||
CREATE INDEX IF NOT EXISTS idx__public__cache__created_ts ON public.cache (created_ts);
|
||||
CREATE INDEX IF NOT EXISTS idx__public__cache__updated_ts ON public.cache (updated_ts);
|
||||
Reference in New Issue
Block a user