supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.08k stars 209 forks source link

`supabase db dump`: no triggers in output #1726

Closed d9k closed 5 months ago

d9k commented 11 months ago

How can I dump triggers (CREATE TRIGGER statements with supabase db dump)?

Tried with and without --data-only argument.

On the other side, pg_dump dumps triggers perfectly.

Why is it better to use supabase db dump instead of pg_dump at all?

Also supabase db dump doesn't dump migrations (but it can be dumped separately with supabase db dump --data-only --schema supabase_migrations)

Version

"supabase": "1.115.5"

sweatybridge commented 11 months ago

Are you triggers defined in auth or storage schema? Those are ignored by default so you need to pass in the schema flag directly, ie.

supabase db dump --schema auth

Why is it better to use supabase db dump instead of pg_dump at all?

db dump uses pg_dump behind the scenes but with extra flags to ignore supabase managed schemas. This is essential for future compatibility when upgrading to newer versions of services, like gotrue or realtime.