← All procedures

sqlite.schemaVersion

This function gives the schema version of a database. Without a part, it is the `user_version` of the file. With a part, it is the version of that part in the table `schema_versions`, and 0 when the file does not have the part.

MCPCLI
Package
@procedures/sqlite · README
Path
["sqlite","schemaVersion"]
CLI
mark sqlite schemaVersion --db <object>
MCP tool
sqlite.schemaVersion on the dev-tools server
As data
{"$proc":["sqlite","schemaVersion"],"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","schemaVersion"], { db: {} });
console.log(JSON.stringify(result));

From the command line

$ mark sqlite schemaVersion --db <object>

As data, in a program

{ "$proc": ["sqlite", "schemaVersion"], "input": { "db": {} } }

Input

FieldTypeRequiredDefaultDescription
dbobjectyesThe connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it.
partstringnoThe name of a part of the file.

Output

The schema does not list fields (number).

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."
      },
      "part": {
        "type": "string",
        "description": "The name of a part of the file."
      }
    },
    "required": [
      "db"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}