← All procedures

sqlite.addMissingColumns

This function adds each column that a table does not have, and gives the names of the added columns in their order.

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

From the command line

$ mark sqlite addMissingColumns --db <object> --table <string> --columns <object>

As data, in a program

{
  "$proc": ["sqlite", "addMissingColumns"],
  "input": { "db": {}, "table": "<table>", "columns": {} }
}

Input

FieldTypeRequiredDefaultDescription
dbobjectyesThe connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it.
tablestringyesThe name of the table. The table must exist.
columnsobjectyesThe columns that the table must have.

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."
      },
      "table": {
        "type": "string",
        "description": "The name of the table. The table must exist."
      },
      "columns": {
        "type": "object",
        "properties": {},
        "additionalProperties": {
          "type": "string"
        },
        "description": "The columns that the table must have."
      }
    },
    "required": [
      "db",
      "table",
      "columns"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "string"
    }
  }
}