Skip to content

Migrations do not allow adding storage policies #96

Description

@everzet

Bug report

Describe the bug

One of the biggest benefits I see in Suapabase is its ability to be nearly 100% controlled via SQL.

This to me means that I should be able to describe most of my database, storage and authentication requirements through migrations.

Currently, if migration includes a change of a policy on sotrage.objects - it fails with ERROR: must be owner of ... (e.g.: ERROR: must be owner of table objects).

Short term fix for me was to make postgres user a superuser with (via Supabase UI):

ALTER USER postgres WITH SUPERUSER;

But that feels less than ideal for a variety of reasons.

To Reproduce

Create a migration that includes addition of RLS policy onto a sotrage.objects table:

create policy "Avatars are accessible to authenticated users"
  on storage.objects for select
  using ( bucket_id = 'avatars' and auth.role() = 'authenticated' );

Expected behavior

Migrations should just be applied without an error with supabase db push.

Instead, they only execute (without an error) against the local version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions