Back to studio RLS Studio

Get your database schema as SQL

RLS Studio reads plain create table SQL. Here are three ways to export yours. Pick whichever fits your setup, copy the output, and paste it into the Import SQL box.

1

Supabase Dashboard (no install)

Open your project → SQL Editor and run this. It prints a create table statement for every table in the public schema. Copy the result and paste it in.
select
  'create table ' || quote_ident(table_name) || ' (' ||
  string_agg(
    quote_ident(column_name) || ' ' || data_type,
    ', ' order by ordinal_position
  ) || ');'
from information_schema.columns
where table_schema = 'public'
group by table_name;
Tip: you can also grab your enum roles with select * from pg_type where typtype = 'e';
2

Supabase CLI (recommended)

If you use the Supabase CLI, dump just the schema (no data) for the public schema:
supabase db dump --schema public -f schema.sql
Then drag schema.sql straight into the import box, or open it and copy the contents.
3

pg_dump (any Postgres)

Works for any Postgres database, Supabase or not. The --schema-only flag keeps your data out of it:
pg_dump --schema-only --no-owner \
  --schema=public \
  "postgresql://USER:PASSWORD@HOST:5432/postgres" \
  > schema.sql
Find the connection string under Project Settings → Database in Supabase.

Don't have a database yet?

No problem, you don't need one. Just go back to the studio and add tables manually: type a table name, choose who can do what, and copy the generated policies. You can wire them into your schema later.

Start building

Your SQL never leaves your browser. All the parsing happens right here on your device.