table.truncate
Removes all rows from one of the model's tables, keeping its fields. To remove the table as well, use table.delete.
TIP
For more control, such as other column types, indexes or keys, manage tables with SQL instead. Run CREATE, ALTER and DROP TABLE statements with DatasourceClient's execute.
js
table.truncate(tableName)Parameters
| Parameter | Type | Description |
|---|---|---|
tableName | string | The table's name or id. |
Returns
booleantrue if the table was emptied, false if it can't be found.
Examples
js
const removed = table.truncate("users");