fix(mysql): normalize unsigned column types

This commit is contained in:
t8y2 committed 2026-06-21 09:02:16 +08:00
1 parent 4ef94eb3a9
commit 9781b0f562
4 files changed
+106 -3

No files matched your search

@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { combineDataTypeForDatabase, splitDataType } from "../tableStructureEditorState";
describe("tableStructureEditorState", () => {
it("keeps mysql unsigned attributes in the editable base type", () => {
expect(splitDataType("int(11) unsigned")).toEqual({ baseType: "int unsigned", params: "11" });
expect(splitDataType("bigint(20) unsigned zerofill")).toEqual({
baseType: "bigint unsigned zerofill",
params: "20",
});
});
it("combines mysql unsigned type choices with the length field", () => {
expect(combineDataTypeForDatabase("mysql", "int unsigned", "11")).toBe("int(11) unsigned");
expect(combineDataTypeForDatabase("mysql", "bigint unsigned zerofill", "20")).toBe("bigint(20) unsigned zerofill");
});
});