fix(sqlserver): restrict identity to compatible column types
Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
This commit is contained in:
1 parent
a224a6747c
commit
5d2ce9f189
13 files changed
+144
-12
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { combineDataTypeForDatabase, createColumnDrafts, dataTypeLengthInputValue, isDataTypeLengthDisabled, splitDataType } from "../tableStructureEditorState";
|
||||
import { combineDataTypeForDatabase, createColumnDrafts, dataTypeLengthInputValue, isDataTypeLengthDisabled, isSqlServerIdentityCompatibleDataType, splitDataType } from "../tableStructureEditorState";
|
||||
|
||||
describe("tableStructureEditorState", () => {
|
||||
it("keeps mysql unsigned attributes in the editable base type", () => {
|
||||
@@ -70,4 +70,13 @@ describe("tableStructureEditorState", () => {
|
||||
expect(drafts.map((draft) => draft.defaultValue)).toEqual(["''", "1", "sysdatetime()", "'prefix (internal)'"]);
|
||||
expect(drafts.map((draft) => draft.original?.column_default)).toEqual(["''", "1", "sysdatetime()", "'prefix (internal)'"]);
|
||||
});
|
||||
|
||||
it("limits SQL Server identity columns to supported data types", () => {
|
||||
expect(isSqlServerIdentityCompatibleDataType("int")).toBe(true);
|
||||
expect(isSqlServerIdentityCompatibleDataType("bigint")).toBe(true);
|
||||
expect(isSqlServerIdentityCompatibleDataType("numeric(18, 0)")).toBe(true);
|
||||
expect(isSqlServerIdentityCompatibleDataType("decimal(10)")).toBe(true);
|
||||
expect(isSqlServerIdentityCompatibleDataType("varchar(255)")).toBe(false);
|
||||
expect(isSqlServerIdentityCompatibleDataType("numeric(18, 2)")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user