Closed azurechen closed 3 months ago
This is quite strange indeed because I can't reproduce this on a fresh local project. The steps I took
supabase init
supabase start
supabase db diff --local --schema storage
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.
If you are still running into this error, try supabase db reset
to remove any potential changes to storage schema on local database.
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