You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Supabase locally, and I sometimes pull the remote schemas to apply them locally after:
To Reproduce
supabase db pull --schema public,auth,storage
supabase db push --local
Connecting to local database...
Skipping migration meta... (file name must match pattern "<timestamp>_name.sql")
Do you want to push these migrations to the remote database?
• 20250410175534_remote_schema.sql
[Y/n]
NOTICE (42P06): schema "supabase_migrations" already exists, skipping
NOTICE (42P07): relation "schema_migrations" already exists, skipping
NOTICE (42701): column "statements" of relation "schema_migrations" already exists, skipping
NOTICE (42701): column "name" of relation "schema_migrations" already exists, skipping
Applying migration 20250410175534_remote_schema.sql...
ERROR: cannot drop function storage.get_level(text) because other objects depend on it (SQLSTATE 2BP01)
At statement 30:
drop function if exists "storage"."get_level"(name text)
Try rerunning the command with --debug to troubleshoot the error.
Sent crash report: d149bb20d79e4856895351099c1a3365
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Rerun the failing command with --create-ticket flag.
droptrigger if exists "objects_delete_delete_prefix"on"storage"."objects";
droptrigger if exists "objects_insert_create_prefix"on"storage"."objects";
droptrigger if exists "objects_update_create_prefix"on"storage"."objects";
droptrigger if exists "prefixes_create_hierarchy"on"storage"."prefixes";
droptrigger if exists "prefixes_delete_hierarchy"on"storage"."prefixes";
revokedeleteon table "storage"."prefixes"from"anon";
revoke insert on table "storage"."prefixes"from"anon";
revokereferenceson table "storage"."prefixes"from"anon";
revokeselecton table "storage"."prefixes"from"anon";
revoke trigger on table "storage"."prefixes"from"anon";
revoke truncate on table "storage"."prefixes"from"anon";
revokeupdateon table "storage"."prefixes"from"anon";
revokedeleteon table "storage"."prefixes"from"authenticated";
revoke insert on table "storage"."prefixes"from"authenticated";
revokereferenceson table "storage"."prefixes"from"authenticated";
revokeselecton table "storage"."prefixes"from"authenticated";
revoke trigger on table "storage"."prefixes"from"authenticated";
revoke truncate on table "storage"."prefixes"from"authenticated";
revokeupdateon table "storage"."prefixes"from"authenticated";
revokedeleteon table "storage"."prefixes"from"service_role";
revoke insert on table "storage"."prefixes"from"service_role";
revokereferenceson table "storage"."prefixes"from"service_role";
revokeselecton table "storage"."prefixes"from"service_role";
revoke trigger on table "storage"."prefixes"from"service_role";
revoke truncate on table "storage"."prefixes"from"service_role";
revokeupdateon table "storage"."prefixes"from"service_role";
altertable"storage"."prefixes" drop constraint"prefixes_bucketId_fkey";
dropfunction if exists "storage"."add_prefixes"(_bucket_id text, _name text);
dropfunction if exists "storage"."delete_prefix"(_bucket_id text, _name text);
dropfunction if exists "storage"."delete_prefix_hierarchy_trigger"();
dropfunction if exists "storage"."get_level"(name text);
dropfunction if exists "storage"."get_prefix"(name text);
dropfunction if exists "storage"."get_prefixes"(name text);
dropfunction if exists "storage"."objects_insert_prefix_trigger"();
dropfunction if exists "storage"."prefixes_insert_trigger"();
dropfunction if exists "storage"."search_legacy_v1"(prefix text, bucketname text, limits integer, levels integer, offsets integer, search text, sortcolumn text, sortorder text);
dropfunction if exists "storage"."search_v1_optimised"(prefix text, bucketname text, limits integer, levels integer, offsets integer, search text, sortcolumn text, sortorder text);
dropfunction if exists "storage"."search_v2"(prefix text, bucket_name text, limits integer, levels integer, start_after text);
altertable"storage"."prefixes" drop constraint"prefixes_pkey";
dropindex if exists "storage"."idx_name_bucket_unique";
dropindex if exists "storage"."idx_objects_lower_name";
dropindex if exists "storage"."idx_prefixes_lower_name";
dropindex if exists "storage"."objects_bucket_id_level_idx";
dropindex if exists "storage"."prefixes_pkey";
droptable"storage"."prefixes";
altertable"storage"."objects" drop column "level";
set check_function_bodies = off;
CREATE OR REPLACEFUNCTIONstorage.search(prefix text, bucketname text, limits integer DEFAULT 100, levels integer DEFAULT 1, offsets integer DEFAULT 0, search text DEFAULT ''::text, sortcolumn text DEFAULT 'name'::text, sortorder text DEFAULT 'asc'::text)
RETURNS TABLE(name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb)
LANGUAGE plpgsql
STABLE
AS $function$
declare
v_order_by text;
v_sort_order text;
begin
case
when sortcolumn ='name' then
v_order_by ='name';
when sortcolumn ='updated_at' then
v_order_by ='updated_at';
when sortcolumn ='created_at' then
v_order_by ='created_at';
when sortcolumn ='last_accessed_at' then
v_order_by ='last_accessed_at';
else
v_order_by ='name';
end case;
case
when sortorder ='asc' then
v_sort_order ='asc';
when sortorder ='desc' then
v_sort_order ='desc';
else
v_sort_order ='asc';
end case;
v_order_by = v_order_by ||''|| v_sort_order;
return query execute
'with folders as ( select path_tokens[$1] as folder from storage.objects where objects.name ilike $2 || $3 || ''%'' and bucket_id = $4 and array_length(objects.path_tokens, 1) <> $1 group by folder order by folder '|| v_sort_order ||' ) (select folder as "name", null as id, null as updated_at, null as created_at, null as last_accessed_at, null as metadata from folders) union all (select path_tokens[$1] as "name", id, updated_at, created_at, last_accessed_at, metadata from storage.objects where objects.name ilike $2 || $3 || ''%'' and bucket_id = $4 and array_length(objects.path_tokens, 1) = $1 order by '|| v_order_by ||') limit $5 offset $6' using levels, prefix, search, bucketname, limits, offsets;
end;
$function$
;
The text was updated successfully, but these errors were encountered:
Sorry, duplicate of #3415, feel free to close (I searched for duplicates on the wrong repository). As a note, I have the generated SQL migration attached in this issue.
Describe the bug
I'm using Supabase locally, and I sometimes pull the remote schemas to apply them locally after:
To Reproduce
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Rerun the failing command with
--create-ticket
flag.brew
)Additional context
Migration file content:
The text was updated successfully, but these errors were encountered: