fix(grid): recognize MySQL bit columns as boolean

This commit is contained in:
Diego Fabricio authored and GitHub committed 2026-08-14 02:05:50 +08:00
1 parent 3ecfb99f9a
commit f9f21cbd88
2 files changed
+5 -2

No files matched your search

@@ -3,11 +3,14 @@ import type { DatabaseType } from "@/types/database";
export const BOOLEAN_CHECKBOX_SIZE = 13;
export const BOOLEAN_CELL_EDITOR_VALUES = ["true", "false"];
const MYSQL_BIT_BOOLEAN_DATABASE_TYPES = new Set<DatabaseType>(["mysql"]);
export function isBooleanColumnType(dataType: string | undefined, databaseType?: DatabaseType): boolean {
if (!dataType) return false;
const normalized = dataType.trim().toLowerCase();
if (normalized === "boolean" || normalized === "bool") return true;
if (databaseType === "sqlserver") return normalized === "bit";
if (databaseType && MYSQL_BIT_BOOLEAN_DATABASE_TYPES.has(databaseType)) return normalized === "bit" || normalized === "bit(1)";
return false;
}