All blocks

Foundation

Tenant memberships and permission helper

Memberships with roles, member_organization_ids() and has_organization_role() for RLS policies, and membership_claims() for the access token hook. Adopt an existing memberships table through sql.modules.tenant.

DocsModes:managedadoptcustom
terminal
npx better-supabase sql add tenant
better-supabase.config.ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  sql: {
    modules: {
      // Required by tenant; sql add installs them too.
      "updated-at": {},
      // Modes: "managed", "adopt", "custom". The default is "managed".
      tenant: { mode: "managed" },
    },
  },
});