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
fix(structure): restore dameng timestamp and time precision display
zipg96dc6c877957
diff --git a/apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.ts b/apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.tsindex e9df2c4432..a9a8aa4cd1 100644--- a/apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.ts+++ b/apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.ts@@ -277,6 +277,23 @@ describe("tableStructureEditorState", () => {});});+ describe("Dameng temporal precision", () => {+ it("restores timestamp and time precision reported in DATA_SCALE", () => {+ const drafts = createColumnDrafts(+ [+ { name: "updated_at", data_type: "TIMESTAMP", numeric_scale: 6, is_nullable: true, column_default: null, is_primary_key: false },+ { name: "created_at", data_type: "TIMESTAMP", numeric_scale: 0, is_nullable: true, column_default: null, is_primary_key: false },+ { name: "clock_time", data_type: "TIME", numeric_scale: 3, is_nullable: true, column_default: null, is_primary_key: false },+ ],+ "dameng",+ );++ expect(drafts.map((column) => column.dataType)).toEqual(["TIMESTAMP(6)", "TIMESTAMP(0)", "TIME(3)"]);+ expect(drafts.map((column) => column.original?.data_type)).toEqual(drafts.map((column) => column.dataType));+ expect(hasExistingColumnTypeChange(drafts)).toBe(false);+ });+ });+describe("PostgreSQL temporal precision", () => {it("keeps the time-zone qualifier returned by PostgreSQL metadata", () => {const drafts = createColumnDrafts(diff --git a/apps/desktop/src/lib/table/tableStructureEditorState.ts b/apps/desktop/src/lib/table/tableStructureEditorState.tsindex 89137f28b1..fc5cd17bea 100644--- a/apps/desktop/src/lib/table/tableStructureEditorState.ts+++ b/apps/desktop/src/lib/table/tableStructureEditorState.ts@@ -1105,6 +1105,13 @@ function columnDataTypeForEditor(column: ColumnInfo, databaseType?: DatabaseTypeconst minimum = normalized === "bit" || normalized === "varbit" ? 1 : 0;if (precision >= minimum) return combineDataTypeForDatabase(databaseType, baseType, String(precision));}+ // Dameng reports TIMESTAMP(6)/TIME(6) precision in DATA_SCALE while keeping+ // DATA_PRECISION null. Without this the structure editor opens a column+ // declared as TIMESTAMP(6) as a bare TIMESTAMP and a later save loses the+ // fractional-second precision (#12444).+ if (databaseType === "dameng" && (normalized === "timestamp" || normalized === "time") && Number.isInteger(column.numeric_scale)) {+ return combineDataTypeForDatabase(databaseType, baseType, String(column.numeric_scale));+ }if (NUMERIC_PRECISION_METADATA_TYPES.has(normalized) && Number.isInteger(column.numeric_precision) && Number(column.numeric_precision) > 0) {const scale = Number.isInteger(column.numeric_scale) && Number(column.numeric_scale) >= 0 ? `,${column.numeric_scale}` : "";return combineDataTypeForDatabase(databaseType, baseType, `${column.numeric_precision}${scale}`);