25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { strict as assert } from "node:assert";
import { test } from "vitest";
import { buildGetSchemaCommentSql, buildSetSchemaCommentSql, supportsSchemaComment } from "../../apps/desktop/src/lib/database/dbAdminSql.ts";
test("postgres schema comment SQL quotes identifiers and literals", () => {
assert.equal(supportsSchemaComment("postgres"), true);
assert.equal(supportsSchemaComment("mysql"), false);
assert.equal(buildSetSchemaCommentSql({ databaseType: "postgres", name: 'tenant"one', comment: "Owner's area" }), `COMMENT ON SCHEMA "tenant""one" IS 'Owner''s area';`);
});
test("postgres schema comment SQL clears blank comments", () => {
assert.equal(buildSetSchemaCommentSql({ databaseType: "postgres", name: "analytics", comment: " " }), `COMMENT ON SCHEMA "analytics" IS NULL;`);
});
test("postgres schema comment lookup uses pg_namespace description join", () => {
const sql = buildGetSchemaCommentSql({ databaseType: "postgres", name: "tenant's schema" });
assert.match(sql, /FROM pg_catalog\.pg_namespace n/);
assert.match(sql, /pg_catalog\.pg_description d/);
assert.match(sql, /d\.classoid = 'pg_namespace'::regclass/);
assert.match(sql, /WHERE n\.nspname = 'tenant''s schema';/);
});