mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
488 lines
7.1 KiB
Plaintext
488 lines
7.1 KiB
Plaintext
---
|
|
id: delete
|
|
title: 'Deleting'
|
|
description: 'How to delete records from your database with Supabase'
|
|
---
|
|
|
|
import DummyData from '../common/DummyData.mdx'
|
|
import Collapsable from '../../src/components/Collapsable'
|
|
import CommonResponses from '../common/CommonResponses.mdx'
|
|
import CommonFilters from '../common/CommonFilters'
|
|
import FromFunction from '../common/FromFunction.mdx'
|
|
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
|
|
import {
|
|
deleteRecordJs,
|
|
deleteFilterJs,
|
|
deleteNotJs,
|
|
deleteMatchJs,
|
|
deleteEqJs,
|
|
deleteNeqJs,
|
|
deleteGtJs,
|
|
deleteLtJs,
|
|
deleteGteJs,
|
|
deleteLteJs,
|
|
deleteLikeJs,
|
|
deleteIlikeJs,
|
|
deleteIsJs,
|
|
deleteInJs,
|
|
deleteCsJs,
|
|
deleteCdJs,
|
|
deleteOvaJs,
|
|
deleteOvrJs,
|
|
deleteSlJs,
|
|
deleteSrJs,
|
|
deleteNxlJs,
|
|
deleteNxrJs,
|
|
deleteAdjJs,
|
|
} from './examples/delete'
|
|
|
|
<DummyData />
|
|
|
|
### Delete records
|
|
|
|
<CustomCodeBlock
|
|
header="Deletes city."
|
|
js={deleteRecordJs}
|
|
jsHighlight="{7-10}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
## Reference
|
|
|
|
### `from()`
|
|
|
|
<FromFunction verb="delete" />
|
|
|
|
### `delete()`
|
|
|
|
```js {3}
|
|
supabase
|
|
.from(tableName)
|
|
.delete(options?)
|
|
```
|
|
|
|
#### `options: object?`
|
|
|
|
```js
|
|
/**
|
|
* @param {boolean} [bulk=false]
|
|
* Protects against bulk deletes. Set to true if you intend to perform a bulk change.
|
|
*/
|
|
const options = {
|
|
bulk: false,
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Filtering
|
|
|
|
### `filter()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use filter( ) with delete( )"
|
|
js={deleteFilterJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="filter" />
|
|
|
|
### `not()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use not( ) with delete( )"
|
|
js={deleteNotJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="not" />
|
|
|
|
### `match()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use match( ) with delete( )"
|
|
js={deleteMatchJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="match" />
|
|
|
|
### `eq()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use eq( ) with delete( )"
|
|
js={deleteEqJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="eq" />
|
|
|
|
### `neq()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use neq( ) with delete( )"
|
|
js={deleteNeqJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="neq" />
|
|
|
|
### `gt()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use gt( ) with delete( )"
|
|
js={deleteGtJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="gt" />
|
|
|
|
### `lt()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use lt( ) with delete( )"
|
|
js={deleteLtJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="lt" />
|
|
|
|
### `gte()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use gte( ) with delete( )"
|
|
js={deleteGteJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="gte" />
|
|
|
|
### `lte()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use lte( ) with delete( )"
|
|
js={deleteLteJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="lte" />
|
|
|
|
### `like()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use like( ) with delete( )"
|
|
js={deleteLikeJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="like" />
|
|
|
|
### `ilike()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use ilike( ) with delete( )"
|
|
js={deleteIlikeJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="ilike" />
|
|
|
|
### `is()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use is( ) with delete( )"
|
|
js={deleteIsJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="is" />
|
|
|
|
### `in()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use in( ) with delete( )"
|
|
js={deleteInJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="in" />
|
|
|
|
### `cs()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use cs( ) with delete( )"
|
|
js={deleteCsJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="cs" />
|
|
|
|
### `cd()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use cd( ) with delete( )"
|
|
js={deleteCdJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="cd" />
|
|
|
|
### `ova()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use ova( ) with delete( )"
|
|
js={deleteOvaJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="ova" />
|
|
|
|
### `ovr()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use ovr( ) with delete( )"
|
|
js={deleteOvrJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="ovr" />
|
|
|
|
### `sl()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use sl( ) with delete( )"
|
|
js={deleteSlJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="sl" />
|
|
|
|
### `sr()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use sr( ) with delete( )"
|
|
js={deleteSrJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="sr" />
|
|
|
|
### `nxl()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use nxl( ) with delete( )"
|
|
js={deleteNxlJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="nxl" />
|
|
|
|
### `nxr()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use nxr( ) with delete( )"
|
|
js={deleteNxrJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="nxr" />
|
|
|
|
### `adj()`
|
|
|
|
<CustomCodeBlock
|
|
header="Shows how to use adj( ) with delete( )"
|
|
js={deleteAdjJs}
|
|
jsHighlight="{9}"
|
|
response={`{
|
|
"body": null,
|
|
"status": 204,
|
|
"statusCode": 204,
|
|
"statusText": "No Content"
|
|
}`}
|
|
/>
|
|
|
|
<br />
|
|
|
|
<CommonFilters filter="adj" />
|
|
|
|
## Responses
|
|
|
|
#### 200 OK
|
|
|
|
Successful request
|
|
|
|
<CommonResponses />
|