mirror of
https://github.com/block/buzz.git
synced 2026-10-27 20:41:57 +00:00
16 lines
760 B
SQL
16 lines
760 B
SQL
-- ── Relay members (NIP-43) ────────────────────────────────────────────────────
|
|
-- Conformance: membership gate, community-scoped. pubkey stored as hex TEXT
|
|
-- (unchanged wire form). PK (community_id, pubkey).
|
|
|
|
CREATE TABLE relay_members (
|
|
community_id UUID NOT NULL REFERENCES communities(id),
|
|
pubkey TEXT NOT NULL,
|
|
role TEXT NOT NULL CHECK (role IN ('owner', 'admin', 'member')),
|
|
added_by TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (community_id, pubkey)
|
|
);
|
|
|
|
CREATE INDEX idx_relay_members_role ON relay_members (community_id, role);
|