# RLS on every new table

> An event trigger that enables row level security on every table created outside the Supabase-managed schemas, so a new table is never readable through the Data API before it has policies. Install it as postgres: supautils lets that role create event triggers.

- Category: Database primitives
- Module: `rls-guard`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/sql
- Page: https://bettersupabase.com/blocks/rls-guard

## Install

```bash
npx better-supabase add rls-guard
```

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Modes: "managed". The default is "managed".
    "rls-guard": { mode: "managed" },
  },
});
```

## Client

The block is SQL only: call its functions from your policies, RPCs and the other modules.
