Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.5 kB · 45 lines
SQL
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546-- site.standard.publication records-- Source of truth for custom domain claims
CREATE TABLE IF NOT EXISTS publications ( -- Identity did String, rkey String, cid String,
-- Materialized URI for convenience uri String MATERIALIZED concat('at://', did, '/site.standard.publication/', rkey),
-- Queryable fields from record name String DEFAULT '', description String DEFAULT '', url String DEFAULT '', -- Canonical URL (e.g., https://myblog.com)
-- Extracted domain from url for fast lookup domain String DEFAULT '', -- e.g., myblog.com
-- Weaver-specific: notebook AT-URI if this publication is backed by a notebook notebook_uri String DEFAULT '',
-- Encoded CNAME target for reverse lookup cname_target String MATERIALIZED concat('nb-', replaceAll(replaceAll(substring(did, 5), ':', '-'), '.', '_'), '-', rkey, '.pub.weaver.sh'),
-- Timestamps created_at DateTime64(3) DEFAULT toDateTime64(0, 3), event_time DateTime64(3), indexed_at DateTime64(3) DEFAULT now64(3),
-- Soft delete deleted_at DateTime64(3) DEFAULT toDateTime64(0, 3), record JSON DEFAULT '{}')ENGINE = ReplacingMergeTree(indexed_at)ORDER BY (did, rkey);
-- Index for domain lookupALTER TABLE publications ADD INDEX idx_domain domain TYPE bloom_filter GRANULARITY 4;
-- Index for CNAME target lookupALTER TABLE publications ADD INDEX idx_cname_target cname_target TYPE bloom_filter GRANULARITY 4;