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 { buildSingleDdlExportFileContent, ensureSqlStatementTerminator, joinExportedDdls } from "../../apps/desktop/src/lib/export/ddlExport.ts";
test("ensureSqlStatementTerminator appends a trailing semicolon when missing", () => {
assert.equal(ensureSqlStatementTerminator("CREATE TABLE `users` (\n `id` int\n) ENGINE=InnoDB"), "CREATE TABLE `users` (\n `id` int\n) ENGINE=InnoDB;");
});
test("ensureSqlStatementTerminator does not duplicate an existing trailing semicolon", () => {
assert.equal(ensureSqlStatementTerminator("CREATE VIEW v AS SELECT 1;"), "CREATE VIEW v AS SELECT 1;");
});
test("joinExportedDdls separates exported objects with blank lines and terminates each statement", () => {
assert.equal(
joinExportedDdls([
"CREATE TABLE `users` (`id` int)",
"CREATE TABLE `posts` (`id` int);",
]),
"CREATE TABLE `users` (`id` int);\n\nCREATE TABLE `posts` (`id` int);\n",
);
});
test("buildSingleDdlExportFileContent emits a single importable statement with one trailing newline", () => {
assert.equal(
buildSingleDdlExportFileContent(" CREATE TABLE `users` (`id` int) "),
"CREATE TABLE `users` (`id` int);\n",
);
});