sqlite.clearDatabase
This function drops each view and each table of the database, and sets `user_version` to 0. The indexes and the triggers go with their tables and views. The tables of SQLite itself (`sqlite_*`) stay. Then `migrate` makes each step again.
CLI- Package
- @procedures/sqlite · README
- Path
["sqlite","clearDatabase"]- CLI
mark sqlite clearDatabase --db <object>- As data
{"$proc":["sqlite","clearDatabase"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/sqlite/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["sqlite","clearDatabase"], { db: {} });
console.log(JSON.stringify(result));From the command line
$ mark sqlite clearDatabase --db <object>
As data, in a program
{ "$proc": ["sqlite", "clearDatabase"], "input": { "db": {} } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
db | object | yes | The connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it. | |
options | object | no | The vacuum after the drop. |
Output
The schema does not list fields (string[]).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"db": {
"type": "object",
"properties": {
"handle": {
"type": "string",
"minLength": 1,
"description": "The id of the handle. The procedure that opens the object gives it."
}
},
"required": [
"handle"
],
"additionalProperties": false,
"x-procedures-handle": "node:sqlite#DatabaseSync",
"description": "The connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it."
},
"options": {
"type": "object",
"properties": {
"vacuum": {
"type": "boolean",
"description": "This value makes the file small again after the drop (`VACUUM`). The default is true."
}
},
"additionalProperties": {},
"description": "The vacuum after the drop."
}
},
"required": [
"db"
],
"additionalProperties": false
},
"output": {
"type": "array",
"items": {
"type": "string"
}
}
}