mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
* docs: storage s3 protocol * fix: edits * docs(storage): added ownership,management,custom-roles docs * chore: fix prettier * docs: fix formatting & rephrase some bits * fix: edits * add error codes documentation * update docs * Adds blog post * Adds embeds * chore: update images * parquet video * Update thumb.png * some doc updates * Adds compat list * guide: cyberduck * doc updates * ga page data * blog updates * update image * Update 2024-04-18-s3-compatible-storage.mdx * Update supabase-contributions.png * blog update * moves cyberduck to integrations * updated multipart section blog * Update 2024-04-18-s3-compatible-storage.mdx * update blog * fix link * blog updates * update blog * docs update * update announcement banners * update * update build stage * update --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> Co-authored-by: Kang Ming <kang.ming1996@gmail.com> Co-authored-by: Inian <inian1234@gmail.com> Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com> Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com> Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com> Co-authored-by: Francesco Sansalvadore <francescosansalvadore@mac.wind3.hub>
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
---
|
|
id: 'storage-management'
|
|
title: 'Delete Objects'
|
|
description: 'Learn about deleting objects'
|
|
subtitle: 'Learn about deleting objects'
|
|
sidebar_label: 'Delete Objects'
|
|
---
|
|
|
|
When you delete one or more objects from a bucket, the files are permanently removed and not recoverable. You can delete a single object or multiple objects at once.
|
|
|
|
<Admonition type="note">
|
|
|
|
Deleting objects should always be done via the **Storage API** and NOT via a **SQL query**. Deleting objects via a SQL query will not remove the object from the bucket and will result in the object being orphaned.
|
|
|
|
</Admonition>
|
|
|
|
## Delete objects
|
|
|
|
To delete one or more objects, use the `remove` method.
|
|
|
|
```javascript
|
|
await supabase.storage.from('bucket').remove(['object-key-1', 'object-key-2'])
|
|
```
|
|
|
|
## RLS
|
|
|
|
To delete an object, the user must have the `delete` permission on the object. For example:
|
|
|
|
```sql
|
|
create policy "User can delete their own objects"
|
|
on storage.objects
|
|
for delete
|
|
TO authenticated
|
|
USING (
|
|
owner_id = (select auth.uid())
|
|
);
|
|
```
|