While trying to create a local dev environment,
supabase db reset
is failing with
Resetting local database...
Recreating database...
Initialising schema...
Seeding globals from roles.sql...
Applying migration 20250316135437_remote_schema.sql...
Applying migration 20250316135745_remote_schema.sql...
ERROR: cannot drop function storage.get_level(text) because other objects depend on it (SQLSTATE 2BP01)
At statement 31:
drop function if exists "storage"."get_level"(name text)
How can I get past this?
While trying to create a local dev environment,
supabase db reset
is failing with
Resetting local database...
Recreating database...
Initialising schema...
Seeding globals from roles.sql...
Applying migration 20250316135437_remote_schema.sql...
Applying migration 20250316135745_remote_schema.sql...
ERROR: cannot drop function storage.get_level(text) because other objects depend on it (SQLSTATE 2BP01)
At statement 31:
drop function if exists "storage"."get_level"(name text)
How can I get past this?
Share Improve this question asked Mar 16 at 15:23 kjhugheskjhughes 112k31 gold badges196 silver badges268 bronze badges1 Answer
Reset to default 1The problem was due to having earlier issued
supabase db pull
then seeing the warning:
The auth and storage schemas are excluded. Run supabase db pull --schema auth,storage again to diff them.
and issuing the suggested,
db pull --schema auth,storage
Don't do that. Instead, start over with
rm -rf supabase/migrations/*
then in a single command, include all of the schemas:
supabase db pull --schema public,auth,storage
and the migration file will no longer try to drop a function with dependencies.