Parameters
The deleteRecords() method object can contain the following properties:
| Parameter | Type | Required | Description |
|---|---|---|---|
table | string | Yes | The name of the table to delete records from. |
where | Record<string, any> | Record<string, any>[] | No | A filter object or array of objects used to identify the records for deletion. Omit only when using options.allowAll: true. |
options | DeleteRecordsOptions | No | Configuration flags that control the behaviour of the deletion. |
with | Record<string, DeleteNestedRecord> | No | An object specifying related tables from which to delete records simultaneously. See Multi-Table Delete. |
Delete records options
| Option | Type | Default | Description |
|---|---|---|---|
softDelete | boolean | false | If true, the records are not hard deleted, but marked as deleted by setting the deletedAt timestamp to the current time. |
transactional | boolean | false | If true, the deletion is treated as a single transaction; all matching records must be deleted, or all fail. |
chunkSize | number | 1000 | The batch size for processing large deletions. |
dryRun | boolean | false | Simulates the delete operation and returns the list of records that would have been deleted without modifying the database. |
allowAll | boolean | false | Required to delete all records in a table when the where parameter is omitted. This is a safety measure. |