-- +goose Up -- Plan dashboard feature permissions (per-plan overrides + global section/feature gates). ALTER TABLE plans ADD COLUMN IF NOT EXISTS features JSONB NOT NULL DEFAULT '{}'::jsonb; CREATE TABLE IF NOT EXISTS platform_feature_gates ( gate_key TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind IN ('section', 'feature')), enabled BOOLEAN NOT NULL DEFAULT true, updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), updated_by UUID NULL REFERENCES users(id) ON DELETE SET NULL ); CREATE INDEX IF NOT EXISTS platform_feature_gates_kind_idx ON platform_feature_gates (kind); -- +goose Down DROP INDEX IF EXISTS platform_feature_gates_kind_idx; DROP TABLE IF EXISTS platform_feature_gates; ALTER TABLE plans DROP COLUMN IF EXISTS features;