fix(mysql): 修复 enum/set 字段长度显示异常
This commit is contained in:
4 files changed
+30
-4
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { combineDataTypeForDatabase, splitDataType } from "../tableStructureEditorState";
|
||||
import { combineDataTypeForDatabase, dataTypeLengthInputValue, isDataTypeLengthDisabled, splitDataType } from "../tableStructureEditorState";
|
||||
|
||||
describe("tableStructureEditorState", () => {
|
||||
it("keeps mysql unsigned attributes in the editable base type", () => {
|
||||
@@ -14,4 +14,17 @@ describe("tableStructureEditorState", () => {
|
||||
expect(combineDataTypeForDatabase("mysql", "int unsigned", "11")).toBe("int(11) unsigned");
|
||||
expect(combineDataTypeForDatabase("mysql", "bigint unsigned zerofill", "20")).toBe("bigint(20) unsigned zerofill");
|
||||
});
|
||||
|
||||
it("does not expose mysql enum or set values as editable length", () => {
|
||||
const dataType = "enum('purchase_in','sale_out','return_in','adjustment_out','transfer_in','transfer_out')";
|
||||
|
||||
expect(splitDataType(dataType)).toEqual({
|
||||
baseType: "enum",
|
||||
params: "'purchase_in','sale_out','return_in','adjustment_out','transfer_in','transfer_out'",
|
||||
});
|
||||
expect(isDataTypeLengthDisabled("mysql", "enum")).toBe(true);
|
||||
expect(isDataTypeLengthDisabled("mysql", "set")).toBe(true);
|
||||
expect(dataTypeLengthInputValue("mysql", dataType)).toBe("");
|
||||
expect(dataTypeLengthInputValue("mysql", "set('manual','auto')")).toBe("");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user