Extension to the current "Copy as Markdown" function #46108
Replies: 3 comments 1 reply
-
|
The current SCHEMA.md output is great for getting a quick overview of tables and relationships, but as soon as you try to use it as a real single source of truth (handing it to a teammate, feeding it to an LLM, or doing a security review), the missing Enums and RLS policies become a huge blind spot. In a Supabase/Postgres project, RLS is the schema for all practical purposes — two tables with identical columns can behave completely differently depending on their policies. Leaving them out of the export means the Markdown can actually be misleading, not just incomplete. A few things that would make this even more useful when implemented:
|
Beta Was this translation helpful? Give feedback.
-
|
I'd like to work on this! Building on @FaustoMendezcom's suggestions, here's my proposed approach: 1. Enums section
2. RLS Policies section
Output format example: ## Enums
### order_status
`pending` | `processing` | `shipped` | `delivered` | `cancelled`
## Table: orders
### Columns
...
### RLS Policies
| Policy | Command | Roles | USING | WITH CHECK |
|--------|---------|-------|-------|------------|
| users_own_orders | SELECT | authenticated | auth.uid() = user_id | — |Questions for maintainers:
Happy to submit a draft PR for feedback. |
Beta Was this translation helpful? Give feedback.
-
|
I've submitted a PR for this: #46189 The implementation adds two new sections to the generated markdown:
Reuses existing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the "Copy as Markdown" function in the Schema Visualizer generates a SCHEMA.md file that acts as a fantastic single source of truth for database structure, detailing tables, entity relationships, and data validation rules.
However, two critical components of a PostgreSQL/Supabase architecture are missing from this output: Custom Types/Enums and Row Level Security (RLS) Policies. Because policies dictate how data is accessed and protected, and enums define strict data categories, their absence means the generated Markdown is an incomplete representation of the schema. Developers currently have to manually document these or run separate SQL queries to maintain a true single source of truth.
Describe the solution you'd like
I would love to see the "Copy as Markdown" feature extended to automatically append sections for Enums and Policies associated with the visualized tables.
Ideally, the generated SCHEMA.md would include:
Enums: A list of custom types and their permitted values.
Policies: A breakdown of RLS policies per table, detailing the policy name, command (SELECT, INSERT, etc.), roles, and the USING / WITH CHECK expressions.
Beta Was this translation helpful? Give feedback.
All reactions