Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(frontend): restore formatting checks

t8y2073139cde946
diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
index 80bd7dabdc..0204b7c9dd 100644
--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
@@ -485,7 +485,25 @@ const {
confirmDropAllMongoIndexes,
} = useSidebarDatabaseSpecificMutationRuntime({ activeNode, connectionStore });
-const { isTableNotView, supportsTruncate, supportsMysqlAutoIncrement, canDropTableCascade, canTruncateTableCascade, refreshDropTablePreviewSql, refreshTruncateTablePreviewSql, dropTable, refreshTableList, confirmDropTable, emptyTable, confirmEmptyTable, truncateTable, confirmTruncateTable, mysqlAutoIncrement, refreshMysqlAutoIncrementPreviewSql, confirmMysqlAutoIncrement } = useSidebarTableMutationRuntime({
+const {
+ isTableNotView,
+ supportsTruncate,
+ supportsMysqlAutoIncrement,
+ canDropTableCascade,
+ canTruncateTableCascade,
+ refreshDropTablePreviewSql,
+ refreshTruncateTablePreviewSql,
+ dropTable,
+ refreshTableList,
+ confirmDropTable,
+ emptyTable,
+ confirmEmptyTable,
+ truncateTable,
+ confirmTruncateTable,
+ mysqlAutoIncrement,
+ refreshMysqlAutoIncrementPreviewSql,
+ confirmMysqlAutoIncrement,
+} = useSidebarTableMutationRuntime({
activeNode,
releaseActiveNodeReference,
connectionStore,
diff --git a/apps/desktop/src/composables/useSidebarTableMutationRuntime.ts b/apps/desktop/src/composables/useSidebarTableMutationRuntime.ts
index d984750960..281989a26c 100644
--- a/apps/desktop/src/composables/useSidebarTableMutationRuntime.ts
+++ b/apps/desktop/src/composables/useSidebarTableMutationRuntime.ts
@@ -6,7 +6,21 @@ import type { DatabaseType, TreeNode } from "@/types/database";
import { supportsTableTruncate } from "@/lib/database/databaseCapabilities";
import { buildDropTableSql, buildEmptyTableSql, buildMysqlAutoIncrementSql, buildTruncateTableSql, supportsDropTableCascade, supportsNativeMysqlAutoIncrement, supportsTruncateTableCascade, type MysqlAutoIncrementSqlOptions, type TableAdminSqlOptions } from "@/lib/database/dbAdminSql";
import { isSqlServerLinkedNode } from "@/lib/database/sqlServerLinkedServers";
-import { sidebarDangerTarget, showDropTableConfirm, showEmptyTableConfirm, showMysqlAutoIncrementConfirm, showTruncateTableConfirm, dropTablePreviewSql, dropTableCascade, emptyTablePreviewSql, mysqlAutoIncrementPreviewKey, mysqlAutoIncrementPreviewSql, mysqlAutoIncrementValue, truncateTablePreviewSql, truncateTableCascade } from "@/components/sidebar/sidebarTreeDialogState";
+import {
+ sidebarDangerTarget,
+ showDropTableConfirm,
+ showEmptyTableConfirm,
+ showMysqlAutoIncrementConfirm,
+ showTruncateTableConfirm,
+ dropTablePreviewSql,
+ dropTableCascade,
+ emptyTablePreviewSql,
+ mysqlAutoIncrementPreviewKey,
+ mysqlAutoIncrementPreviewSql,
+ mysqlAutoIncrementValue,
+ truncateTablePreviewSql,
+ truncateTableCascade,
+} from "@/components/sidebar/sidebarTreeDialogState";
interface SidebarTableMutationRuntimeOptions {
activeNode: ShallowRef<TreeNode>;
diff --git a/apps/desktop/src/lib/__tests__/database/DatabaseUserAdmin.component.spec.ts b/apps/desktop/src/lib/__tests__/database/DatabaseUserAdmin.component.spec.ts
index f681bbf42e..ca855dc8cc 100644
--- a/apps/desktop/src/lib/__tests__/database/DatabaseUserAdmin.component.spec.ts
+++ b/apps/desktop/src/lib/__tests__/database/DatabaseUserAdmin.component.spec.ts
@@ -259,10 +259,7 @@ describe("DatabaseUserAdmin MySQL account Host changes", () => {
await vi.waitFor(() => expect(mocks.executeQuery.mock.calls.some((call) => call[2] === "SHOW GRANTS FOR 'same-user'@'new-host';")).toBe(true));
expect(mocks.executeMulti.mock.calls[0][2]).toBe("RENAME USER 'same-user'@'old-host' TO 'same-user'@'new-host';");
expect(mocks.productionGuard).toHaveBeenCalledWith(expect.objectContaining({ connection: nativeMysqlConnection, sql: "RENAME USER 'same-user'@'old-host' TO 'same-user'@'new-host';" }));
- expect(mocks.executeQuery.mock.calls.slice(2).map((call) => call[2])).toEqual([
- "SELECT User AS user, Host AS host, plugin AS plugin FROM mysql.user ORDER BY User, Host;",
- "SHOW GRANTS FOR 'same-user'@'new-host';",
- ]);
+ expect(mocks.executeQuery.mock.calls.slice(2).map((call) => call[2])).toEqual(["SELECT User AS user, Host AS host, plugin AS plugin FROM mysql.user ORDER BY User, Host;", "SHOW GRANTS FOR 'same-user'@'new-host';"]);
expect(root?.textContent).toContain("same-user@new-host");
expect(root?.querySelector('input[placeholder="userAdmin.newHost"]')).toBeNull();
});
diff --git a/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts
index d5607bfb08..71bd34a01e 100644
--- a/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts
+++ b/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts
@@ -91,9 +91,7 @@ describe("database user admin providers", () => {
expect(blankLegacyNative).toBe(nativeMysqlUserAdminProvider);
expect(native).toBe(nativeMysqlUserAdminProvider);
expect(normalizedNative).toBe(nativeMysqlUserAdminProvider);
- expect(native?.renameUserSql?.({ user: "app'user", host: "old\\host" }, "new'\\host")).toBe(
- "RENAME USER 'app''user'@'old\\\\host' TO 'app''user'@'new''\\\\host';",
- );
+ expect(native?.renameUserSql?.({ user: "app'user", host: "old\\host" }, "new'\\host")).toBe("RENAME USER 'app''user'@'old\\\\host' TO 'app''user'@'new''\\\\host';");
});
it("does not expose account Host changes to MySQL-compatible providers", () => {
diff --git a/apps/desktop/src/lib/__tests__/database/dbAdminSql.spec.ts b/apps/desktop/src/lib/__tests__/database/dbAdminSql.spec.ts
index 3c03ac3f9c..01296dd008 100644
--- a/apps/desktop/src/lib/__tests__/database/dbAdminSql.spec.ts
+++ b/apps/desktop/src/lib/__tests__/database/dbAdminSql.spec.ts
@@ -13,7 +13,16 @@ const apiMock = vi.hoisted(() => ({
vi.mock("@/lib/backend/api", () => apiMock);
-import { buildDuplicateTableStructurePlan, buildMysqlAutoIncrementSql, collectDuplicateTableColumnComments, damengDropSchemaExecutionSchema, damengDuplicateTableCreateOptions, duplicateTableStructureRequiresScript, oracleDuplicateTableCreateOptions, supportsNativeMysqlAutoIncrement } from "@/lib/database/dbAdminSql";
+import {
+ buildDuplicateTableStructurePlan,
+ buildMysqlAutoIncrementSql,
+ collectDuplicateTableColumnComments,
+ damengDropSchemaExecutionSchema,
+ damengDuplicateTableCreateOptions,
+ duplicateTableStructureRequiresScript,
+ oracleDuplicateTableCreateOptions,
+ supportsNativeMysqlAutoIncrement,
+} from "@/lib/database/dbAdminSql";
beforeEach(() => {
vi.clearAllMocks();