cli icon indicating copy to clipboard operation
cli copied to clipboard

[Declarative Schemas] Running Supabase DB Diff does not generate `GRANT USAGE ON SCHEMA <custom_schema>` statement

Open MrWarPro opened this issue 8 months ago • 0 comments

Describe the bug I currently have a GRANT USAGE ON SCHEMA <custom_schema> for my custom schema in a SQL file in the supabase/schemas directory using declarative schemas but when I follow the instructions to generate the new migration file withsupabase db diff -f <migration_file_name>, the generated migration SQL code didn't include the statemen GRANT USAGE ON SCHEMA <custom_schema> in my schema file.

To Reproduce Steps to reproduce the behavior:

  1. Create or update a schema file (declarative schemas) with statement GRANT USAGE ON SCHEMA <custom_schema>
  2. Stop the Supabase local container with supabase stop
  3. Generate the migration file with supabase db diff -f <migration_file_name>
  4. The generated migration code doesn't include the GRANT USAGE ON SCHEMA <custom_schema> statement

Expected behavior The generated migration code should include the GRANT USAGE ON SCHEMA <custom_schema> statement

System information

  • Version of OS: WSL2 Ubuntu 22.04
  • Version of CLI: 2.23.4 + 2.26.9
  • Version of Docker: 28.2.2, build e6534b4
  • Versions of services: SERVICE IMAGE | LOCAL | LINKED ------------------------------|---------------------------|-------- supabase/postgres | 15.8.1.085 | -
    supabase/gotrue | v2.176.1 | -
    postgrest/postgrest | v12.2.12 | -
    supabase/realtime | v2.36.18 | -
    supabase/storage-api | v1.24.6 | -
    supabase/edge-runtime | v1.67.4 | -
    supabase/studio | 2025.06.16-sha-c4316c3 | -
    supabase/postgres-meta | v0.89.3 | -
    supabase/logflare | 1.14.2 | -
    supabase/supavisor | 2.5.2 | -

Additional context

  • Version of supabase-js: 2.49.8
  • Version of Node.js: v22.9.0

MrWarPro avatar Jun 20 '25 05:06 MrWarPro