A community based topic aggregation platform built on atproto
1-- +goose Up
2CREATE TABLE unfurl_cache (
3 url TEXT PRIMARY KEY,
4 provider TEXT NOT NULL,
5 metadata JSONB NOT NULL,
6 thumbnail_url TEXT,
7 fetched_at TIMESTAMP NOT NULL DEFAULT NOW(),
8 expires_at TIMESTAMP NOT NULL,
9 created_at TIMESTAMP NOT NULL DEFAULT NOW()
10);
11
12CREATE INDEX idx_unfurl_cache_expires ON unfurl_cache(expires_at);
13
14COMMENT ON TABLE unfurl_cache IS 'Cache for oEmbed/URL unfurl results to reduce external API calls';
15COMMENT ON COLUMN unfurl_cache.url IS 'The URL that was unfurled (primary key)';
16COMMENT ON COLUMN unfurl_cache.provider IS 'Provider name (streamable, youtube, reddit, etc.)';
17COMMENT ON COLUMN unfurl_cache.metadata IS 'Full unfurl result as JSON (title, description, type, etc.)';
18COMMENT ON COLUMN unfurl_cache.thumbnail_url IS 'URL of the thumbnail image';
19COMMENT ON COLUMN unfurl_cache.expires_at IS 'When this cache entry should be refetched (TTL-based)';
20
21-- +goose Down
22DROP INDEX IF EXISTS idx_unfurl_cache_expires;
23DROP TABLE IF EXISTS unfurl_cache;