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 always use the local dev server to develop. And I also create storage policies locally.
When I prepare to deploy these policies to the remote server.
I executed the following command to generate a migration file for storage policies.
supabase db diff --local --schema storage --use-migra -f {name}
And the output includes some functions that were created by Supabase not myself.
set check_function_bodies = off;
CREATE OR REPLACE FUNCTION storage.extension(name text)
RETURNS text
LANGUAGE plpgsql
AS $function$
DECLARE
_parts text[];
_filename text;
BEGIN
select string_to_array(name, '/') into _parts;
select _parts[array_length(_parts,1)] into _filename;
-- @todo return the last part instead of 2
return split_part(_filename, '.', 2);
END
$function$
;
CREATE OR REPLACE FUNCTION storage.filename(name text)
RETURNS text
LANGUAGE plpgsql
AS $function$
DECLARE
_parts text[];
BEGIN
select string_to_array(name, '/') into _parts;
return _parts[array_length(_parts,1)];
END
$function$
;
CREATE OR REPLACE FUNCTION storage.foldername(name text)
RETURNS text[]
LANGUAGE plpgsql
AS $function$
DECLARE
_parts text[];
BEGIN
select string_to_array(name, '/') into _parts;
return _parts[1:array_length(_parts,1)-1];
END
$function$
;
I guess if I run migrations and replace these functions it may cause some issues even if I don't change any logic. (Such as if Supabase official will change these functions' logic someday)
I am also curious as to why only extension, filename and foldername these three functions should be migrated.
Other functions and tables under the storage schema won't be included in the migration file.
Is it caused by permissions?
I know I can remove them from the migration file by myself.
But next time I run the command to generate another migration file for storage policies update. These three functions will be included in the new migration file again.
Therefore I think remove them by myself may not be a good solution.
To Reproduce
run supabase db diff --local --schema storage --use-migra -f {name}
check the migration file
Expected behavior
The generated migration file doesn't include extension, filename and foldername functions
Diffing schemas: storage
Finished supabase db diff on branch develop.
create policy "Enable read access for all users"
on "storage"."buckets"
as permissive
for select
to public
using (true);
create policy "Enable read access for all users"
on "storage"."objects"
as permissive
for select
to public
using (true);
Output only contains the changed policies and not other functions.
I always use the local dev server to develop. And I also create storage policies locally.
When I prepare to deploy these policies to the remote server.
I executed the following command to generate a migration file for storage policies.
supabase db diff --local --schema storage --use-migra -f {name}
And the output includes some functions that were created by Supabase not myself.
I guess if I run migrations and replace these functions it may cause some issues even if I don't change any logic. (Such as if Supabase official will change these functions' logic someday)
I am also curious as to why only
extension
,filename
andfoldername
these three functions should be migrated.Other functions and tables under the storage schema won't be included in the migration file.
Is it caused by permissions?
I know I can remove them from the migration file by myself.
But next time I run the command to generate another migration file for storage policies update. These three functions will be included in the new migration file again.
Therefore I think remove them by myself may not be a good solution.
To Reproduce
supabase db diff --local --schema storage --use-migra -f {name}
Expected behavior
The generated migration file doesn't include
extension
,filename
andfoldername
functionsSystem information
supabase/postgres │ 15.1.1.41 │ -
supabase/gotrue │ v2.149.0 │ -
postgrest/postgrest │ v12.0.1 │ -
supabase/realtime │ v2.28.32 │ -
supabase/storage-api │ v1.0.6 │ -
supabase/edge-runtime │ v1.45.2 │ -
supabase/studio │ 20240422-5cf8f30 │ -
supabase/postgres-meta │ v0.80.0 │ -
supabase/logflare │ 1.4.0 │ -
bitnami/pgbouncer │ 1.20.1-debian-11-r39 │ -
darthsim/imgproxy │ v3.8.0 │ -
The text was updated successfully, but these errors were encountered: