supabase-community / chatgpt-your-files

Production-ready MVP for securely chatting with your documents using pgvector
https://youtu.be/ibzlEQmgPPY
362 stars 126 forks source link

Gracefully handle bucket conflicts during insert #10

Closed gregnr closed 11 months ago

gregnr commented 11 months ago

Problem

For users following the cloud flow and attempting to use:

npx supabase db reset --linked

to reset their remote database, they get the error duplicate key value violates unique constraint "buckets_pkey".

Solution

Change

insert into storage.buckets (id, name)
values ('files', 'files');

to gracefully handle conflicts:

insert into storage.buckets (id, name)
values ('files', 'files')
on conflict do nothing;