Skip to main content

circle_charters

Overview

The circle_charters table stores the enabled/disabled state of each community norm toggle for each circle. When a circle is created, charter entries are auto-populated based on the defaults from charter_toggle_definitions. Circle admins can then toggle individual norms on or off.

Relevant Invariants

  • Invariant #5: "Repair Over Punishment" -- Charters set expectations rather than enforcement rules

Schema

-- From 20260131_circle_charters_schema.sql
CREATE TABLE circle_charters (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
circle_id UUID NOT NULL REFERENCES circles(id) ON DELETE CASCADE,
toggle_key TEXT NOT NULL REFERENCES charter_toggle_definitions(key),
enabled BOOLEAN DEFAULT TRUE,
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(circle_id, toggle_key)
);

Columns

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
circle_iduuidNo--Circle this charter belongs to
toggle_keytextNo--References charter_toggle_definitions(key)
enabledbooleanNoTRUEWhether this norm is active
updated_attimestamptzNoNOW()Last toggle timestamp

RLS Policies

-- SELECT: Circle members can view charter
CREATE POLICY "Circle members can view charter"
ON circle_charters FOR SELECT
USING (is_circle_member(auth.uid(), circle_id));

-- UPDATE: Circle admin can toggle norms
CREATE POLICY "Circle admin can update charter"
ON circle_charters FOR UPDATE
USING (is_circle_admin(auth.uid(), circle_id));

Last updated: 2026-02-07