mirror of
https://github.com/block/buzz.git
synced 2026-10-28 04:51:40 +00:00
fix(db): add communities to schema snapshot
Relay E2E applies schema/schema.sql as declarative desired state before the relay starts. The multi-tenant migration added FKs to communities, but the snapshot did not define the table, so pgschema failed before tests ran. Co-authored-by: Mari <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,21 @@ CREATE TYPE subscription_status AS ENUM ('active', 'paused', 'deleted');
|
||||
CREATE TYPE pause_reason AS ENUM ('user', 'system', 'rate_limit');
|
||||
CREATE TYPE channel_add_policy AS ENUM ('anyone', 'owner_only', 'nobody');
|
||||
|
||||
-- ── Communities ───────────────────────────────────────────────────────────────
|
||||
-- Host normalization: `host` is stored already-normalized — ASCII-lowercased,
|
||||
-- trailing dot stripped, default port omitted. The UNIQUE is on `lower(host)` so
|
||||
-- resolution and storage agree even if a writer forgets to normalize first.
|
||||
|
||||
CREATE TABLE communities (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
host VARCHAR(255) NOT NULL,
|
||||
signing_key BYTEA,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT chk_communities_id_not_nil CHECK (id <> '00000000-0000-0000-0000-000000000000'::uuid)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_communities_host ON communities (lower(host));
|
||||
|
||||
-- ── Channels ──────────────────────────────────────────────────────────────────
|
||||
|
||||
CREATE TABLE channels (
|
||||
|
||||
Reference in New Issue
Block a user